Skip to content
RAG Repo

Supersedes The Stack v1 / v2.

The Stack v2 is BigCode's large-scale source code corpus, released in February 2024 as the pretraining set behind the StarCoder2 models. It was built with Software Heritage, a long-term public archive of code, and its full version spans roughly 67.5TB across more than 600 programming languages, drawn from around 3.28 billion unique files and 104 million repositories. A deduplicated version reduces this to about 32.1TB, and the filtered training splits total in the region of 900 billion tokens, making it several times larger than the original Stack.

Access works differently to most datasets on HuggingFace. The published Parquet tables do not contain the code itself: each record holds a Software Heritage identifier (SWHID) plus metadata such as the file path, detected licence, and repository information. You fetch the actual file contents from Software Heritage's S3 bucket, and bulk downloading requires a prior agreement with Software Heritage and INRIA. HuggingFace access is gated behind an agreement in which you accept that any use of the code must follow the terms of the original licences.

For RAG and AI work, this is a strong retrieval and pretraining corpus for code assistants, letting you index real implementations across a very broad language range while keeping each file tied back to its repository licence. Plan for the extra pipeline step of resolving SWHIDs to blobs, which is the price of the wider coverage.

On licensing, the collection keeps only permissively licensed code, so commercial use is permitted in principle, but the terms travel with each file: many permissive licences still require you to preserve attribution notices in redistributed code. BigCode also honours an opt-out through the Am I in The Stack tool, so a snapshot is not a complete mirror of public code. Compared with our the-stack entry, which covers both versions at a glance, this is the dedicated, much larger v2 profile for teams committing to the Software Heritage workflow.

source-codepermissive-licencepretrainingbigcodesoftware-heritagestarcoder2multilingual-code

Related sources