Unit 11 of 11 · about 3 hours · implement

Immutable dataset versions, manifests, data cards and checkpoint linkage

A model result is only attributable to a data intervention if you can say which data it saw. The manifest makes that statement checkable, and the card makes the choices behind it readable by someone who was not there.

You'll be able to

  • Build an immutable dataset version: a manifest of files with sizes and checksums, the configuration and code commit, and a version id computed from content, so that changing one byte changes the id and rewriting the same bytes does not.
  • Write a data card for your filtered corpus from a template: purpose, sources and rights, transformations with per-stage counts, known gaps, contamination and PII findings, and intended and out-of-scope uses.
  • Link a checkpoint to the dataset version, tokenizer and sampler seed, and make resume and evaluation refuse a mismatch.

Covers

Immutable dataset versions, manifests, data cards and checkpoint linkage
1

Read

In this order, only the parts listed

0 of 5 done

  1. Data Cards Playbook (Google PAIR)Data Cards Playbook

    User Guide steps 3 to 6 ('Collect your documents', 'Build up from the Data Card design', 'Collaboratively review and expand your content', 'Final Checks') and step 8 (revisit the card about every six months); then the extended template at https://github.com/PAIR-code/datacardsplaybook/blob/main/templates/DataCardsExtendedTemplate.md, sections 'Motivations & Intentions', 'Access, Rentention, & Wipeout', 'Provenance', 'Human and Other Sensitive Attributes', 'Transformations', 'Sampling Methods' and 'Known Applications & Benchmarks'

    Skip the activities, patterns and labs pages; you need the guide and the template.

  2. Dolma (Soldaini et al., 2024)Dolma: an Open Corpus of Three Trillion Tokens for Language Model Pretraining Research (Soldaini et al., 2024)

    Table 1 (the corpus at a glance; its caption names the tokenizer used for the token counts) and Appendix N, the Datasheet

  3. Gopher, Appendix A (Rae et al., 2021)Scaling Language Models: Methods, Analysis and Insights from Training Gopher, Appendix A

    Appendix A.5 'MassiveText Datasheet' (Table A3), which follows the datasheet framework of Gebru et al.

  4. Dolma Toolkit: data formatDolma Toolkit

    'Directory Structure' (documents and attributes per dataset) and the id field: 'Document 12345 in raw is the same as Document 12345 in v0, v1'

  5. Project: Tokenizer and Corpus PipelineTokenizer and Corpus Pipeline

    Milestone F (delete the derived artifacts and regenerate identical manifests and checksums from the raw inputs and the configuration) and the 'Design-defense questions'

2

Focus on

  • A version is its content, not its name or its date. Hash every file, sort the entries, include the configuration that produced the files, and hash that list; reordering or touching files then changes nothing, and one changed byte does.
  • Derived data is regenerated, not trusted. Record the raw input versions, the code commit, the filter and tokenizer versions and the seeds, then check that deleting the derived files and rebuilding gives the same manifest.
  • The card states purpose, sources and rights, transformations with removal rates per stage, sampling and mixture, known gaps, contamination and PII findings, and uses to avoid. Every number belongs to a named tokenizer and a dataset version.
  • A checkpoint stores the dataset version, the tokenizer identity and the loader position. Resume and evaluation compare them with the manifest and fail loudly when they differ.
Common mistakes · 3
  • Versioning by directory name or date. data_v3 says nothing about its bytes, and two runs with that label can differ. Name the version by the content hash and keep the label as a convenience.
  • Leaving out the pieces that change the result: the tokenizer revision, the filter thresholds, the sampler seed and the contamination reference sets. A manifest of files alone cannot tell you why two corpora from the same files trained differently.
  • Writing the card once, at release. Counts go stale when a stage is rerun, and the card must quote the dataset version it describes. Regenerate the numbers from the manifest and the stage logs instead of typing them.
3

Try it yourself

Closed-book, before checking anything

