Topic: data-curation-and-datasets

Reading: 35 min, plus 6 in closed details. The map of the data side of language models: where training text comes from and how a raw web crawl becomes a dataset, stage by stage (extraction, filtering, deduplication, quality models, decontamination, mixing, synthetic and post-training data, storage), with the comparisons across stages and one Common Crawl file measured through all of them. Nine child pages own the mechanisms; the lab tabs measure each stage on the running example on an Apple M1 Pro, published results kept apart. Data as of October 2026.

A training dataset is what survives a chain of filters ordered from cheap to expensive, and every stage trades the same two things: how good each token is against how many unique tokens are left before the run has to repeat them.

Data curation is everything done to text before a model trains on it: finding it, turning it into clean text, throwing most of it away, removing copies and test questions, and deciding how much of each kind to show the model and when. This page is the map: what each stage is, how the stages compare, and which child page owns each one. The children teach the mechanisms.

Fig. 1 follows one Common Crawl file through the pipeline, cheapest stage first. Each stage is a glass gate: the documents that pass flow on, the ones it removes fall into the tray in front, and the white column after each gate is the share of the file's HTML pages still alive, to scale. Every count is measured on the running example (below) with datatrove 0.10.1.

  1. Collect, then the URL filter. Collecting means Common Crawl's raw HTTP responses, plus code, papers, PDFs, books; licences and opt-outs are decided here (Pretraining corpora). One WARC file holds 20,991 responses; 20,463 HTML pages enter. The URL filter checks blocklists of adult and spam domains, before any page is read: −183 → 20,280 (Extraction and filtering, section 10; section 3).
  2. Extract. HTML to the page's main text; menus and footers dropped. 1,039 pages give no text → 19,241 (Extraction and filtering, sections 1 to 5).
  3. Language ID. Keep the languages wanted (English at 0.65 or more). The largest cut of a multilingual crawl: −12,270 → 6,971 (Extraction and filtering, section 6).
  4. Heuristic rules. Gopher, C4 and FineWeb rules on length, repetition, punctuation: −4,279 → 2,692. The heuristic-rules gate is four steps (Gopher repetition 1,512, Gopher quality 1,883, C4 355, FineWeb 529; Extraction and filtering, sections 7 to 9; its Fig. 3 runs the 6,971 documents through the rule gates one by one).
  5. Deduplicate. Exact, fuzzy (MinHash), substring, semantic: −75 inside one file → 2,617 (Deduplication; section 4 on why one file finds so few copies).
  6. Quality model. A classifier scores every document; a threshold keeps the top slice. On the 2,617: FineWeb-Edu's classifier keeps 159, DCLM's 573, the two thin columns (Quality classifiers and data selection; section 5). The stages after it were measured on all 2,617, so the main stream carries on at that width.
  7. Decontaminate, scrub PII. Remove benchmark items you will report; mask emails and IP addresses. The 2,617 documents share no 13-gram with any benchmark item, so nothing falls out; PII edits text and removes nothing (101 documents edited) (Decontamination, PII and data governance; section 6).
  8. Mix and stage. How many tokens of each domain, how often each repeats, and when: the planning step, with no file count. Web text is one of five domains here; the column shows the running example's natural shares (17% web, 16% Wikipedia, 31% code, 21% maths, 15% papers), then the weights a 0.8M-parameter DoReMi proxy chose (2.6%, 10.7%, 37.9%, 38.5%, 10.3%; one seed, not a recommended mix: section 7; Data mixing).
  9. Store and load. Tokenize once, shard, pack, shuffle, stream to the trainer, resume. On 2,000 FineWeb documents, bytes per token of each stored form: 5.41 as JSONL, 1.93 as JSONL with zstd, 4.01 as a uint32 token shard (derived: file bytes over 1,422,641 Qwen3 tokens, from the Tool map's measurement; Storage and loading draws every form in its Fig. 1; the four shards drawn here are illustrative).
  10. The whole line, and beside it. From 20,463 HTML pages to 2,617 documents, 12.8%; FineWeb kept 2,425 documents from the same file, and 2,403 of them are in this output. Beside the main line: synthetic data, where a model writes or rephrases text when good real tokens run out; it joins the mix (200 pages rephrased by Qwen3-4B: Synthetic data); and post-training data, a second, smaller pipeline: prompts plus a signal of what good looks like (samples of Tulu 3, UltraFeedback, RLVR prompts: Post-training data).

The bars to scale, stage by stage, are Extraction and filtering's hero; the Pipeline lab runs the same funnel with three extractors. The real order varies (FineWeb deduplicates before its last rules; DCLM runs its quality model after dedup), but the principle is fixed: cheap stages run on everything, expensive ones only on what survives.

You need nothing beyond knowing what a language model trains on; token counts depend on the tokenizer (Tokenizers), which is why every corpus size here says whose count it is.

New terms on this page (19)

Token: the unit a model reads, a word piece of about four characters of English. Corpus: the documents a model trains on, sized in tokens. Crawl (snapshot, dump): one pass of Common Crawl over the web. WARC, WAT, WET: a crawl's raw HTTP responses, their metadata, and Common Crawl's own extracted text. Extraction: HTML to the page's main text. Language ID: a classifier giving each document a probability per language. Heuristic filter: a hand-written rule on a simple statistic with a threshold. Deduplication: removing exact or near copies. Quality model: a model that scores documents so a threshold can keep the best. Data ablation: train identical small proxy models on data differing in one decision and compare scores. Decontamination: removing training text that overlaps the test sets you will report. PII: personal data (emails, addresses, names). Mixture weights: the share of training tokens each domain supplies. Epoch: one pass over a domain's unique tokens. Mid-training or annealing: a short final stage on the best data while the learning rate decays. Continued pretraining (CPT): training a finished model further on one domain. Synthetic data: text written or rewritten by a model. SFT, preference, RLVR, environment data: the four shapes of post-training example (section 9).

The running example, and how numbers are labelled

Every lab tab measures on the same public data on one laptop, so numbers compare across tabs and child pages. The raw slice is one Common Crawl WARC file, the first of the July 2024 crawl (CC-MAIN-2024-30, 718.7 MB, 20,991 responses of which 20,463 HTML pages reach the pipeline), with its WET and WAT files; the Pipeline lab widens it to four files (81,738 HTML pages). It was chosen because FineWeb and FineWeb-Edu record the source WARC of every document, so the documents each kept from this exact file are known: 2,425 in FineWeb and 159 in FineWeb-Edu. DCLM-baseline only covers crawls before 2023, so a 50,000-document DCLM sample stands in for it and DCLM's own classifier is run on our pages; Nemotron-CC is represented by samples of each of its quality buckets from the same crawl. Seven benchmark test sets (MMLU, GSM8K, ARC-Challenge, ARC-Easy, HumanEval, MATH-500, HellaSwag) are the decontamination targets, and samples of Tulu 3's SFT mixture, UltraFeedback and Tulu 3's RLVR prompts stand for post-training data. The models are fastText lid.176 for language ID, the FineWeb-Edu classifier and DCLM's fastText classifier, all run on an Apple M1 Pro CPU; the full definition, with revisions and checksums, is in src/data/README.md.

Labels: measured means produced here in October 2026 on an Apple M1 Pro (CPU), self-reported a dataset's or method's makers evaluating their own work, third-party a comparison by someone without a stake in the result, derived computed from other numbers with the formula shown, and illustrative an input made up for teaching.

1. Why the data decides so much, and which stage buys what

The question: at a fixed training budget, how much does it matter which tokens you use? Across seven years of open recipes, Dwarkesh Patel and Jerry Han crossed each year's representative open training recipe (GPT-2 in 2019 to OLMo 2 in 2025) with each year's public corpus (OpenWebText in 2019 to Ultra-FineWeb in 2025), trained every pair at budgets up to 1019 FLOPs and read off the compute each improvement saves. Better data saved 12.0x compute, better models 3.7x: data contributed 3.24 times more, and a simple additive model of "data effect plus model effect" explains 88% of the score differences, so in benchmark points the two barely interact third-party (Patel and Han, 2026-09-08). In compute they overlap: both together saved 15x, a third of the 45x product (our reading). The caveats are the authors' own: small models, little tuning, one benchmark suite (OLMES), one seed per cell; their remark that small models gain most from data quality is an argument, not a measurement.

The cleanest evidence is a data ablation: identical small proxy models trained on data that differs in one decision. Five years before the modern corpora, the T5 paper showed the direction: an unfiltered crawl 8 times larger than C4 (6.1 TB against 745 GB) scored lower on 6 of 7 task groups at the same budget (T5, Table 8; its text says "every task", but on SuperGLUE its Wikipedia-only model is 0.03 lower than the unfiltered one). The table puts every stage's best published ablation side by side; it is the comparison only this page can make, and it says where to spend effort.

Extraction, the quality model and the final stage move scores most; dedup and decontamination mostly protect

StageBest published effect at fixed computeWhat it costsOwner
ExtractionWET text 20.7 Core against 24.1 (resiliparse) and 24.5 (trafilatura), 1.4B model (DCLM Tables 3 and 16)parses every page; resiliparse 4.55 MB of WARC per second per core, trafilatura 0.56Extraction and filtering
Heuristic rulesFineWeb's own three rules: about 22% of tokens removed, about 1% added to the aggregate score; C4's terminal-punctuation rule the largest HellaSwag boost of C4's rules, at about 30% of tokens (FineWeb Sections 3.5 and 3.6)nearly free; the cost is good text wrongly droppedExtraction and filtering
Deduplicationmemorised output of a 1.5B model trained on C4 cut tenfold, 1.926% to 0.189% of generated tokens (Lee et al., Table 4); accuracy gains small: up to about 4 repeats is almost as good as fresh data (Muennighoff et al.)MinHash signatures and buckets per crawl; global passes can hurt (section 4)Deduplication
Quality modelDCLM's fastText filter 30.2 Core against 27.5 for no model-based selection, 1.4B model on 28.8B tokens; at 7B the filter alone moved MMLU from 35% to 44% (DCLM, Table 4)fastText scores on CPU; FineWeb-Edu's classifier took 6,000 H100 hours for 15T tokensQuality classifiers
DecontaminationDCLM removed the MMLU and HellaSwag overlaps it found and retrained a 7B model: MMLU 51.8 before, 52.7 after, so the gains were not leaked items (DCLM, Table 7)an n-gram index of every test item; false positives drop good textDecontamination, PII and governance
Mix and final stageOLMo 2 7B: 50B tokens of mid-training (about 1.2% of the run) took GSM8K from 24.1 to 67.5 (OLMo 2, Table 9)proxy runs to choose weights; a short anneal per candidate datasetData mixing
Synthetic rephrasingNemotron-CC's 8B on 15T tokens, low tiers rephrased instead of dropped: MMLU 70.3 against 65.3 for Llama 3.1 8B in NVIDIA's harnessan LLM pass over the rephrased tiersSynthetic data

Every row is self-reported except where the method was someone else's rerun under the same budget (most rows of DCLM's Table 4). Scales differ between rows (1.4B to 8B models), so compare the direction and rough size, not the numbers across rows. Sources: DCLM, arXiv 2406.11794; FineWeb, arXiv 2406.17557; Lee et al. 2021; Muennighoff et al. 2023; OLMo 2, arXiv 2501.00656; Nemotron-CC, arXiv 2412.02595. The Quality lab measures how differently real filters judge the same documents.

