ExplainerData services

Preparing data for language model training: a buyer's map from source to delivery

Data preparation for LLM training, stage by stage: extraction, filters, deduplication, personal data, decontamination, mixing and what a buyer should receive.

Cover of the full report: Preparing data for language model training: a buyer's map from source to delivery
The research behind this article, with every source listed. 20 pages.

Key points

From the Summary of the full report

  1. Most of a web crawl is removed before training. RefinedWeb's stages removed nearly 90% of the documents originally in Common Crawl [2], and DCLM-Baseline kept 1.4% of its original pool's documents [6].
  2. Extraction changes results. Text pulled from raw crawl files with trafilatura trained a better model than Common Crawl's plain-text files in FineWeb's tests [1], and two extractors beat those files by at least 2.5 points on DCLM's core evaluation score [6].
  3. Thresholds are each pipeline's own settings. Language cut-offs in four published pipelines run from 0.5 in Dolma to 0.99 in C4 [1, 2, 4, 5], and DCLM's quality classifier kept the top 10% of documents [6].
  4. Filters have side effects. C4's bad-words blocklist removed African-American English text at 42%, against 6.2% for white-aligned English [9], and in one study quality filtering raised toxic generation along with task performance [11].
  5. Deduplication runs at the URL, document, paragraph or line level [5, 7]. Dolma removed 53.2% of documents as URL duplicates [5], and FineWeb's test models gained little from deduplicating across all 96 Common Crawl snapshots at once [1].

Data preparation for LLM training is the work between a raw source and the files a training run reads: extracting the text, identifying its language, filtering it, removing duplicates, handling personal data, keeping evaluation sets out and setting the mix. Most of a web crawl does not survive it. The stages behind RefinedWeb removed nearly 90% of the documents originally in Common Crawl [2], and DCLM-Baseline kept 1.4% of the documents in its original pool [6]. Every removal is a choice, so what a buyer needs from a supplier is the record of each one: the rule, the share removed, a sample of what went and the version it produced.

The examples below come from open corpora and open model families. Their shares describe English-heavy web crawls [1, 2, 5], and their thresholds were tested on small models [1, 11]. Each is one paper's setting, and none is a standard.

Data preparation for LLM training, stage by stage

Stage A published example What the buyer should receive
Source and rights record WARC files hold the raw crawl, WET files only its text [29] Sources, capture dates, terms and the raw copy
Text extraction FineWeb extracted WARC files with trafilatura [1] Extractor, version and sample pages
Language identification A language score of 0.65 or more [1, 2] Classifier, threshold, share removed
Rule-based quality filters Word count, word length and repetition rules [3] Each rule and the share it removed
Model-based quality filters DCLM kept the top 10% by classifier score [6] Classifier, reference data, cut-off, samples
Deduplication URL, document and paragraph stages [5] Level, settings, share removed per level
Personal data Three identifier types masked [5] Types handled, method, share affected
Decontamination 8-gram matching against evaluations [13] A report against the buyer's benchmarks
Mixing and repetition A mix of general, math, code and multilingual text [7] The mix and how it was chosen
Packaging The datasheet's preprocessing questions [12] Files, datasheet, removal log, version

Start from the source record

Preparation enforces a scope that exists first: which sources are in, what each record holds and how the delivered set is accepted. That document is the subject of how to specify a training dataset, and every filter below applies part of it.

Keep the raw copy. Common Crawl's WARC format is "the raw data from the crawl", while WET files "only contain extracted plaintext" [29]. Datasheets for Datasets asks whether the raw data was saved and whether the processing software is available [12]. Terms also move after capture. A 2024 audit of 14,000 web domains found that restrictions added in one year left about 5% or more of all C4 tokens fully restricted, and that terms of service now restrict 45% of C4 [17]. A capture date on each record shows which terms applied.

Text extraction from HTML and PDFs

The FineWeb authors found that WET files "retained too much boilerplate and menu text", and text extracted from WARC files with trafilatura trained a better model in their tests [1]. In DCLM, resiliparse and trafilatura scored at least 2.5 points above WET text, and resiliparse ran 8 times faster [6]. One open-weight model family's technical report removed markdown markers, which it found harmful for a model trained mostly on web data [7].