Closed-book, write build_manifest(root, config) that returns a version id: the SHA-256 of a sorted list of [relative_path, size, file_sha256] entries together with the configuration, serialized with sorted keys. In a small test show that a copy written in another order with other modification times has the same id, that changing one byte of one file changes it, and that changing seed in the configuration changes it. Then write a verify(manifest, root) that recomputes it, and a resume(checkpoint, manifest) that raises when the checkpoint's data_version differs.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why does the version id hash the sorted list of file entries rather than the modification times or the archive of the files?Answer

    Modification times and archive layout change when the same bytes are rewritten, which would give a new version for identical data. Sorted path, size and content hash depend only on the data, so the id is stable across copies and changes when any byte changes.

  2. 2.Two corpora were built from identical raw files and trained different models. Which manifest fields would you compare first?Answer

    The configuration and code commit: filter thresholds, language-ID and quality-model versions, the tokenizer revision, the mixture weights and the seeds. Identical inputs with different processing parameters give different corpora.

  3. 3.A token count in a card says 3 billion. What else must the card state for that number to mean anything?Answer

    The tokenizer and its revision, and the dataset version. Token counts depend on the tokenizer: the same text has a different count under another one, as the premium measurements showed.

  4. 4.What should happen when you try to evaluate a checkpoint whose recorded dataset version differs from the one in your manifest?Answer

    The run should stop with an error that names both versions, not continue with a warning. A silent mismatch makes every later comparison about different data.

5

Practice

  • Data Cards Playbook: write the card for your filtered corpus

    The extended template, filled in for the corpus from this section

    Quote counts from your stage logs for each filter, the language table, the duplicate clusters and the contamination and PII findings, and mark each unknown. The section mini-project covers the manifest, the card and the checkpoint link for your own corpus. Implement it in your own repository.

You're done when

Deleting your derived files and rebuilding gives the same version id, your card quotes that id and its numbers come from the logs, and a checkpoint with another data version is refused.

Only when you can do this without notes.

Leads to

Notes

Resources · 5 for this unit, 16 more in the section
  • Scaling Language Models: Methods, Analysis and Insights from Training Gopher, Appendix ADeepMind · support

    Read Appendix A.1 for the exact quality rules behind "Gopher-style" filters (50 to 100,000 words, mean word length 3 to 10, symbol ratios, bullet and ellipsis lines, the stop-word test) and A.5 for the datasheet. The rules are English-specific.

  • Dolma ToolkitAllen Institute for AI · required

    Read docs/data-format.md (stable source and id, attributes aligned row for row), docs/taggers.md, docs/deduplication.md and docs/mixer.md after your CS336 pipeline works. Its deduplication is a Bloom filter over document keys or paragraphs, with possible false positives, not MinHash; record which production concerns your smaller pipeline omits.

  • Dolma: an Open Corpus of Three Trillion Tokens for Language Model Pretraining Research (Soldaini et al., 2024)Allen Institute for AI · support

    Read Section 4.2 (data ablations) and Table 1 (the corpus card) as the template for your own data card. The token count depends on the tokenizer used to count.

  • Data Cards PlaybookGoogle Research · support

    Follow the guide steps and use the templates to write the card for your filtered corpus: sources, rights, filters with removal rates, known gaps and intended use.

  • Tokenizer and Corpus PipelineRoadmap-Final · support

    Reuse the project correctness, lineage and contamination contracts. Extend the artifact instead of starting another tokenizer implementation.

