The Stack v2
Summary
Open reproducible Code LLM pretraining corpus with license/provenance metadata and developer opt-out
- Source
- huggingface
- Access
- Free metadata after gate; bulk content agreement required
- License
- other / per-file SPDX; ToU requires original license compliance + SWH LLM principles
- License family
- Other
- Language
- code
- Added
- Sep 10, 2026
- Verified
- Sep 10, 2026
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
- code, text
- Tasks
- text-generation
- Gated
- yes
Topics
code pretraining; multilingual source code; Software Heritage
Dataset profile
- Scale
- Full 67.5TB / >3B files / 104.2M repos; dedup 32.1TB; train-full ~900B tokens. Hub metadata usedStorage ~427 GB. size_categories unknown.
- Format
- Parquet metadata per language config (600+); contents fetched via blob_id from s3://softwareheritage/content/
- Type
- Code corpus / SWHID + metadata (contents on SWH S3)
- License
- other / per-file SPDX; ToU requires original license compliance + SWH LLM principles
- Cost
- Free metadata after gate; bulk content agreement required
- Languages
- 658 langs (card); paper 619. High-resource langs (C, JS, etc.) overrepresented vs niche (Julia, Scala). Natural language in comments mostly English.
- Modality
- Source code / text. No images.
- Domain
- code pretraining; multilingual source code; Software Heritage
- Time period
- SWH graph 2023-09-06; GH Archive to 2023-09-14. Paper 2024-02-29. Hub created 2024-02-26; lastModified 2026-08-03 (v2.2.0 opt-out purge). Discord mid 1478777064818479185 (2026-03-04).
- Purpose
- Open reproducible Code LLM pretraining corpus with license/provenance metadata and developer opt-out
- Used for
- StarCoder2 3B/7B/15B (paper). Hub 6.3K downloads / 626 likes at check; paper 160 upvotes.
- Authors
- BigCode collaboration (Lozhkov, Li, Ben Allal, von Werra, de Vries et al.; ServiceNow/HF/many labs). Source producers: GitHub users with unique repos through 2023-09-06.
- Bias
- Permissive-license skew; some langs rarely permissive (SQL/Batchfile/TS ~4% vs ~10% avg). Longer files more often permissive. Comment toxicity risk. HTML may not be WCAG-compliant.
- Text quality
- Exact-dedup + near-dedup (~40% of permissive files were near-dups). Filters: no binary/empty/undecodable; drop >10MB. Vendor/generated flags via go-enry. Train-* variants add heuristics + repo grouping.
- Sample size
- No official train/test split (near-dup leakage risk). Language configs e.g. Python, Dockerfile, default=all.
- Long context
- Mixed (file-level; train-* group by repo for full-repo context).
- Intermediate steps
- Yes (SWH traversal; GH Archive metadata; ScanCode license detect; permissive filter; near-dedup; opt-out removals v2.0.1–v2.2.0).
- Idea quality
- High
- Novelty
- High (largest open SWH-backed code dump with governance; still foundational vs newer niche dumps)
- Text conversion
- Metadata load_dataset works after gated ToU. Bulk contents need SWH/INRIA agreement + AWS credentials. Streaming supported.
- Collection method
- Download (gated) + optional SWH S3
- Static
- No (periodic opt-out updates; lastModified 2026-08-03)
- Processed
- Unknown
Research notes
- Discord data-source-dump mid 1478777064818479185. Cataloged without CuratorBote gated access — public card/API only. Prefer train-full-ids/smol-ids for training-ready filters. Related: the-stack-v2-dedup.
Related entries
- 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
The Stack v2
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.
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?
- Dataset Nemotron-Pretraining-Code-v1
- Dataset The Stack
- Paper Cross-Benchmark Transfer from RL on Agentic Coding Tasks
- Dataset MiMo-V2.6-RL-harbor-code