Unit 1 of 11 · about 3 hours · explain
Corpus purpose, target population, provenance and usage rights
Every filter and mixture choice later in this section is judged against what the corpus is for, and every rights question is answered from a record made when the data was acquired. A record you did not keep at download time cannot be rebuilt afterwards.
You'll be able to
- Write a corpus purpose statement that names the intended model behavior and the population of text and users it must serve, and state what the corpus must not be used for.
- Trace one source from live site to crawl to dump to your files, and record at each hop the license or consent basis, the restrictions that apply and what is still unknown.
- Explain why a stable source and document id, kept through every later version, is what makes a deletion or blocklist request actionable.
Covers
Read
In this order, only the parts listed
0 of 4 done
- CS336 2026 Lecture 13: Data I (executable trace)CS336 2026 - Data Lectures 13 and 14
The
raw_sources,copyright,common_crawlandcommon_pilesteps: why a live service is not training data, the crawl restrictions, the decline-of-consent item, licenses, fair use, terms of service, the lawsuit summaries, and the 'Subtleties' list under CommonPileSkim the dataset tour from
berttonemotron_cc; you need it only for the Dolma and Dodge readings below. The lecture is a non-lawyer account of US law at its date, and its copyright term of 75 years is a simplification, so do not copy that figure into a rights record. - Dolma (Soldaini et al., 2024)Dolma: an Open Corpus of Three Trillion Tokens for Language Model Pretraining Research (Soldaini et al., 2024)
Section 3 (Data Design Goals, the four goals and their footnotes) and Table 1 (the corpus at a glance)
- Documenting Large Webtext Corpora (Dodge et al., 2021)Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpus (Dodge et al., 2021)
Section 3 (corpus-level statistics: 3.1 domains, 3.2 utterance date, 3.3 geolocation) and Sections 5.2 and 5.3 (which identities and whose English the filters removed)
- Dolma Toolkit: data formatDolma Toolkit
'Dolma Document Format' with the
idfield and themetadatafield
Focus on
- State the purpose before you filter: the behavior the model must have and the population it serves. Dolma scopes itself to English text on purpose and says that this reinforces English as the default (Section 3), which is what makes its English-only rules defensible.
- A page reaches you through several hops, and each hop has its own rules:
robots.txtand terms of service at crawl time, copyright and any license on the content, and the license on the collection that redistributes it. Keep one row per source and mark each field verified, assumed or unknown. - A collection license does not pass to the documents inside it, and a content license does not override a site's terms of service. The lecture's CommonPile list and the YouTube example make both points.
- A deletion or takedown request can be honored only if the document id is stable across every later version and every derived artifact keeps it. Dolma requires this of the
idfield so that a blocklist applies to all versions.
Common mistakes · 3
- Treating 'it is in the crawl' as 'it may be used for training'. A crawl records how you obtained a page, not what its owner permits.
- Writing the purpose as a list of sources ('web, code, books'). That gives you nothing to test filters against: Dodge Sections 5.2 and 5.3 show a blocklist removing text by and about minority groups, which counts as a loss only if those groups are in the population you stated.
- Filling the rights record after the download. The date, the version of the terms and the
robots.txtyou saw at that time cannot be rebuilt later, so capture them while acquiring.
Try it yourself
Closed-book, before checking anything
source, acquired_from, date, basis (license, consent or exception claimed), restrictions (robots.txt, terms), personal_data, deletion_contact and unknown. Mark every cell verified, assumed or unknown, and list which cells you could not fill from the data alone.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.A page is in the crawl snapshot you downloaded. Give two separate reasons you may still be unable to train on it.Answer
The owner holds copyright unless a license or an exception such as fair use applies, and that exception is unsettled. Independently, the site's terms of service or
robots.txtcan restrict automated copying even when the content is licensed, and the page may contain personal data.2.Why must a document id stay the same from the raw files to every later dataset version?Answer
A blocklist for takedown requests, evaluation leaks or manual rejection is a list of ids. If ids were reassigned per version, the list would stop matching the later versions without any error, and a deleted document could survive in them.
3.A corpus is released under a permissive collection license. Can you assume each document in it is free to use?Answer
No. The collection license covers the compilation. Each document keeps whatever status its owner gave it, so you still need a per-source basis, and laundering of copyrighted work into a permissive collection is a known risk.
4.A corpus is scoped to English on purpose. Name one thing that scope justifies and one claim it does not support.Answer
It justifies English-specific rules such as a stop-word test or an English language-ID threshold. It does not support any claim about how a model trained on it behaves in other languages, and the scope should be stated in the card so readers do not infer one.
Practice
- CS336 Assignment 4: Problem
look_at_ccSection 2.1 (p. 3), parts (a) to (d); download the example files with
uv run scripts/download_data.py --offline-onlyThe problem is written, with no test. For (d) keep the 25 annotations as a table and add two columns: the rights position you can see from the page (license, terms, none) and whether it holds personal data. The section mini-project reuses this ledger for your own corpus; do not publish the course's solutions.
You're done when
You have a ledger for your planned corpus in which every cell is marked verified, assumed or unknown, and you can say what a deletion request would need in order to find its document in every later version.
Only when you can do this without notes.
Leads to
Notes
Resources · 4 for this unit, 17 more in the section
- 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_13and?trace=lecture_14. Reconcile each lecture claim with your Assignment 4 implementation. - 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.mdanddocs/mixer.mdafter 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.
- 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.
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 intests/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. - 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.
- 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.
- 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.pyin 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 passlanguagesyourself; 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 passmain_content=True), identify language with fastTextlid.176.binandpredict(text, k=1), and find near duplicates with datasketchMinHashLSH. Check every candidate against exact shingle Jaccard: atthreshold=0.9the 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.
- 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.
- 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. - Tokenizer and Corpus PipelineRoadmap-Final · support
Reuse the project correctness, lineage and contamination contracts. Extend the artifact instead of starting another tokenizer implementation.
- 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.