You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

The Stack v2 — 12-Language Resolved Content

This dataset provides resolved file content for twelve programming languages, derived from the repository/file identifiers published in bigcode/the-stack-v2-train-full-ids. The upstream dataset ships identifiers only — each file is a pointer into the Software Heritage archive. Here, those identifiers have been resolved to their actual source text so the content is directly usable, with the upstream metadata carried through unchanged.

It exists to support code-retrieval training (natural-language ↔ code pairs). No quality filtering has been applied beyond dropping machine-generated files (see Construction); downstream docstring-based cleaning is left to the consumer.

Languages

Python, Java, JavaScript, Go, PHP, Ruby, Rust, TypeScript, C#, Shell, PowerShell, and R. Files are selected by Software Heritage's per-file detected language (go-enry), one parquet directory per language.

Construction

  1. Source of record. File and repository identifiers come from bigcode/the-stack-v2-train-full-ids (the deduplicated, heuristically filtered training-ID set of The Stack v2). That dataset is repository-grouped; each row carries a files[] list.
  2. Selection. files[] is exploded to one row per file and filtered to the twelve languages above.
  3. Generated-file drop. Files flagged is_generated (minified bundles, compiler/codegen output, and similar) are removed. Vendored third-party code (is_vendor) is kept — it is genuine source.
  4. Content resolution. Each blob_id is fetched from the public Software Heritage content bucket (s3://softwareheritage/content/<blob_id>, gzip-compressed) and decoded using the recorded src_encoding.
  5. Passthrough. Upstream per-file metadata is preserved alongside the text.

No content was mirrored in bulk; identifiers were resolved individually against Software Heritage, which is the access pattern that project documents for its own datasets.

Schema

column description
blob_id Software Heritage content identifier
repo_name source repository
path file path within the repository
language detected language (go-enry)
text resolved file content
src_encoding original character encoding
length_bytes file size in bytes
license_type license category assigned upstream
detected_licenses detected SPDX licenses (comma-joined)
is_vendor whether the file is vendored third-party code
alphanum_fraction fraction of alphanumeric characters
num_lines line count
star_events_count repository star count

How to use

from datasets import load_dataset

# one language
ds = load_dataset("handwoven8588/the-stack-v2-train-xsmol-content", data_dir="Python", split="train")
print(ds[0]["path"], ds[0]["text"][:200])

Licensing

The source files retain their original licenses, recorded per row in license_type and detected_licenses. This dataset is a collection of independently licensed files and does not relicense any of them; downstream use must respect each file's own terms. The dataset inherits the terms of The Stack v2 and of Software Heritage — by using it you agree to those terms, and to The Stack v2's usage terms in particular.

Data governance — opt-out and removals

This dataset is a derivative rebuilt from upstream identifiers, and it inherits the opt-out guarantees of its sources — there is no separate opt-out to maintain here.

  • Opt out (primary). The underlying corpus is The Stack v2. Check whether your code is present and opt out using BigCode's "Am I in The Stack?". Because this dataset is rebuilt from The Stack v2 identifiers, any upstream opt-out propagates here automatically on the next build — no separate request needed.
  • Direct requests. For anything specific to this copy, open a discussion on this dataset's Community tab with the repository name and path(s).
  • Software Heritage. Content is served from the Software Heritage archive; blobs withdrawn upstream fail to resolve and are simply absent here.

Acknowledgements & citation

Content originates from the Software Heritage archive and the BigCode project's The Stack v2. Please cite both.

@article{lozhkov2024starcoder2stackv2,
  title  = {StarCoder 2 and The Stack v2: The Next Generation},
  author = {Lozhkov, Anton and others},
  journal = {arXiv preprint arXiv:2402.19173},
  year   = {2024}
}

Software Heritage: https://www.softwareheritage.org/ — please also acknowledge the archive per its citation guidelines.

Downloads last month
37

Paper for handwoven8588/the-stack-v2-train-xsmol-content