PDFs add layout and OCR. The olmOCR authors put the cost of their 2025 setup at 176 US dollars per million PDF pages, against over 6,240 dollars through a proprietary vision model's API [23]. Before relying on an extractor, test its accuracy on your own documents.

Language and quality filters

Language identification is often the first large cut. fastText's published models recognize 176 languages [22]. RefinedWeb and FineWeb kept documents with a language score of 0.65 or more [1, 2]. Dolma kept pages with an English score of 0.5 or more, which removed 61.7% of its data by bytes [5]. C4 required a probability of at least 0.99 from langdetect [4].

Rule-based filters are short and written down. The MassiveText rules remove a document with fewer than 50 or more than 100,000 words, a mean word length outside 3 to 10 characters or more than 90% of its lines starting with a bullet [3]. C4 kept only lines ending in terminal punctuation and discarded pages with fewer than 5 sentences [4].

Model-based filters keep what a classifier scores highly. DCLM trained a fastText classifier on instruction data and high-scoring forum posts, then kept the top 10% of documents [6]. For FineWeb-Edu, a 70-billion-parameter model scored 460,000 web pages for educational quality from 0 to 5, and a classifier trained on those scores kept pages at 3 or above [1]. The reference data defines quality, and the Dolma authors write that the term "quality filter" "does not appropriately describe the outcome of filtering a dataset" [5].

Filters have side effects. C4's blocklist of bad words removed African-American English and Hispanic-aligned English text at 42% and 32%, against 6.2% and 7.2% for white-aligned and other English [9]. In a study of 28 models of 1.5 billion parameters, quality filtering raised both toxic generation and downstream performance [11]. What goes in before these filters is covered in what data is used to train language models.

Deduplication at each level

Duplicates are removed at several levels. In Dolma, exact URL deduplication removed 53.2% of documents, exact document deduplication 14.9% of the rest and paragraph deduplication 18.7% of paragraphs [5]. FineWeb found near duplicates with MinHash over 5-grams, 112 hash functions in 14 buckets of 8, aimed at documents at least 75% similar [1].

One 61-word sentence appeared over 60,000 times in C4, and models trained on deduplicated data emitted memorized text ten times less often [10]. Run across all 96 snapshots at once, deduplication removed as much as 90% of the oldest snapshots' data, and FineWeb's test models showed little improvement, so the authors deduplicated each snapshot on its own [1]. The same matching problem in structured records is the subject of how entity resolution matches records.

Personal data and unsafe content

The published methods are narrow. Dolma masked email addresses, IP addresses and phone numbers in 0.02% of documents and removed the 0.001% with denser personal data, and removing instead of masking had no effect on model performance [5]. FineWeb anonymized email and public IP addresses for its public release [1]. The open-weight model family's report removed whole domains holding large amounts of personal data [7]. The EU's template for the public summary of a general-purpose model's training content asks for the measures taken to remove illegal content, "such as blacklists, keywords, and model-based classifiers" [26].

Keep evaluation data out

A 2021 study found 1.87% to 24.88% of the target texts of the generation benchmarks it examined in C4 [9]. The paper that introduced a 175-billion-parameter model treated a 13-gram match as overlap, and reported that a bug in its filter ignored some overlaps and that retraining was not feasible [8]. Tulu 3, an open post-training recipe, flagged a test item when more than 50% of its tokens had 8-gram matches with one training example [13]. DCLM asks every submission to disclose a decontamination report [6], and a buyer can ask for one against the benchmarks they use.

Mixing, repetition and size

After cleaning comes the mix. The open-weight model family's report set a final mix of roughly 50% general knowledge tokens, 25% math and reasoning, 17% code and 8% multilingual, chosen by training small models on candidate mixes [7]. DoReMi set domain weights with a 280-million-parameter proxy model and raised average few-shot accuracy by 6.5 points over The Pile's default weights [19]. Up to 4 epochs of repeated data gave negligible changes to loss compared with unique data [20]. A compute-optimal study found that model size and training tokens should be scaled equally, and trained a 70-billion-parameter model on 1.4 trillion tokens [15].

Published fine-tuning sets are far smaller. LIMA tuned a 65-billion-parameter model on 1,000 curated prompts and responses [14]. The open-weight report scored its post-training data for quality and difficulty and removed semantic near duplicates [7]. Record formats for instruction, chat and preference data are a separate subject.

What the delivery should include