Data decisions are empirical: even "obviously good" steps have to be ablated. The sharpest example is FineWeb's attempt to deduplicate all 96 crawls against each other, whose model barely beat one trained on non-deduplicated data (section 4). How to read an ablation critically: check the model size, tokens, benchmarks and seeds before believing a gap; small proxies can only use benchmarks that already move at small scale, and a dataset's makers choose the benchmarks it is evaluated on (the mistakes block in section 11).

2. Where the tokens come from

Almost every open pretraining corpus starts from Common Crawl (CC), a non-profit that has crawled the web since 2008 and publishes a new crawl every month or two. One crawl comes in three file types: WARC files hold the raw HTTP responses (the HTML exactly as served), WAT files the metadata (headers, links), WET files plain text that Common Crawl extracted itself, menus and footers included. The June 2025 crawl, for scale: 2.38 billion pages, 82.73 TiB of compressed WARC, 15.62 TiB of WAT and 6.24 TiB of WET (Common Crawl, 2025-06-27); after FineWeb's whole pipeline it yields 152.4 billion tokens (FineWeb dataset card).

The rest comes from sources with more structure and more legal care: code (The Stack v2; Stack-Edu, its educational slice), papers and PDFs (arXiv, peS2o, PDFs turned into text by OCR models; FinePDFs holds about 3 trillion tokens from 475 million PDFs), encyclopedias and books (the Books3 collection inside The Pile was taken down over copyright). A licence on a dataset (ODC-By for FineWeb and Dolma, CC-BY-4.0 for DCLM-baseline, an NVIDIA data agreement for Nemotron-CC v2) covers the compilation; it does not license each web page inside it. The Common Pile v0.1 is the attempt at 8 TB of text whose every piece is openly licensed or public domain (arXiv 2506.05209).

