The Stack v2
Summary
The Stack v2 is a large-scale pre-training dataset of source code containing over 3 billion files in 600+ programming and markup languages, derived from the Software Heritage archive. It serves as a pre-training corpus for Code LLMs (used to train StarCoder2), with the full dataset at 67.5TB and the deduplicated version at 32.1TB (~900B tokens). The dataset provides SWHIDs (Software Heritage IDs) for provenance and compliance, with file contents stored on Software Heritage's S3 bucket.
- Venue
- BigCode Project / Software Heritage / INRIA
- Source
- huggingface
- Access
- restricted
- License
- Various (per-repository licenses; must abide by original license terms)
- License family
- Other
- Language
- 658 programming and markup languages
- Hugging Face
- bigcode/the-stack-v2
- Author type
- human
- Added
- Jul 17, 2026
- Verified
- Jul 17, 2026
- Research status
- done
From the source
- Repository
- bigcode/the-stack-v2
- Created
- Feb 26, 2024
- Last updated
- Aug 3, 2026
- Downloads (last month)
- 6,031
- Likes
- 638
- Modalities
- text
- Tasks
- text-generation
- Gated
- yes
Topics
Code
Dataset profile
- Scale
- Hub parquet (partial conversion): algorithmic_corpus 5.3M / 1.4 GB; synthetic_code_snippet 3.1M / 1.4 GB; synthetic_qa 3.2M listed vs 7.2M estimated / 2.3 GB. Viewer total 11.6M rows (est. 15.6M). size_categories 10M<n<100M. Canonical dump is JSONL: algorithmic_corpus 54 files ~3.78 GB; synthetic_code_snippet 31 files ~4.94 GB; synthetic_qa 106 files ~17.6 GB (~26.3 GB LFS). Paper Table 3 annealing mix (training tokens, includes RefineCode which is NOT this repo): RefineCode 83.94B + Algorithmic Corpus 12.44B + High Quality Code Snippet 2.71B + Code Textbooks 0.91B. Hub 43.9K downloads / 44 likes at check.
- Format
- JSONL on the Hub (canonical). Configs algorithmic_corpus, synthetic_code_snippet, synthetic_qa. Schemas: {type, lang, text} for the first two; {text, file_name, file_ext, file_size_in_byte, lang, program_lang} for synthetic_qa. Parquet conversion exists but is partial.
- Type
- Pretraining annealing corpus / algorithmic code + synthetic rewrites
- License
- ODC-By (card). algorithmic seed sampled from The Stack v2 (gated; upstream licenses still apply to those files). Synthetic rows generated by OpenCoder authors.
- Cost
- Free
- Languages
- Code-first. JSONL `lang` on algorithmic_corpus/synthetic_code_snippet is a programming language (preview python/java). synthetic_qa JSONL has lang=en plus program_lang (preview java). Card has no spoken-language tag. Paper also synthesizes multilingual snippets. No LID table.
- Modality
- Text-only (source code + English comments/prompts).
- Domain
- code pretraining annealing; algorithmic/LeetCode-style files; synthetic self-contained functions and code-exercise QA; multilingual source files
- Time period
- Algorithmic seed sampled from The Stack v2 / GitHub-style LeetCode solutions (paper RefineCode GitHub cutoff Nov 2023). Synthetic rewrite during OpenCoder annealing. HF createdAt 2024-11-12; lastModified 2025-05-29. Paper arXiv 2411.04905 (2024-11-07).
- Purpose
- High-quality extra mix for the OpenCoder annealing stage (paper: quality over quantity after general RefineCode pretrain), beyond the original RefineCode distribution
- Used for
- OpenCoder-1.5B/8B-Base annealing (paper Table 3 + Fig 9 ablation: dropping this high-quality mix hurts HumanEval/MBPP). Companion of already-cataloged opc-fineweb-code-corpus and opc-fineweb-math-corpus. Hub 43.9K downloads / 44 likes at check. Discord posted the OpenCoder-LLM collection.
- Authors
- OpenCoder-LLM / INF / M-A-P. algorithmic seed: public GitHub/Stack v2 authors (synthetic_qa JSONL has @author javadoc and leetcode-cn URLs). Snippets/QA-style rows rewritten by a strong LLM (paper: Qwen2-72B-Instruct / GPT-4o-Mini-related hqcode for textbooks). Residual LeetCode/contest-solution culture.
- Bias
- LeetCode/algorithm-keyword sample (paper: leetcode / def solution / class solution), not general GitHub. Card folder names do not match JSONL schemas: synthetic_qa JSONL is raw source files (file_name/file_ext/program_lang), while algorithmic_corpus JSONL is type=qa prompt+code and synthetic_code_snippet is type=snippet. Hub parquet conversion for synthetic_qa looks incomplete. Seeded from gated Stack v2; this derived dump is public. English comments + many languages of code.
- Text quality
- Paper: algorithmic files are self-contained and closer to interactive tasks; synthetic snippets kept only if generated tests pass. JSONL preview: real LeetCode Java (pivot index) plus synthetic documented functions. Residual contest boilerplate and incomplete test harnesses in type=qa rows. Not RefineCode (960B) and not the SFT stages.
- Sample size
- Three train configs, no default. Viewer: algorithmic_corpus 5.3M; synthetic_code_snippet 3.1M; synthetic_qa 3.2M parquet / ~7.2M estimated. No official val/test. Paper token mix above is the training recipe, not a guarantee each HF folder equals that token count.
- Long context
- No (self-contained files/functions; OpenCoder-8B trained at 8K, 1.5B at 4K).
- Intermediate steps
- Yes (keyword sample from Stack v2/RefineCode; LLM rewrite to snippets with tests; LLM textbooks). Paper §2.2. Sibling SFT dumps opc-sft-stage1/stage2 are separate repos.
- Idea quality
- High
- Novelty
- Medium (public annealing extras for an already-cataloged OpenCoder FineWeb pair; still a distinct dump)
- Text conversion
- Ready JSONL; load_dataset('OpenCoder-LLM/opc-annealing-corpus', '<config>'). Streaming recommended (~26 GB JSONL). Prefer JSONL over the incomplete parquet conversion.
- Collection method
- Download
- Static
- Unknown (HF lastModified 2025-05-29; one-shot annealing dump. Stack v2 / GitHub later grew; this snapshot was not refreshed.)
- Processed
- Unknown
Research notes
- Bulk download requires agreement with Software Heritage and INRIA. Regularly updated for data removal requests. Paper: arxiv 2402.19173. Multiple variants available: the-stack-v2, the-stack-v2-dedup, the-stack-v2-train-full-ids, the-stack-v2-train-smol-ids.
- Discord posted the OpenCoder-LLM collection (message 1362451409097855268), not this dataset URL. gated=false; public; CuratorBote listed JSONL under all three folders. Do not add these tokens on top of RefineCode 960B or the 55B Processed FineWeb already cataloged as OpenCoder FineWeb Code/Math. Parent bigcode/the-stack-v2 remains gated — skipped; this derived slice is the public annealing dump. Substituted ahead of dump OpenDataArena/FineReason (renamed/is MMFineReason, image+text) and XenArcAI/MathX-5M (card is Modotte/MathX-5M NVIDIA/OpenR1 mashup). Cite Huang et al. 2024 arXiv 2411.04905. Same paper as OpenCoder FineWeb Code/Math already in this CSV. Not in papers_local.csv.
Related entries
- Collection
OpenCoder Datasets
The OpenCoder Datasets collection comprises the full reproducible training data pipeline for the OpenCoder code LLM family, including RefineCode (960B tokens of high-quality code across 607 programming languages with 130+ language-specific filtering rules), FineWeb-code-corpus (148GB), FineWeb-math-corpus (10GB), an annealing corpus (24GB, 15.6M examples), and two-stage SFT datasets (4.21M + 436K examples). Released alongside the OpenCoder paper (ACL 2025), it provides complete transparency into the data curation process for training top-tier code LLMs.
- Dataset
GitHub Code 2025
A large-scale code dataset containing 148 million source code files harvested from GitHub's top 1 million repositories with 2+ stars, totaling approximately 1 TB. Each row includes the repository ID, file size, file path, and full file content, making it suitable for training code generation models and performing code analysis tasks. At least 17 models have been trained or fine-tuned on this dataset.
- Dataset
swallowcode2
[SwallowCode-v1](https://huggingface.co/datasets/tokyotech-llm/swallow-code) was a high-quality Python code dataset generated through an LLM-based rewriting pipeline.
- Dataset
github-top-code
A curated dataset of 1.3M+ source code files from **GitHub's top ranked developers (2015-2025)**.
- Dataset
OpenCoder SFT Stage 2
Stage-2 SFT for OpenCoder-1.5B/8B-Instruct: smaller higher-quality code mix after the ~4.2M Stage-1 dump, including test-case triples usable as code-RL signal
- Dataset
The Stack v2
Open reproducible Code LLM pretraining corpus with license/provenance metadata and developer opt-out
Similar entries
- Dataset UltraData-Code (OpenBMB L0–L3 tiered code pretrain: L2 algorithmic + L3 synthesis)
- Paper BigO(Bench): Can LLMs Generate Code with Controlled Time and Space Complexity?
- Paper Cross-Benchmark Transfer from RL on Agentic Coding Tasks
- Paper CodeGenLink: A Tool to Find the Likely Origin and License of Automatically Generated Code
- Dataset MiMo-V2.6-RL-harbor-code
- Dataset The Stack