Also in this section

  • CS336 Assignment 4 - DataStanford University · primary

    Implement the handout functions in Sections 2.2 to 2.7 (extract_text, language_identification, the PII masks, the harmful-content classifiers, gopher_quality_filter, classify_quality) and Section 3 (exact_deduplication, minhash_deduplication) until the 21 tests in tests/ pass on CPU. The 8-GPU leaderboard run is out of reach: replace it with one small local training comparison on a filtered sample and keep the retained-token and source-mix tables as evidence.

  • CS336 2026 - Data Lectures 13 and 14Stanford University · required

    Step through the Lecture 13 trace (sources: WebText, Common Crawl, CCNet, C4, The Pile, MassiveText, RefinedWeb, Dolma, DCLM, Nemotron-CC, copyright) and the Lecture 14 trace (KenLM and fastText filters, importance resampling, Bloom filters, MinHash and LSH) at cs336.stanford.edu/lectures/?trace=lecture_13 and ?trace=lecture_14. Reconcile each lecture claim with your Assignment 4 implementation.

  • Deduplicating Training Data Makes Language Models Better (Lee et al., 2022)Google Research · required

    Read Section 4 (exact substring matching with suffix arrays, 50-token threshold justified in Appendix B, and MinHash near-duplicate removal) Section 5 (how much each dataset loses, including train-test overlap) and Section 6 (effects on perplexity and memorization). This is the method behind Assignment 4 Section 3; the 50-token threshold is tuned to English web text.

  • FineWeb Paper and DataTrove PipelineHugging Face · support

    Read FineWeb Section 3 (each extraction, filtering and per-snapshot MinHash decision ablated on small models) and trace examples/fineweb.py in DataTrove at commit 1977fbb (14 bands x 8 hashes = 112 hashes, 5-gram words). LanguageFilter() with no arguments keeps every language above 0.65, so pass languages yourself; the cluster script is a reference, not a local run.

  • Resiliparse, fastText and datasketch on Four DocumentsOpen source · support

    Build one CPU exercise: extract text with Resiliparse extract_plain_text (it keeps navigation unless you pass main_content=True), identify language with fastText lid.176.bin and predict(text, k=1), and find near duplicates with datasketch MinHashLSH. Check every candidate against exact shingle Jaccard: at threshold=0.9 the index uses 5 bands x 25 rows, so it is a candidate filter, not a hard cutoff.

  • Language Model Tokenizers Introduce Unfairness Between Languages (Petrov et al., 2023)University of Oxford · support

    Read Section 3 (tokenization parity and premium) and Sections 4 and 5 (premiums on FLORES-200, cost and context consequences), then measure the premium of your own tokenizer on a parallel slice.

  • Analysing the Impact of Sequence Composition on Language Model Pre-Training (Zhao et al., 2024)University of Edinburgh · support

    Read Section 2 (random, same-source and retrieval packing; causal versus intra-document masking) and Table 1 (perplexity for each strategy). It is the source for testing cross-document attention leakage in your packed batches.

  • Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpus (Dodge et al., 2021)Allen Institute for AI · support

    Read Sections 3 to 5: what C4 contains, what its filters removed, and how the blocklist removed text from and about minority groups. Use it to audit the trade-offs of your own PII and harm filters; it audits, it does not propose a recipe.

  • Modern LLM Notebook - Data EngineeringWalking Labs · support

    Work through notebooks-en/part2-training/15-data-engineering.ipynb (extraction, quality filtering, deduplication, mixing). Reproduce its compact examples, then compare their assumptions with the stricter CS336 tests.

  • TensorTonic - Data Processing SetTensorTonic · support

    Solve Perform Stable Exact Deduplication (cs336-l14-stable-exact-deduplication), Build Deterministic MinHash Signatures (cs336-l14-minhash-signatures) and Compute Temperature-Based Data Mixtures (cs336-l14-temperature-data-mixture). Its MinHash uses SHA-256 of a seed and shingle, so outputs will not match datasketch. Public test cases check the listed edge cases, not gradients or the hidden grader, so keep your own tests beside each solution.

  • DataComp for Language ModelsDataComp-LM Team · depth

    Read Section 4.4 and Table 4 (a fastText classifier keeping the top 10% of documents beat other filters), Figure 4 (removal at each stage) and the Section 3 compute table after the bounded data experiment. The repository dedups with a Bloom-filter tool (BFF), not MinHash, and CORE scores changed between v1 and v2, so never compare them directly.

  • Unicode Standard Annex #15: Unicode Normalization FormsUnicode Consortium · reference

    Read Sections 1.1 and 1.2: canonical versus compatibility equivalence, the four forms NFD, NFC, NFKD and NFKC, and why the compatibility forms can remove distinctions that matter. Use it to decide which form belongs to a matching key and which, if any, to stored text.

  • Tulu 3: Pushing Frontiers in Open Language Model Post-Training, Section 3.2Allen Institute for AI · support

    Read Section 3.2 'Prompt Decontamination' (p. 14 of arXiv:2411.15124v5): the comparison of full-string, n-gram and embedding matching, the 8-gram rule on prompts only, the 50% token-coverage test per instance and the 2% rule per dataset. Use it as a worked example of choosing the match unit and thresholds from the evaluation items.

  • FLORES-200 parallel sentencesMeta AI · support

    Use the devtest split (1,012 sentences, the same sentences in the same order for every language) to measure tokenizer premiums and per-language language-ID retention. The dataset card lists CC BY-SA 4.0 (page read 2026-10-16). The repository is archived and points to a successor; keep the original release for results you want to compare with Petrov et al.

  • Scaling Data-Constrained Language Models (Muennighoff et al., 2023)Hugging Face · support

    Read Section 3.1 (Equation 5, the effective-data term for repeated tokens), Section 6 with Figure 1 (return on compute when repeating data) and Appendix A (the derivation and the fitted constants). Use it to convert epochs into effective tokens and to see how far that fit reaches: models up to 9B parameters on C4 subsets.

  • Hugging Face Datasets: StreamHugging Face · reference

    Read Shard, Shuffle, Interleave, and Save a dataset checkpoint and resume iteration, including the tip that shuffle-buffer contents are lost when resuming. Use tiny local data and check resume by comparing document ids with an uninterrupted run; do not stream a web-scale corpus or upload to the Hub.