JSON Lines stores one valid JSON value per line [32], and Parquet is a column-oriented format "designed for efficient data storage and retrieval" [31]. A buyer can ask for documentation that answers the datasheet's preprocessing questions [12], in a dataset card stating license, language and size [34] or in Croissant metadata [21], and for a removal log for each stage, the decontamination report and the version.

Disclosure rules ask about this processing. California's AB 2013 asks a developer to post whether there was "any cleaning, processing, or other modification to the datasets" and its purpose [27]. On 4 March 2026 a federal court denied a developer's request for a preliminary injunction against the law, finding that it had not identified a cleaning approach distinct from its competitors' in a way that warranted trade secret protection [28]. Article 10 of the EU AI Act lists "relevant data-preparation processing operations, such as annotation, labelling, cleaning" among data governance practices for "high-risk AI systems" [25]. This summary of the texts is research, never legal advice.

In a Rillor data project, the records are labeled, cleaned and de-identified and their quality checked, and you receive the dataset and its datasheet in the agreed format and channel.

Read the full report

The full report sets out removal shares by pipeline, the filter rules and thresholds, deduplication and decontamination settings, the disclosure texts, a buyer's checklist for each stage and all 35 sources.

The full report

Preparing data for language model training: a buyer's map from source to delivery

The research behind this article, with every source listed. 20 pages.

  1. Summary
  2. Background
  3. Method
  4. Findings
  5. Implications
  6. Limits of this analysis
  7. Sources

