# swallowcode2

- **ID:** 154
- **Kind:** dataset
- **URL:** https://huggingface.co/datasets/tokyotech-llm/swallow-code-v2
- **Authors:** tokyotech-llm
- **Venue:** tokyotech-llm
- **Published:** 2025
- **Source:** huggingface
- **Language:** en
- **Access:** free
- **License:** apache-2.0
- **License family:** Permissive (auto-classified)
- **Tags:** hf-dataset-language-modeling
- **Topics:** Language Modeling, Code
- **Added:** 2026-07-17
- **Verified:** 2026-07-17
- **Research status:** done
- **Page:** https://papers.projxon.ai/entries/154

## Summary

[SwallowCode-v1](https://huggingface.co/datasets/tokyotech-llm/swallow-code) was a high-quality Python code dataset generated through an LLM-based rewriting pipeline.

## Attributes

- **Purpose:** Language Modeling
- **Scale:** 10M<n<100M
- **Used for:** arXiv: 2505.02881, 2506.03524
- **Time period:** created 2025-10-20; updated 2025-11-08
- **Author type:** unknown

## From the source (fetched 2026-10-03)

- **Repository:** tokyotech-llm/swallow-code-v2 (Hugging Face)
- **Created:** Oct 20, 2025 (Hugging Face)
- **Last updated:** Nov 8, 2025 (Hugging Face)
- **Downloads (last month):** 5,638 (Hugging Face)
- **Likes:** 50 (Hugging Face)
- **Size:** 100M to 1B rows (Hugging Face)
- **Modalities:** text (Hugging Face)
- **Tasks:** text-generation (Hugging Face)
- **Formats:** json (Hugging Face)

## Dataset profile

- **Scale:** Card: 49.8B Llama-3 tokens (v1 was 16.1B). usedStorage 5,194,499,027,449 bytes (~5.19 TB / 4.72 TiB) for all pipeline stages on Hub. Default SwallowCode-v2 = stage5-auto-format/python/medium: 150 jsonl (train_0001–0160 with gaps 0050, 0055, 0115–0122); most ~7.0–7.2 GB, a tail of ~2.2–4.7 GB shards. datasets-server estimated_num_rows 146,711,936 across configs (partial viewer). stage4-llm-rewrite estimated 19,588,324 rows (stage5 is the ruff-formatted medium rewrite of that set; stage5/swallowcode-v2 size endpoints failed). YAML size_categories 10M<n<100M vs Hub tag 100M<n<1B (multi-config). gated=false. Hub 11,154 downloads / 44 likes at check.
- **Format:** jsonl per pipeline stage (stage1-auto-format … stage5-auto-format). Default config swallowcode-v2 points at stage5 python medium train*.
- **Type:** Pretraining corpus / rewritten Python code
- **License:** Apache-2.0 (card). Also subject to The-Stack-v2 licensing terms (card). v1 was Llama 3.3 Community License — this v2 dump is the Apache release. Qwen3 rewrite outputs inherit Qwen terms where applicable.
- **Cost:** Free
- **Languages:** Python source (card language:en). Comments mixed; rewriter is English-oriented. Python-only released (13-language plan dropped for GPU cost). Leftover stage1/c jsonl shards exist but are not the v2 release.
- **Modality:** Text (Python source)
- **Domain:** Python code pretraining; LLM-rewritten Stack-v2
- **Time period:** HF createdAt 2025-10-20; lastModified 2025-11-08. Paper 2025-05-05 (arXiv 2505.02881) describes v1 (16.1B, Llama 3.3 license); this Hub dump is the Apache v2 rewrite. Discord posted 2025-11-17. Source The-Stack-v2 (Software Heritage GitHub; older). Rewriter Qwen3-235B-A22B-Instruct-2507.
- **Purpose:** Public 49.8B-token Apache-2.0 rewritten Python corpus for code pre-training, vs gated The-Stack-v2 and metadata-only Nemotron-Pretraining-Code-v1
- **Used for:** Llama-3.1-8B 50B-token continual pretrain: +20.7 HumanEval / +21.9 HumanEval+ pass@1 vs Stack-Edu (card). Paper v1 CPT +17.0 / +17.7 vs Stack-Edu. Hub 11,154 downloads / 44 likes at check. GitHub rioyokotalab/swallow-code-math 31 stars. Tokyo Tech Swallow checkpoints.
- **Authors:** Original snippets: GitHub via The-Stack-v2. Rewrites: Qwen3-235B-A22B-Instruct. Quality scorer: SeedCoder prompt. Tokyo Tech (Kazuki Fujii, Yukito Tajima, Masaki Kawamura, Naoaki Okazaki, Rio Yokota et al.).
- **Bias:** Python-only. Ablation: rewriting Medium-quality SeedCoder-scored seeds beat High-quality on HumanEval (authors hypothesize simpler, problem-like files match the bench). Qwen3 rewrite style can uniformize code. Upstream The-Stack-v2 GitHub popularity/permissive-license skew remains. Instruct rewriter used (Thinking model similar quality, higher GPU). 1-stage rewrite adopted over v1’s 2-stage (similar downstream, ~2× cheaper).
- **Text quality:** Five-stage transform-and-retain: ruff auto-format → length filter → SeedCoder 0–10 score → Qwen3-235B rewrite for clarity/structure → final ruff. Contrasts filter-only Stack-Edu. Residual LLM rewrite errors, over-simplification, and leftover tmp_*.jsonl under stage3/high. Do not train on stage1/c or unreleased language dirs.
- **Sample size:** Default swallowcode-v2 / stage5-auto-format: python medium train* (150 shards; ~20M estimated from stage4). Also configs stage1-auto-format, stage2-length-filter (high), stage3-llm-score (high+medium YAML; server currently exposes medium), stage4-llm-rewrite. No val/test. Sister tokyotech-llm/swallow-math-v2 is a separate repo.
- **Long context:** Mixed (length-filtered; stage2 longer_samples dir exists). Typical files are medium code snippets, not repo-scale documents.
- **Intermediate steps:** Yes (The-Stack-v2 Python → ruff → length filter → SeedCoder score → Qwen3 1-stage rewrite → ruff). Intermediate stages 1–4 are on Hub. Code/prompts: github.com/rioyokotalab/swallow-code-math.
- **Idea quality:** High
- **Novelty:** High (public 49.8B Apache rewritten Stack-v2 Python with actual files, not metadata-only)
- **Text conversion:** Ready jsonl. load_dataset("tokyotech-llm/swallow-code-v2", "swallowcode-v2") or config stage5-auto-format. Streaming required (multi-TB repo; stage5 alone is ~1 TB of jsonl).
- **Collection method:** Download
- **Static:** Unknown (HF lastModified 2025-11-08; Python-only one-shot; authors mention a possible v3)
- **Processed:** Unknown

## Links

- Dataset: https://huggingface.co/datasets/tokyotech-llm/swallow-code-v2
- Related: https://arxiv.org/abs/2505.02881
- Related: https://huggingface.co/datasets/tokyotech-llm/swallow-code-v2
- Related: https://huggingface.co/datasets/tokyotech-llm/swallow-math-v2
- Related: https://github.com/rioyokotalab/swallow-code-math
- Related: https://huggingface.co/datasets/bigcode/the-stack-v2
- Related: https://huggingface.co/datasets/HuggingFaceTB/stack-edu

## Research notes

- downloads=13854; likes=42
- Discord posted the HF pointer. Cite Fujii et al. 2025 arXiv 2505.02881. gated=false; public. Substituted for gated bigcode/the-stack, bigcode/the-stack-v2, and nvidia/Nemotron-Pretraining-Code-v1 (CuratorBote still no access 2026-08-14). Distinct from OpenCoder FineWeb Code Corpus already in this catalog. Not in papers_local.csv. Not on the Aug 13 live Datasets sheet export.

## Related entries

- Related: [swallowmath2](https://papers.projxon.ai/entries/153) (dataset, #153)
- Related: [The Stack v2](https://papers.projxon.ai/entries/232) (dataset, #232)
- Related: [The Stack v2](https://papers.projxon.ai/entries/1179) (dataset, #1179)

## Similar entries

- [github-top-code](https://papers.projxon.ai/entries/229) (dataset, #229)
- [Step-3.5-Flash-SFT](https://papers.projxon.ai/entries/255) (dataset, #255)
- [EsoLang-Bench](https://papers.projxon.ai/entries/269) (dataset, #269)
- [AgentTrove](https://papers.projxon.ai/entries/355) (dataset, #355)
- [TaskTrove](https://papers.projxon.ai/entries/359) (dataset, #359)
- [Superior-Reasoning-SFT-gpt-oss-120b](https://papers.projxon.ai/entries/206) (dataset, #206)