Go deeper. Pretraining corpora: lineage, licences and what to use: Common Crawl from zero, the lineage tree, what each corpus kept of the running example's WARC file, how to read a corpus comparison, licences in four layers, and what to use by budget. Drawn there: its Fig. 1, four generations built on one crawl, and Fig. 2, total against unique tokens (Nemotron-CC Table 4).

Fig. 2 · Corpora grew a hundredfold, then split: keep the top slice, or keep more and fix it

web onlymixed sourcesPDFsgreen ring: kept only a top slice by a quality model
Click a dot

Each dot is a released corpus at its published size in tokens (log scale). Click one for what it changed.

Sizes grew from C4's 175 billion tokens to FineWeb's 18.5 trillion, mostly by processing every crawl rather than one. The newest generation splits two ways: keep only the top few percent by a quality model (FineWeb-Edu at 1.3 trillion, DCLM-baseline at 3.8 trillion out of a 240-trillion-token pool), or keep more and fix it (Nemotron-CC's 6.3 trillion, 1.9 trillion of them model rewrites); section 5 explains the split, section 11 says which to pick. Token counts are each source's own (C4 and Pile counts from the Dolma paper's list); sizes are of the released data, not of what a model trained on. Licences, status and lineage of every corpus: the Tool map.

Fig. 3 · One real page through every stage: the extractor decides whether it survives the rules

An advocacy campaign page from the running example (WARC file 00000; an organisation's page). measured: the extractors' output (trafilatura 1.11.0 with FineWeb's options, resiliparse with Dolma's settings), the lid.176 scores and datatrove's verdicts (the Pipeline lab); the two quality scores (the Quality lab's scorers); FineWeb and FineWeb-Edu membership from their rows for this file. Computed live in your browser: the rule values (Gopher thresholds as in datatrove v0.10.1; words split roughly as datatrove splits them, so a value can differ in the third decimal) and the 5-gram Jaccard and MinHash (112 hashes in 14 bands of 8) between the three extractions. The page spans five children's subjects, which is why it lives here.

3. The pipeline: from a raw page to a training document

A raw crawl is mostly not text you want: menus, cookie banners, spam, machine-generated pages, adult content, other languages, and the same page many times over. Five of the stages are simple enough to define in a line each; deduplication, quality models and decontamination get their own sections.

  • URL filtering. Drop pages whose domain or URL words are on a blocklist (adult and spam sites) before reading them: a lookup per URL.
  • Text extraction. Keep the article, drop the menus, footers and ads. WET keeps everything; extractors (trafilatura, resiliparse, jusText) guess which blocks are content. The most expensive cheap stage, because it parses every page.
  • Language identification. A small classifier (usually fastText's lid.176, a bag of character n-grams) gives a probability per language; FineWeb keeps pages whose English probability is at least 0.65.
  • Heuristic filters. Hand-written rules on simple statistics: too few or too many words, mean word length outside 3 to 10 characters, too few stop words (Gopher); lines must end in punctuation (C4); too many short or duplicated lines (FineWeb's three rules).
  • PII scrubbing. Replace personal data with placeholders. FineWeb masks email and public IP addresses with regular expressions and stops there; names, phone numbers and addresses need NER models such as Presidio and are rarely removed from web corpora.

Predict first: Fig. 3 runs the same campaign page as trafilatura, resiliparse and Common Crawl's WET text give it. Which version fails a heuristic rule? Let it play, then switch the text.

  1. Raw WARC record. The HTTP response exactly as the server sent it: 16,235 characters of HTML with 206 tags, of which the first part is shown. The article is in there somewhere; nothing has been decided yet.
  2. Extraction. trafilatura and resiliparse keep the 12 lines of the article and drop the other 24 (struck through): title bar, share button, archive links and the calendar. WET keeps every visible string, one block per line: the title bar, the Tweet button, the archive links and a whole calendar widget, 24 of its 36 lines.
  3. URL filter. The host is not on FineWeb's blocklist of adult domains, so the page goes on (datatrove's URLFilter removed 183 of the file's 20,463 pages).
  4. Language ID. fastText lid.176 gives English 0.9435 on trafilatura's text, 0.9361 on resiliparse's and 0.9313 on WET's, all above FineWeb's 0.65 threshold (measured in the Pipeline lab).
  5. Heuristic filters. trafilatura's and resiliparse's text pass every rule, the letters rule by a hair (0.801 against 0.8 with datatrove-style tokens), and datatrove's own run kept them too. WET's text fails "Words with a letter": the calendar's bare numbers and the punctuation tokens push the share of words containing a letter below 0.8. datatrove's own run gave the same verdict (removed by gopher_below_alpha_threshold). The article is fine; the extraction choice lost it.
  6. Quality model. The two published classifiers disagree. FineWeb-Edu's classifier scores it 2.765 (rounded to 3), so it is kept at threshold 3, and it is indeed in FineWeb-Edu (stored score 2.765625). DCLM's fastText gives it a probability of 0.00164 of looking like its reference set, below DCLM-baseline's cut-off of 0.0181: DCLM would drop it. A civic explainer reads as educational, not as instruction-style text. On WET the page never gets here, so no compute is spent scoring it.
  7. Deduplication. MinHash inside this WARC file found no near copy of the page, and FineWeb's dedup over the whole crawl kept it too (it is in FineWeb). The card compares this text with the other two extractions of the same page with the same machinery: a real near-duplicate pair.
  8. PII scrubbing. The email and IP-address patterns find nothing on this page, so the text is unchanged. The Pipeline lab shows what the patterns catch and miss on the whole file.
  9. Result. From trafilatura or resiliparse: kept, a training document in FineWeb and FineWeb-Edu. It would not be in DCLM-baseline: same page, three corpora, two verdicts. From WET: lost at the Gopher rules because of how the text was extracted. Across the four WARC files of the running example, the pipeline on WET text kept 3,526 pages; on trafilatura's text, 10,955.

The stage with the largest published effect is extraction (section 1's table), and the running example shows why in counts: across four WARC files (81,738 HTML pages), the same filter chain kept 10,955 pages extracted by trafilatura, 8,676 by resiliparse and 3,526 from WET text, and 9,312 of the 9,339 pages FineWeb kept from those files are among trafilatura's 10,955 (measured, Pipeline lab, before any dedup). A pipeline's library defaults also change the dataset: FineWeb's released data matches datatrove's duplicated-line default of 0.01, not the paper's 0.1, and the shipped example's language filter is not English-only.

The library defaults that silently change a FineWeb reproduction (measured detail)
The FineWeb paper drops documents whose fraction of characters in duplicated lines is at least 0.1, but the FineWebQualityFilter in datatrove v0.10.1 defaults to 0.01, ten times stricter, and adds a fourth check (newline-to-word ratio above 0.3) the paper does not describe (src/datatrove/pipeline/filters/fineweb_quality_filter.py, lines 14 to 20, read 2026-10-14). On the running example, the paper's 0.1 would keep 154 more documents than the default (2,846 against 2,692), and none of the 154 is in FineWeb, which holds 89% of the default's output: FineWeb's released data matches the code's 0.01, not the paper's 0.1 (measured, Pipeline lab; 6 of 8 hand-labelled drops at 0.01 were wrong drops). datatrove's C4QualityFilter swaps both of C4's numbers: at least 5 sentences per document and 3 words per line, where the T5 paper says 3 sentences and 5 words (c4_filters.py, lines 66 and 67). Its Trafilatura step runs with deduplicate=True, a process-wide cache that drops any paragraph of more than 100 characters from its fourth sighting in the same worker (on the running example it emptied 310 pages, and shuffling the page order changed 38 outputs); and the shipped FineWeb example calls LanguageFilter() without a language, so it keeps any language above 0.65 (122 non-English documents survive on our file). The mechanisms are on Extraction and filtering, section 8.
Go deeper. Extraction and filtering: from WARC to clean text: its hero draws this file's funnel to scale; sections 1 to 5 compare six extractors, section 6 language ID, sections 7 to 9 every rule with hand-labelled wrong drops and the library defaults, section 10 URL filters, section 11 toxicity and adult content. Drawn there: its Fig. 1, one real page through jusText; Fig. 2, six extractors through the same filters; Fig. 3, 6,971 documents through the rule gates. The Pipeline lab runs every stage on the running example with three extractors.

4. Deduplication: copies among billions of documents

The web repeats itself: syndicated news, mirrors, templates, boilerplate legal text, the same page crawled in many months. Duplicates waste compute, make a model memorise (reproduce training text verbatim) and leak test sets, since a benchmark question copied across many pages survives in some copy. The accuracy effect is smaller than people expect (section 1's table): deduplication is mostly about the token budget and memorisation. Four keys catch four kinds of copy:

  • Exact: a hash (xxhash, SHA-1) of each URL, document, paragraph or line; nearly free, but misses two copies of an article that differ in a date line.
  • Near-duplicate documents: MinHash estimates the Jaccard similarity of two documents' word n-gram sets from short signatures, and LSH bands the signatures so similar documents meet in a bucket without any pairwise comparison; the chance of becoming candidates is 1 − (1 − sr)b for b bands of r rows (FineWeb: 14 bands of 8 on 5-grams).
  • Repeated spans inside otherwise different pages (a disclaimer pasted into a million pages): a suffix array finds every repeated span in one pass, at a memory cost several times the text; a Bloom filter does exact membership in fixed memory and may say "seen" wrongly, never the reverse.
  • Paraphrases: semantic dedup embeds documents and drops near neighbours in a cluster (SemDeDup, D4); as a web filter in DCLM's comparison it scored 27.1 Core against 27.5 for no selection, so it is used more for synthetic and instruction data.

The cross-page point is scope. How much duplication you find depends on how far you look: MinHash inside the running example's one WARC file removes 75 of 2,692 documents (2.8%), yet 914 of the same 2,692 (34.0%) have a copy at Jaccard 0.8 or more under the same URL in at least one of four older crawls (measured, Dedup lab). Wider is not always better: FineWeb deduplicated all crawls against each other, and the 2013-48 crawl's survivors scored worse than what was removed, because pages that never reappear later are disproportionately ads and keyword lists; it deduplicated each crawl on its own instead (the bars and the arithmetic are Deduplication, section 1). Nemotron-CC deduplicated globally with a different pipeline and did well, so the finding is about an interaction, not a law. The framing several corpora adopted: dedup tells you the counts, mixing decides the setting. TxT360 deduplicates globally but keeps each document's duplicate count, so documents the web repeated can be upsampled on purpose (section 7).

Go deeper. Deduplication: exact, MinHash, suffix arrays, semantic: does dedup help (section 1), exact hashing (2), MinHash and LSH with a stepper and the Band designer (3), union-find clusters (4), SimHash (5), suffix arrays (6), Bloom filters (7), SemDeDup and D4 (8), dedup at scale (9). Drawn there: its Fig. 1, MinHash and LSH on two real pages; Fig. 2, union-find on the largest cluster; Fig. 3, a suffix array; Fig. 4, a Bloom filter. The Dedup lab runs every method once on the running example, with hand-labelled boundary pairs and a whole FineWeb shard joined.

5. Quality models: which documents are worth training on

After extraction, rules and dedup, most of what remains is grammatical, unique and still not worth much: product listings, forum chatter, thin SEO pages. Every modern corpus therefore runs a quality model, a score per document and a threshold that keeps the top slice. "Quality" means whatever the model was trained to prefer, so the useful question is always quality according to what. Three recipes are in use:

RecipeWhat decides "good"Example
Reference against crawla classifier separating a reference set you like from random crawl textDCLM: fastText on OpenHermes 2.5 plus r/ExplainLikeImFive answers against random pages; keeps the top 10%
An LLM grades a sample, a small model learns the gradesa rubric applied by a large modelFineWeb-Edu: Llama-3-70B-Instruct scored 460,000 pages for educational value; a head on a small encoder scored all 15 trillion tokens; threshold 3 keeps 1.3 trillion, threshold 2 keeps 5.4 trillion
Perplexity under a reference modelhow unsurprising the text is to a model of clean textCCNet: an n-gram model on Wikipedia, 29.0 Core against fastText's 30.2 in DCLM's comparison; with a small modern LM the lowest-perplexity pages are often templated or machine-written
Predict: run both published classifiers at their published cut-offs on the same documents. Of all the documents that at least one of them keeps, what share do both keep?

The central trade-off: per-token quality against unique tokens. FineWeb-Edu and DCLM remove about 90% of their input. That is fine for a run of a few hundred billion tokens and a problem for 15 trillion, where a small corpus must be repeated many times; and the unique count is smaller than the headline: after a global fuzzy dedup across crawls, FineWeb-Edu's 1.3 trillion tokens shrink to 0.2 trillion and DCLM-baseline's 3.8 trillion to 1.0 trillion (Nemotron-CC, Table 4). Nemotron-CC's answer: score with an ensemble of three classifiers, sort documents into quality levels ranked by short annealing runs (section 7), keep the high levels, and have an LLM rephrase the low ones instead of dropping them (section 8): in NVIDIA's 8B, 1-trillion-token runs its high-quality slice beat DCLM by 5.6 MMLU points, and the full 6.3 trillion tokens matched DCLM with four times as many unique real tokens (self-reported). Check any filter by reading a stratified sample of what it drops (the Quality lab labels one). This trade-off runs through sections 2, 5, 7, 8 and the calculator in section 11.

Go deeper. Quality classifiers and data selection: fastText scoring a page (section 1), which reference set (2, with DCLM's Table 4), what classifiers learned (3), LLM-graded classifiers and the Nemotron-CC ensemble (4), the threshold (5), perplexity filters (6), DSIR (7), gradient-based selection (8), whom filters disadvantage (10). Drawn there: its Fig. 1, one real page through fastText; Fig. 2, six reference sets on the same 2,617 documents; Fig. 3, the cut sliding up through 200 labelled pages. The Quality lab scores the same documents with every published classifier and trains a fastText on a laptop.

Fig. 4 · Each quality model encodes a target: FineWeb-Edu wins knowledge benchmarks, DCLM everyday language

FineWeb-EduDCLM-baseline

1.7B models trained on 350 billion tokens of each, from SmolLM2, Table 1 (arXiv 2502.02737), Hugging Face, the makers of FineWeb-Edu: self-reported for one side. FineWeb-Edu wins MMLU, ARC and OpenBookQA; DCLM wins HellaSwag, CommonsenseQA and PIQA. SmolLM2 settled on 60% FineWeb-Edu and 40% DCLM. FineWeb-Edu's own paper shows the other side of a target: its models have higher perplexity than FineWeb's on Twitter, Reddit and African-American English text, lower on Wikipedia and academic text (FineWeb paper, Section 4.2). A filter is also a choice of whose writing the model learns from.

6. Decontamination: keeping the test out of the training set

Benchmarks are on the web: questions are copied into forums, study sites and repositories, and end up in the crawl. A model that trained on a test item can score by remembering it. Decontamination removes training documents or spans that overlap the test sets you will report; detecting contamination in a model you did not train belongs to Topic: evaluation-and-llm-judges and Topic: benchmarks. Almost everyone uses n-gram overlap: GPT-3 used 13-grams; Llama 3 and Tulu 3 use 8-grams, and Tulu 3's rule is precise enough to reuse: a test item is matched by a training example if more than half of its tokens fall inside an 8-gram shared with it, and a whole training dataset was dropped or cleaned if it matched more than 2% of any evaluation's items (Tulu 3, Section 3.2). A Bloom filter seeded with every test n-gram (the Dolma toolkit's approach) does the lookup in one streaming pass. Paraphrases defeat n-grams, so data written by a teacher model that memorised a benchmark needs embedding similarity or an LLM check on top.

The cross-page finding: web text is rarely the leak, post-training data is. Across about 360,000 web documents (the running example and samples of FineWeb, FineWeb-Edu, DCLM and Nemotron-CC), 43 share a 13-gram with one of the 29,615 benchmark items, and reading every pair finds no test question. Tulu 3's RLVR prompts contain 70 MMLU test questions word for word, which is 0.50% of MMLU and so passes Tulu 3's own 2% rule, though it is 26% of that MMLU subject; and an n-gram rule short enough to catch everything flags ordinary text, since any shared 5-gram touches 64% to 84% of web documents (measured by Decontamination, PII and data governance and the Post-training data lab).

Go deeper. Decontamination, PII and data governance: what a "match" can be (section 1), the n-gram rules with a stepper (2), what the running example contains (3), paraphrases (4), asking the model instead (5), what to remove (6), personal data (7), opt-outs (8), provenance (9); its Contamination checker tab lists every flagged item. Drawn there: its Fig. 1, one real pair under four n-gram rules; Fig. 2, what each rule lifts out; Fig. 3, nearest prompts in embedding space. Toxicity and adult-content filtering of training text is Extraction and filtering, section 11.

7. Mixing and staging: how much of each kind, and when

A pretraining corpus is a mixture of domains (web text, code, maths, papers, books, encyclopedias, other languages, synthetic text), and the mixture weights say what fraction of the training tokens each supplies. At a fixed budget every point of code is a point not spent on web text, so the weights move abilities directly: Llama 3's final mix was roughly 50% general knowledge, 25% maths and reasoning, 17% code and 8% multilingual tokens (Llama 3, Section 3.1.2). Natural shares drown small, valuable domains; multilingual models sample domain i with probability proportional to ni1/T, a temperature above 1 flattening the mix.

Repetition is the number every other stage feeds. Upsampling a small domain means repeating it. At large scale, up to about 4 epochs is nearly as good as fresh data and gains continue to about 16, after which extra repeats are worth almost nothing (Muennighoff et al., arXiv 2305.16264); in the T5 experiments, repeating a truncated C4 1,024 times cost about 4 GLUE points and 4.6 SQuAD points (T5, Table 9). So a strict quality cut (section 5) is a mixing decision: it sets how many epochs the best data must take.

Choosing weights means training small proxies and transferring what they learn (DoReMi, RegMix, Data Mixing Laws: Data mixing, section 3). The sobering check is Aioli: no existing method consistently beat simple stratified sampling on average test perplexity (Aioli, third-party), and optimal weights shift with model size and budget, so a published mix is a starting point. On the running example's five domains a 0.8M-parameter DoReMi proxy (4,000 steps, one seed) moved weight from natural shares of 17% web, 16% Wikipedia, 31% code, 21% maths and 15% papers to 2.6% web, 10.7% Wikipedia, 37.9% code, 38.5% maths and 10.3% papers, while the proxy itself ended 0.35 to 0.39 nats worse than its reference on every domain; whether those weights beat the natural shares was not run (measured, Mixing lab). It is a lesson in the method's sensitivity at small scale, not a recommended mix.

Staging: the mix changes during training. Modern recipes use a long first stage on broad data and a short final stage, mid-training or annealing, on the best data (maths, code, instruction-like and question-answer text, often synthetic) while the learning rate decays to zero. OLMo 2 7B's 50 billion Dolmino tokens, about 1.2% of the run, took GSM8K from 24.1 to 67.5 (section 1's table). Annealing is also the cheapest way to evaluate a dataset: decay a half-trained model over a short run where the candidate is a fixed share (Llama 3 used 40 billion tokens with 30% candidate data) and compare with the same run without it; Nemotron-CC ranked its quality buckets this way.

Continued pretraining (CPT) is the same split made later: train a finished model further on a domain, and mix general data back in (replay) or it forgets. The CMR scaling law fits general and domain loss on a few short probe runs and reads off the critical mixture ratio, the largest domain-data share that keeps general loss within a tolerance: 29.8% for a 460M model up to 47.8% for 3.1B on finance (Gu et al., arXiv 2407.17467). It is the method Khalid has used at work to set this ratio; Data mixing, section 6, owns CPT (forgetting, re-warming, schedules, the CMR calculator) and section 7 is its checklist.

Predict: you have 20 billion tokens of high-quality maths and a 2-trillion-token run. Which uses it best?
Go deeper. Data mixing, curricula and continued-pretraining ratios: domains, weights and epochs (section 1), repetition (2), proxy methods with a measured DoReMi run and the mixing-law fitter (3), loaders hitting the weights (4), stages and mid-training (5), continued pretraining and its ratios (6), a CPT checklist (7); its Token-budget planner tab plans stages. Drawn there: its Fig. 1, The Pile's mixture (Table 1); Fig. 2, repeated data; Fig. 3, RegMix's released runs; Fig. 4, a loader hitting the weights; Fig. 6, the replay toy. The Mixing lab has a mixture calculator on the running example's five domains and OLMo 2's budget before and after its final stage.

8. Synthetic pretraining data: when the crawl runs out

The web is finite and the best of it is small: FineWeb-Edu's strict cut is 1.3 trillion tokens, and frontier runs train on 15 trillion or more. Past that point the choice is to repeat (section 7: cheap to about 4 times), keep lower-quality text, or manufacture tokens with a model. Two lineages: generate from seeds (Phi's textbooks; Cosmopedia's 30 million documents written by Mixtral-8x7B-Instruct, each prompt seeded with a real page or topic, because diversity, not generation, is the hard part) and rephrase real documents (WRAP, Nemotron-CC's 1.9 trillion rewritten tokens): the real page supplies the information and its diversity, the model fixes the form. Synthetic text is now a standard ingredient: 57.5% of Olmo 3's 100-billion-token mid-training mix is labelled synthetic (derived from the Dolma 3 Dolmino card).

Generating is not rephrasing, measured. On Cosmopedia documents and the web pages that seeded them, a generated document keeps almost none of its seed's wording (a median 99% of its 4-word sequences are new) and is 3.6 times as long, and the FineWeb-Edu classifier passes 79 of 200 generated documents against 9 of their 200 seeds (measured, Post-training data lab). Rephrasing changes the form far more than a classifier's verdict: Qwen3-4B's rewrites of 200 running-example pages in WRAP's four styles barely move the FineWeb-Edu pass rate except in the style that discards half the text (Synthetic data, section 3).

Model collapse: models trained recursively on their own output lose the tails of the distribution (Shumailov et al., Nature 2024), but the experiment assumes each generation replaces the previous data; with synthetic data added to the real data, collapse disappeared across model sizes and architectures (Gerstgrasser et al., arXiv 2404.01413: test loss 1.82 after the first iteration, 2.39 after four when replacing, 1.74 when accumulating). Real pipelines avoid collapse by construction (added, grounded, filtered); the live risks are a uniform style, the generator's biases, and crawls after 2023 that already hold model-written text nobody chose to add.

Synthetic data, Fig. 4 draws the difference: the word types a refit model can still produce, generation by generation, when each generation replaces the data and when it accumulates (its section 7 runs a categorical model and a bigram language model).

Go deeper. Synthetic data: rephrasing, textbooks and model collapse: why (section 1), generating from seeds and the instruction-data strategies (2), rephrasing with WRAP's four styles on real pages (3), maths and code with a checker (4), how much to mix (5), measuring a set (6), collapse (7), terms of use (8), a pipeline at scale (9); its Diversity meter tab measures any set. Drawn there: its Fig. 1, 1,000 documents sorted by their first three words; Fig. 2, one page through four rephrasing prompts; Fig. 4, collapse.

9. Post-training data: instructions, preferences, checkers and environments

After pretraining, a model trains on much smaller, structured data, and each stage of post-training (Alignment: SFT, RLHF, DPO Family, RLVR) consumes a different shape of example: a prompt plus a signal of what good looks like. The shape has grown richer over time:

StageOne example isBuilt now by
SFTa prompt and a good responsecurated prompts, responses distilled from a strong teacher, then filtered, deduplicated, decontaminated (Tulu 3: 939,344 prompts)
Preferencea prompt, a chosen and a rejected responseseveral models answer, an LLM judge rates them, best and a worse one form the pair, often on-policy
RLVRa prompt and a program that checks the answermaths with known answers, code with tests, checkable constraints; prompts the model always or never solves are removed
Environmentsa task, a sandbox and a testverified answer first, question after; environments rebuilt from recorded agent trajectories (Terminal-Universe: 37.3k)

Three lessons carry across the rows. Quality beats quantity for style and coverage needs volume: LIMA's 1,000 examples teach format (its "superficial alignment" hypothesis), Tulu 3 needed hundreds of thousands to cover maths, code, safety and instruction following. Judges have biases the data inherits: a judge that prefers longer answers produces pairs that teach length. And every row must be checked against your evaluations, because distilled and synthetic data launder benchmark items (section 6). On the samples, Ai2's clean-up filters remove 30 of 5,000 Tulu 3 SFT rows while an "obvious" English-only rule would remove 1,277, and a last-number checker accepts only 4,334 of 7,500 correct MATH solutions where math-verify accepts 7,485 (measured, Post-training data lab). Operational know-how is a third kind of data beside instructions and traces, such as the AREX skill library distilled from 1,000 machine-learning repositories (Repo-To-Skill).

Go deeper. Post-training data: SFT, preference, verifiable-reward and environments: who writes SFT answers and the instruction-data lineages (sections 1 and 2, with Self-Instruct's filter), reasoning traces (3), what a row becomes (4), preference pairs and a small judge measured in both orders (5), verifiable rewards and checkers (6), environments (7), one prompt pool across three stages (8), open recipes (9); its Dataset atlas tab compares the sets. Drawn there: its Fig. 1, OpenR1's sampled, checked and rescued answers (rejection sampling); Fig. 2, one Tulu 3 row rendered and masked; Fig. 3, one prompt, three rules, three pairs. Verifier failures during RL training are RL for LLMs's. The Post-training data lab browses rows of each kind.

10. Storage, loading and the tools that run it

A corpus has two lives in two formats. While curating, one record per document with its metadata (URL, crawl, language and quality scores, duplicate-cluster id) in compressed JSONL or Parquet (columnar: a reader loads only the columns it needs); FineWeb ships as Parquet, DCLM-baseline as zstd JSONL. For training, documents are tokenized once into flat arrays of token ids (2 bytes per token below a 65,536-entry vocabulary, 4 above: storing Qwen3's ids as 16-bit integers would corrupt 97% of FineWeb documents), memory-mapped or packed into streaming shards (MosaicML's MDS, WebDataset's tar files); the loader samples domains with the weights of section 7, packs documents into fixed-length windows, shuffles approximately, and must resume exactly after a crash. When the weights are applied at load time rather than baked into the files, changing the mix needs no reprocessing.

The tools. Three open frameworks run whole pipelines; teams with big-data infrastructure also write their own stages on Spark or Ray.

ToolWhat it isReach for it when
datatrove (Hugging Face)Python pipeline blocks (readers, extractors, filters, MinHash and exact dedup, tokenizers, writers) with local, Slurm and Ray executors; FineWeb's pipeline is its example script. v0.10.1 read for this pageyou want a FineWeb-style pipeline you can read and change; CPU clusters
Dolma toolkit (AI2)Rust-backed: taggers attach scores to every document, then a mixer filters and samples by those scores; a Rust Bloom filter for dedup and decontaminationyou want "tag once, filter many ways" and very fast tagging
NeMo Curator (NVIDIA)GPU-accelerated curation for text, image, video and audio; since release 26.02 every pipeline runs on Ray; fuzzy and semantic dedup, classifiers, PII and synthetic-data stagesyou have GPUs to spare and dedup or classifiers dominate your cost
Spark or Ray, customyour own stages on a general distributed engineyou already run that infrastructure or need logic no framework has

Versions, release and commit dates, licences, a "which tool for which job" picker and every extractor, language-ID model, dedup library and corpus with its status: the Tool map.

Go deeper. Storage and loading at scale: formats, shards, streaming: JSONL and compression (section 2), Parquet (3), shard formats (4), token files (5), packing and document masks (6), sharding to ranks (7), shuffling (8), streaming (9), loaders and prefetch (10), resuming mid-epoch (11), the cost model (12); its Format comparer tab compares every format. Drawn there: its Fig. 1, documents to tokens to a computed order; Fig. 3, rows against columns; Fig. 6, packing; Fig. 7, sharding to ranks and workers; Fig. 8, a shuffle buffer. Cluster storage (object stores, parallel file systems) is Storage and data movement's; columnar formats as a database idea, Topic: databases.

11. Choosing: what to do for the run in front of you

Predict first: how many Common Crawl crawls would a 2-trillion-token run need at FineWeb-Edu's strict cut, with no repetition? Then change the selection and the repeats in Fig. 5.

A small pretrain (up to about 2B parameters, a few hundred billion tokens)Use an existing corpus: FineWeb-Edu at threshold 3 (1.3 trillion tokens, so nothing repeats), or SmolLM2's 60/40 mix of FineWeb-Edu and DCLM-baseline if commonsense and everyday-language benchmarks matter. Add a few percent of code and maths, mostly in the last stage. Your remaining jobs are decontamination against your own evaluations and ablating any change on a small proxy.SmolLM2 trained its 135M and 360M models on 2 and 4 trillion tokens: small models are routinely trained far past the compute-optimal point.
A long run (trillions of tokens)The binding constraint is unique good tokens. Do not keep only the top 10%: bucket by quality, keep the middle tiers for bulk, rephrase the low ones, add PDFs and code, repeat the best data up to about 4 times, and save the best for a mid-training stage (Nemotron-CC, Dolma 3).
Continued pretraining on a domainMix general data back in; fit the replay ratio with a few short probe runs (CMR, section 7 and Data mixing, section 6) instead of folklore; re-fit when the base model or the budget changes.
Your own pipeline from raw crawlStart from datatrove's FineWeb example (WARC, trafilatura with deduplicate=False, language ID with the language set explicitly, Gopher, C4 and FineWeb rules, MinHash per crawl, PII), check its thresholds against the paper (and swap in resiliparse, which datatrove v0.10.1 does not ship as an extractor, if extraction cost dominates), then ablate one change at a time on small proxies (FineWeb used 1.71B models on 28B tokens).
Post-training dataStart from an open mixture (Tulu 3, SmolTalk) for coverage; add targeted data for your weak skills; generate preference pairs on-policy; keep only RLVR prompts your model sometimes solves; decontaminate every source.
A new languagePer-language pipelines and thresholds (FineWeb2 tunes them per language), language ID with a model that covers it well, and temperature sampling so small languages are not drowned.
Mistakes that only show across stages (nine)

Training on Common Crawl's WET text. It keeps menus and footers, documents are about twice as long as the real content, and models score worse (DCLM Table 3: 20.7 against 24.1 Core). Re-extract from WARC.

Copying a paper's thresholds, or trusting a library's defaults, without reading the code. FineWeb's paper says 0.1 for the duplicated-line rule and datatrove's default is 0.01; RefinedWeb's prose says 20 buckets of 450 hashes and only 450 bands of 20 reproduce its probabilities; datatrove's C4 filter swaps C4's two numbers. Set every parameter explicitly, log it, and read what a sample run drops.

Reading an ablation without its setup. Check the model size, tokens, benchmarks and seeds before believing a gap. Small proxies can only use benchmarks that already move at small scale (FineWeb chose its eight for low seed variance and early signal), so effects on harder skills go unmeasured; without a seed-to-seed spread, a one-point gap may be noise; a dataset's makers choose its benchmarks.

Assuming more dedup is always better. FineWeb's global dedup kept the worst copies of the oldest crawl; Muennighoff et al. saw no downstream gain from dedup in their setting. Deduplicate to save compute and avoid memorisation, then decide how much to repeat on purpose.

Treating a quality score as ground truth. Each classifier encodes its reference set's taste. Read a stratified sample of what it drops.

Decontaminating too little, too much or too late. 13-grams miss paraphrases; short n-grams remove ordinary sentences; decontaminate before training against every evaluation you will report, and record what you removed.

Comparing token counts from different tokenizers. C4 is 175B tokens in the Dolma paper's count; The Pile is 387B there and about 300B in GPT-NeoX tokens. Say whose tokens, or compare bytes.

Over-filtering for a long run, or under-filtering for a short one. A strict cut is right when you will not exhaust it and wrong when you would repeat it 10 times; the calculator shows when that happens.

Reading the CMR ratio as the share of general data. The critical mixture ratio is the largest share of domain data (29.8% to 47.8% in the paper's finance runs), not the general share. An old version of this page had it backwards.

Fig. 5 · A strict quality cut cannot fill a long run from the crawls that exist: size the pipeline before you choose

derived. Per-crawl yield: 166.4B FineWeb tokens on average (18,305.9B over the 110 distinct crawls in the FineWeb card's table, which lists CC-MAIN-2021-43 twice); selection shares: 1.3T and 5.4T out of FineWeb's 15T (paper and cards), so the defaults reproduce FineWeb-Edu's size by construction; compressed WARC per crawl: 82.73 TiB (June 2025 crawl, used for every crawl, which overstates older, smaller crawls); extractor throughput: DCLM Table 16, read as MB of compressed WARC per second per core; quality-model scoring: 6,000 H100 hours for FineWeb's 15T tokens (FineWeb-Edu), scaled linearly. Excludes language ID, rules, dedup, tokenization, storage and retries. It spans four children's numbers (extraction, quality, mixing, corpora), which is why it lives here.

12. The child pages

Nine child pages own the mechanisms, in pipeline order. Times are each page's header: its Reading core, plus its closed blocks.

Pretraining corpora: lineage, licences and what to useCommon Crawl from zero, counting tokens, the lineage tree, what each corpus kept of the running example's file, how to read a comparison, non-web domains, licences, what to use by budget. Reading: 31 min, plus 15.Map: sections 1 and 2; choosing, section 11
Extraction and filtering: from WARC to clean textSix extractors measured on the same pages, language ID, every heuristic rule with hand-labelled wrong drops, library defaults, URL and toxicity filters. Reading: 32 min, plus 25.Map: section 3
Deduplication: exact, MinHash, suffix arrays, semanticExact hashing, MinHash and LSH with a Band designer, union-find, SimHash, suffix arrays, Bloom filters, SemDeDup and D4, dedup at scale. Reading: 34 min, plus 23.Map: section 4
Quality classifiers and data selectionfastText step by step, reference sets, LLM-graded classifiers, thresholds, perplexity, DSIR, gradient-based selection, bias. Reading: 42 min, plus 13.Map: section 5
Decontamination, PII and data governancen-gram rules and paraphrases, model probes, what to remove, PII detectors compared, opt-outs and provenance. Reading: 38 min, plus 21.Map: sections 3 (PII) and 6
Data mixing, curricula and continued-pretraining ratiosWeights and epochs, repetition, proxy methods with a measured DoReMi run, loaders, stages and mid-training, continued pretraining and its replay ratios. Reading: 45 min, plus 23.Map: section 7
Synthetic data: rephrasing, textbooks and model collapseGenerating from seeds, rephrasing with WRAP's styles on real pages, maths and code with checkers, how much to mix, measuring a set, collapse, terms of use. Reading: 42 min, plus 13.Map: section 8
Post-training data: SFT, preference, verifiable-reward and environmentsWho writes SFT answers, instruction-data lineages, traces, preference pairs and judges, checkers, environments, quality control across stages. Reading: 32 min, plus 24.Map: section 9
Storage and loading at scale: formats, shards, streamingJSONL, Parquet and shard formats, token files, packing and document masks, sharding, shuffling, streaming, loaders, resuming. Reading: 34 min, plus 5.Map: section 10
Interview rehearsal: the design question that spans every stage

Design the data pipeline for a 2-trillion-token pretraining run. Clarify: model size and token budget (2T unique or 2T seen?), languages, domains (code, maths), licence constraints, and which evaluations matter. Sources: all available Common Crawl crawls (WARC), plus code, papers or PDFs, and maths. Stages, cheapest first, each writing what it drops: URL blocklist, extraction (resiliparse for throughput or trafilatura for precision), language ID, Gopher, C4 and FineWeb rules, MinHash dedup per crawl (5-grams, 14 bands of 8), then a quality model (a fastText classifier is cheap; an encoder distilled from LLM grades is better and costs GPU hours), decontamination against the evaluation suite, PII. The numbers: the calculator in section 11 shows that a strict top-10% cut cannot supply 2T unique tokens from the crawls that exist, so either relax the threshold, add rephrased lower tiers (Nemotron-CC), add other sources, or repeat the best data up to about 4 times. Mixing and staging: fit domain weights on small proxies, keep the best data for a mid-training stage, check candidate datasets by annealing runs. Infrastructure: stateless per-shard tasks (datatrove on Slurm or Ray), object storage, Parquet with metadata so filters can be re-run, tokenized shards for training, and a held-out slice for loss monitoring. Validation: ablate each stage on a 1 to 2B proxy, read stratified samples of what each stage drops, and track contamination.

How do you know whether a new dataset helps? Ablate: train identical small proxies with and without it at a fixed budget, on benchmarks with low seed variance; or anneal a partly trained model on a short run where the dataset is a fixed share (Llama 3: 30% of 40B tokens) and compare against the same run without it.

The per-stage questions (MinHash bands and rows, choosing a dedup method, building a quality classifier, decontamination failure modes, CPT ratios, synthetic-data risk, a good RLVR prompt set) are rehearsed on the child that owns each stage.