Sources

  1. The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale. Guilherme Penedo, Hynek Kydlíček, Loubna Ben Allal and others, arXiv:2406.17557, version 2, 31 October 2024, viewed 8 November 2026. https://arxiv.org/abs/2406.17557
  2. The RefinedWeb Dataset for Falcon LLM: Outperforming Curated Corpora with Web Data, and Web Data Only. Guilherme Penedo, Quentin Malartic, Daniel Hesslow and others, arXiv:2306.01116, 1 June 2023, viewed 8 November 2026. https://arxiv.org/abs/2306.01116
  3. Scaling Language Models: Methods, Analysis & Insights from Training Gopher. Jack W. Rae, Sebastian Borgeaud, Trevor Cai and others, arXiv:2112.11446, version 2, 21 January 2022, viewed 8 November 2026. https://arxiv.org/abs/2112.11446
  4. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. Colin Raffel, Noam Shazeer, Adam Roberts and others, Journal of Machine Learning Research 21 (2020), viewed 8 November 2026. https://jmlr.org/papers/v21/20-074.html
  5. Dolma: an Open Corpus of Three Trillion Tokens for Language Model Pretraining Research. Luca Soldaini, Rodney Kinney, Akshita Bhagia and others, arXiv:2402.00159, version 2, 6 June 2024, viewed 8 November 2026. https://arxiv.org/abs/2402.00159
  6. DataComp-LM: In search of the next generation of training sets for language models. Jeffrey Li, Alex Fang, Georgios Smyrnis and others, arXiv:2406.11794, version 4, 21 April 2025, viewed 8 November 2026. https://arxiv.org/abs/2406.11794
  7. The Llama 3 Herd of Models. Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri and others, arXiv:2407.21783, version 3, 23 November 2024, viewed 8 November 2026. https://arxiv.org/abs/2407.21783
  8. Language Models are Few-Shot Learners. Tom B. Brown, Benjamin Mann, Nick Ryder and others, arXiv:2005.14165, version 4, 22 July 2020, viewed 8 November 2026. https://arxiv.org/abs/2005.14165
  9. Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpus. Jesse Dodge, Maarten Sap, Ana Marasović and others, EMNLP 2021, Association for Computational Linguistics, November 2021, viewed 8 November 2026. https://aclanthology.org/2021.emnlp-main.98/
  10. Deduplicating Training Data Makes Language Models Better. Katherine Lee, Daphne Ippolito, Andrew Nystrom and others, ACL 2022, Association for Computational Linguistics, May 2022, viewed 8 November 2026. https://aclanthology.org/2022.acl-long.577/
  11. A Pretrainer's Guide to Training Data: Measuring the Effects of Data Age, Domain Coverage, Quality, & Toxicity. Shayne Longpre, Gregory Yauney, Emily Reif and others, arXiv:2305.13169, version 2, 13 November 2023, viewed 8 November 2026. https://arxiv.org/abs/2305.13169
  12. Datasheets for Datasets. Timnit Gebru, Jamie Morgenstern, Briana Vecchione and others, arXiv:1803.09010, version 8, 1 December 2021, viewed 8 November 2026. https://arxiv.org/abs/1803.09010
  13. Tulu 3: Pushing Frontiers in Open Language Model Post-Training. Nathan Lambert, Jacob Morrison, Valentina Pyatkin and others, arXiv:2411.15124, version 5, 14 April 2025, viewed 8 November 2026. https://arxiv.org/abs/2411.15124
  14. LIMA: Less Is More for Alignment. Chunting Zhou, Pengfei Liu, Puxin Xu and others, arXiv:2305.11206, 18 May 2023, viewed 8 November 2026. https://arxiv.org/abs/2305.11206
  15. Training Compute-Optimal Large Language Models. Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch and others, arXiv:2203.15556, 29 March 2022, viewed 8 November 2026. https://arxiv.org/abs/2203.15556
  16. Consent in Crisis: The Rapid Decline of the AI Data Commons. Shayne Longpre, Robert Mahari, Ariel Lee and others, arXiv:2407.14933, version 2, 24 July 2024, viewed 8 November 2026. https://arxiv.org/abs/2407.14933
  17. DoReMi: Optimizing Data Mixtures Speeds Up Language Model Pretraining. Sang Michael Xie, Hieu Pham, Xuanyi Dong and others, arXiv:2305.10429, version 4, 21 November 2023, viewed 8 November 2026. https://arxiv.org/abs/2305.10429
  18. Scaling Data-Constrained Language Models. Niklas Muennighoff, Alexander M. Rush, Boaz Barak and others, arXiv:2305.16264, version 5, 28 June 2025, viewed 8 November 2026. https://arxiv.org/abs/2305.16264
  19. Croissant Format Specification, Version 1.0. MLCommons, 1 March 2024, viewed 8 November 2026. https://docs.mlcommons.org/croissant/docs/croissant-spec.html
  20. Language identification. fastText documentation, undated, viewed 8 November 2026. https://fasttext.cc/docs/en/language-identification.html
  21. olmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models. Jake Poznanski, Aman Rangapur, Jon Borchardt and others, arXiv:2502.18443, version 3, 2 July 2025, viewed 8 November 2026. https://arxiv.org/abs/2502.18443
  22. Regulation (EU) 2024/1689 (Artificial Intelligence Act). European Parliament and Council of the European Union, Official Journal of the European Union, 12 July 2024, viewed 8 November 2026. https://eur-lex.europa.eu/eli/reg/2024/1689/oj
  23. Explanatory Notice and Template for the Public Summary of Training Content for general-purpose AI models. European Commission, AI Office, 24 July 2025, viewed 8 November 2026. https://digital-strategy.ec.europa.eu/en/library/explanatory-notice-and-template-public-summary-training-content-general-purpose-ai-models
  24. AB 2013, Generative artificial intelligence: training data transparency (Chapter 817, Statutes of 2024). California Legislature, chaptered text as published by CalMatters Digital Democracy, 28 September 2024, viewed 8 November 2026. https://calmatters.digitaldemocracy.org/bills/ca_202320240ab2013
  25. X.AI LLC v. Rob Bonta, Case No. CV 25-12295 JGB (SSCx), Civil Minutes, Order Denying Preliminary Injunction. United States District Court, Central District of California, 4 March 2026, filed copy hosted by Ars Technica, viewed 8 November 2026. https://cdn.arstechnica.net/wp-content/uploads/2026/03/xAI-v-Bonta-Order-Denying-Preliminary-Injunction-3-4-26.pdf
  26. Get Started. Common Crawl, undated, viewed 8 November 2026. https://commoncrawl.org/get-started
  27. Overview. Apache Parquet documentation, The Apache Software Foundation, undated, viewed 8 November 2026. https://parquet.apache.org/docs/overview/
  28. JSON Lines. jsonlines.org, undated, viewed 8 November 2026. https://jsonlines.org/
  29. Dataset Cards. Hugging Face Hub documentation, undated, viewed 8 November 2026. https://huggingface.co/docs/hub/datasets-cards

Tell us what your data must cover.

Send the question the data should answer, the sources you know of, the coverage you need and how often it should update.

Outline a dataset