Skip to content
Datasets

The Stack v3

2 min read

The Stack v3 is the largest open source source code dataset collected directly from GitHub for pre-training code-focused language models with full repository context. The corpus reflects the state of public repositories as of August 2025 and contains about 3.6 trillion tokens across 713 programming languages. The main difference from previous versions is that file contents are embedded directly into the dataset, making it fully self-contained for starting training. This dataset is useful for researchers and developers training or fine-tuning code models with project structure support.

Key features

  • Embedded content: Decoded UTF-8 source code text is embedded directly into dataset rows, eliminating the need to download archives separately.
  • Scale and freshness: A data snapshot from August 2025 spanning 173 million repositories with a total size of 15.9 TB.
  • Quality filtering: The dataset has been deduplicated using the language-agnostic MinHash-LSH algorithm and scrubbed of personally identifiable information (PII).
  • Licensing: Files are labeled using ScanCode with support for permissive licenses and file type identification.

What you can do

  • Train from scratch or fine-tune a large language model (LLM) for code generation, auto-completion, and analysis.
  • Analyze project architectures, dependencies, and programming language distribution in open source code.
  • Use the dataset for benchmarking and testing static analysis tools and vulnerability scanners.
  • Work with raw data via DuckDB or Polars using parquet files without loading everything into memory.

Example

from datasets import load_dataset

# Потоковая загрузка для быстрых тестов
ds = load_dataset("HuggingFaceCode/stack-v3-train", split="train", streaming=True)

for repo in ds:
    print(repo["repo_path"], "-", repo["num_files"], "files")
    for f in repo["files"]:
        print(f["file_path"], f["language"], f["license_type"])
        print(f["content"][:100], "...") 
    break
Read moreDetails
Training subset size: 15.9 TB / ~3.6 trillion tokens.
Number of languages: 713 programming and markup languages.
Sources: Direct snapshot of GitHub repositories as of August 7, 2025.
Pipeline tools: go-enry for language detection, ScanCode Toolkit for licenses.
Examples
Discuss Telegram 406 130.3K

About the model

datasets/HuggingFaceCode/stack-v3-train
Author
HuggingFaceCode
Category
Datasets
Released
Posted

On NeyroLearn

Hugging Face

130.3K406

Ask AI about this model

Answered by Gemini 4 · the chat is kept only in this tab

Comments

Datasets

EgoPro

EgoPro