AI State of the Art
Fundamentals/LLM: Understanding Large Language Models/36 min
Section 51

Pre-training Datasets: Common Crawl, The Pile, RedPajama, FineWeb

Listen as a podcast →

The Problem: Where Do You Find Enough Text to Learn?

To pre-train a modern LLM (Large Language Model), you need amounts of text that defy comprehension. Llama 3 (2024) was trained on 15 trillion tokens, which is about 11.5 trillion words, divide by 1.3, the usual token-to-word ratio in English. And the trend continues: in 2025 Alibaba announced roughly 36 trillion tokens for its Qwen3 family.

To get a sense of scale, do the division. At 1,000 words per minute, around the clock: 11.5 trillion words is 11.5 billion minutes, or 192 million hours, or 8 million days, or about 21,000 years of unbroken reading.

Where does all this text come from? And more importantly, how do you make sure it's any good?

Common Crawl: A Photocopy of the Internet

Common Crawl is a nonprofit that has been "photographing" the web since 2008. It sends bots to walk the pages, downloads the content, and makes it freely available. That harvesting operation is called a crawl: each month the organization publishes a new one, on the order of 2 to 3 billion pages and a few hundred terabytes once uncompressed, the exact figures vary month to month and are published on their site.

It is the main source behind nearly every large training dataset. But here's the problem: the raw internet is a disaster.

The raw internet is mostly garbage

Of those billions of pages, the vast majority is spam produced for SEO (Search Engine Optimization), duplicates (the same article republished five hundred times), badly converted HTML (HyperText Markup Language, the markup language of web pages), ads, pornographic content, and hostile forums.

Published filtering pipelines typically retain something on the order of 10 to 20% of the original crawl. The rest is discarded.

The Cleaning Pipeline

Turning Common Crawl into usable data is a colossal engineering effort:

  1. Text extraction: strip out HTML, JavaScript and navigation menus, keep only readable text
  2. Language detection: sort by language, so as not to mix French, Arabic and Japanese in one document
  3. Deduplication: a technique called MinHash (a probabilistic hashing method that compares short fingerprints rather than whole documents) spots near-identical copies and keeps one
  4. Quality filtering: simple rules (share of dictionary words, presence of punctuation, sentence length) remove the noise
  5. Perplexity filtering: a small language model scores each text by its average surprise (its perplexity, defined in entropy); an incoherent text surprises it a great deal, scores badly, and is thrown out
Horizontal flow diagram of the Nemotron-CC data curation pipeline. From left to right: CC data, text extraction, language identification (English branch), classifier-based filtering, then a split into three streams by quality. Low quality data goes through heuristic filtering and Wikipedia-style synthetic rephrasing; medium quality data goes to data blending; high quality data goes through synthetic data generation pipelines. All three streams converge on a deduplication step, then the final dataset. Three educational quality classifiers feed the filtering step.
A real pipeline, the one behind NVIDIA's Nemotron-CC dataset. You can follow the steps described above in order: text extraction, language identification, scoring by a quality classifier, then deduplication before the final dataset is produced. Note the sorting into three quality tiers, each handled differently rather than simply discarded.Source : NVIDIA Developer Blog, Building Nemotron-CC with NeMo Curator

The Major Datasets: A History of the Field

C4, The First Major Cleanup (Google, 2019)

Google created C4 (Colossal Clean Crawled Corpus) to train T5. The team applied aggressive filtering to Common Crawl and obtained about 750 GB of clean English text. Revolutionary at the time, considered fairly crude today.

The Pile, Diversity as Strategy (EleutherAI, 2020)

The EleutherAI collective understood something crucial: training only on web text produces a model that excels on web text... and nothing else. The Pile (800 GB in total, as the paper's title says) mixes 22 different sources:

  • Filtered Common Crawl (the web)
  • PubMed Central (biomedical articles)
  • ArXiv (scientific research)
  • GitHub (source code)
  • FreeLaw (American legal texts)
  • StackExchange (technical Q&A)
  • Wikipedia + Project Gutenberg (encyclopedia and classic books)
The Pile: An 800GB Dataset of Diverse Text for Language Modeling (Gao et al., 2020)
Treemap titled Composition of the Pile by Category. Each rectangle is one source and its area is proportional to its volume. Five colour categories: Academic in blue (PubMed Central, ArXiv, FreeLaw, USPTO, PMA, Phil, NIH), Internet in green (Pile-CC, OpenWebText2, StackExchange, Wikipedia), Prose in orange (Bibliotik, PG-19, BC2), Dialogue in yellow (Subtitles, IRC, EP, HN, YT) and Misc in grey (Github, DM Math). Pile-CC and PubMed Central are the two largest blocks.
The composition of The Pile, each rectangle sized in proportion to its source. Filtered web text (Pile-CC, in green) is far from dominant: the biomedical papers of PubMed Central plus ArXiv alone take up a comparable area. This deliberate diversity is what sets The Pile apart from purely web-based corpora like C4.Source : The Pile paper (Gao et al., 2020), figure 1, via ar5iv
Why Diversity Is Crucial

A model trained only on web text knows how to talk like the web. It will be poor at code, scientific reasoning, and legal logic. Mixing very different sources produces a more versatile model that's often better across the board. The Pile validated this intuition and the entire industry followed suit.

RedPajama, Reproducing LLaMA in Open Source (2023)

When Meta released LLaMA without publishing its training data, the community set out to reconstruct the corpus. RedPajama approximately reproduces LLaMA's recipe, for a total of 1.21 trillion tokens. The proportions below are simply each volume divided by that total:

SourceVolumeProportion
Filtered Common Crawl878 billion tokens73%
C4175 billion14%
GitHub59 billion5%
ArXiv28 billion2%
Books26 billion2%
Wikipedia24 billion2%
StackExchange20 billion2%

FineWeb and FineWeb-Edu, Quality Graded by an LLM (Hugging Face, 2024)

FineWeb marked a turning point in open web-data filtering. Hugging Face applied a very careful cleaning pipeline to 96 Common Crawl snapshots, yielding 15 trillion tokens of English text, and backed every choice with an experiment.

The key innovation: FineWeb-Edu. The trick has three steps. First, a large model (Llama-3-70B-Instruct) is asked to grade the educational value of about 460,000 randomly sampled pages from 0 to 5, with instructions to think at middle-school level rather than research-paper level. Next, a small and much cheaper classifier is trained to imitate those grades. Finally, that small classifier runs over FineWeb's billions of documents. Keeping only pages scored 3 or above leaves 1.3 trillion tokens, under 9% of the full corpus (with a threshold of 2, 5.4 trillion tokens remain).

This became the standard recipe of 2025: have a big LLM annotate a sample, then distil its judgement into a small model that scales. The data quality page covers what this measures, and what it does not.

Quality Beats Quantity

Hugging Face reports that on knowledge and reasoning benchmarks, a model trained on FineWeb-Edu reaches the same level as a model trained on roughly ten times more poorly filtered tokens. In other words, filtering is worth a factor of ten on data volume.

One caveat: that comparison is made on exam-style benchmarks, precisely what the "educational" classifier optimizes for. The gain is real, but it does not automatically carry over to every use.

The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale (Penedo et al., 2024)
Line chart. Horizontal axis: training tokens in billions, from 0 to 350. Vertical axis: aggregate benchmark score, from 0.40 to 0.50. Seven curves, one per dataset. The FineWeb curve, in black, is the highest across almost the whole range. Next come C4 and RefinedWeb, then Dolma, then SlimPajama and RedPajama2, and finally The Pile which stays the lowest curve throughout.
The experiment that established FineWeb: train the same small model on each dataset, with an identical token budget, and compare. At 350 billion tokens the FineWeb curve (black) leads, while The Pile (purple) sits well below. At equal size, what the corpus contains directly changes the quality of the resulting model.Source : Hugging Face, FineWeb dataset card

DCLM, A Competition Between Recipes (2024)

Comparing two corpora is hard: if you change the data, the model size and the training length all at once, you no longer know what explains the difference. DCLM (DataComp for Language Models, from a consortium of universities and labs) turned the question into a competition: everyone starts from the same pool of 240 trillion tokens extracted from Common Crawl, trains models with the same recipe, and only the data selection method changes. Scores are measured on 53 tasks.

The team's conclusion: model-based filtering is the key. Their best filter is a fastText classifier (a very lightweight text classification model) trained to recognise text that looks like clear answers to questions (high-quality instruction examples and well-rated answers from a forum where people ask to have things "explained like I'm five"). Keeping only the top 10% of documents gives DCLM-Baseline, about 3.8 trillion tokens. A 7-billion-parameter model trained on 2.6 trillion of those tokens reaches 64% on MMLU, on par with Llama 3 8B (66%) with about 6.6 times less compute.

DataComp-LM: In search of the next generation of training sets for language models (Li et al., 2024)

Nemotron-CC, Rewrite Rather Than Discard (NVIDIA, 2024)

FineWeb-Edu and DCLM have a downside: by throwing away about 90% of the web, they leave too little unique text for very long training runs (15 trillion tokens and more) without rereading the same pages many times. NVIDIA flipped the problem with Nemotron-CC, whose pipeline is drawn above:

  • several quality classifiers are combined, and rule-based filters are relaxed so less good text is lost;
  • low-quality documents are not discarded: an LLM rewrites them in a clear, encyclopedia-like style;
  • high-quality documents serve as raw material to generate variants (question-answer pairs, summaries, extraction of key knowledge).

The result: 6.3 trillion tokens, four times more unique real tokens than DCLM at equal MMLU score. An 8-billion-parameter model trained on 15 trillion tokens, 7.2 trillion of them from Nemotron-CC, beats Llama 3.1 8B by 5 points on MMLU. Rewriting web data became common practice in 2025; synthetic data for training discusses its reach and its limits.

Nemotron-CC: Transforming Common Crawl into a Refined Long-Horizon Pretraining Dataset (Su et al., 2024)

FineWeb2, Beyond English (2025)

Nearly all the corpora above are English. And cleaning rules do not transfer as they are: a "share of dictionary words" threshold tuned for English makes no sense for Thai or Swahili, which split words differently or have very little text available. FineWeb2 offers a pipeline that adapts automatically to each language, validated on nine very different languages, then applied to almost 100 Common Crawl snapshots: over 1,000 languages, 20 terabytes, 5 billion documents. For rare languages, the team also proposes rebalancing the corpus by taking into account both the number of duplicates and quality.

FineWeb2: One Pipeline to Scale Them All -- Adapting Pre-Training Data Processing to Every Language (Penedo et al., 2025)

Common Corpus and Common Pile: Training Only on Open Data (2025)

Another family of corpora answers a different question: can you train a decent model without copyrighted text used without permission?

  • Common Corpus (Pleias, 2025) gathers about 2 trillion tokens of public-domain or openly licensed text, in many languages, with a lot of code and source-by-source documented provenance.
  • Common Pile v0.1 (EleutherAI and partners, 2025) brings together 8 terabytes of openly licensed text from 30 sources (research papers, code, public-domain books, transcripts, educational resources). Two 7-billion-parameter models, Comma v0.1, trained on 1 and 2 trillion tokens of it, compete with Llama 1 and Llama 2 7B trained on comparable budgets.

These models still trail the best models of the day, but the gap has narrowed a lot. The topic is covered in depth on training only on open or licensed data.

Common Corpus: The Largest Collection of Ethical Data for LLM Pre-Training (Langlais et al., 2025) The Common Pile v0.1: An 8TB Dataset of Public Domain and Openly Licensed Text (Kandpal et al., 2025)

The New Mine: PDFs and Scanned Books

HTML web pages have been harvested to the bone. Much of the best text sleeps elsewhere: in PDFs (papers, reports, manuals, administrative documents) and in scanned books. The problem is technical: a PDF is a layout, not a text. Columns, tables, formulas, footnotes and poor-quality scans make extraction hard, and older tools produce chopped-up text.

The 2025 answer is OCR (optical character recognition) performed by vision-language models, which "read" the page the way a person does:

  • olmOCR (Ai2, 2025), a 7-billion-parameter model, converts a million pages for about 176 dollars, against more than 6,000 dollars through a large commercial model;
  • FinePDFs (Hugging Face, September 2025) extracts about 3 trillion tokens from 475 million PDF documents, in over a thousand languages;
  • Institutional Books 1.0 (Harvard, 2025) releases the text of 983,004 public-domain volumes scanned by Harvard Library as part of Google Books, 242 billion tokens in over 250 languages.
olmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models (Poznanski et al., 2025) Institutional Books 1.0: A 242B token dataset from Harvard Library's collections, refined for accuracy and usability (Cargnelutti et al., 2025)

The Mix: How to Blend Sources

Having quality data isn't enough. You need to decide in what proportions to mix the sources. This data mix has a large effect on what the model will be able to do.

The proportions below are the ranges found in published corpora, such as RedPajama above; they are not demonstrated optima.

The Typical Recipe

  • Web (filtered Common Crawl): 60-80%, the base, diverse and abundant
  • Code (GitHub): 5-15%, improves logical reasoning, even for non-code tasks
  • Science (ArXiv, PubMed): 3-8%, strengthens formal reasoning
  • Books: 3-5%, long, well-structured texts that help with long-range coherence
  • Wikipedia: 2-5%, dense and reliable factual knowledge

Since 2024 a new line has appeared in some recipes: rewritten or synthetic text. The extreme case is Microsoft's Phi-4 (late 2024), where about 40% of training tokens are synthetic and 15% are rewrites of web pages, with raw filtered web down to 15%. That is not the norm, but the share of such data is rising in most recent models.

Upsampling: Seeing Good Texts Multiple Times

The best sources are often the smallest. Wikipedia holds 24 billion tokens, tiny next to Common Crawl's 878 billion: at natural proportions the model would barely see it. The fix is to have it read three to five times during training. That is upsampling.

Repetition Has Its Limits, and They Have Been Measured

How far can you reread the same text? Muennighoff et al. measured the answer precisely: up to 4 epochs on repeated data, the loss is nearly identical to what you would get with fresh data, repetition is essentially free. Beyond that the benefit shrinks, and eventually falls to zero: adding compute on already-seen data buys nothing.

This is an important result, because it puts a number on the data wall: you cannot make up for a small corpus by rereading it indefinitely.

Scaling Data-Constrained Language Models (Muennighoff et al., 2023)

Ethical Concerns: The Industry's Great Discomfort

Many datasets contain books, news articles, and licensed code. The dataset Books3 (which included pirated books) was removed from The Pile after complaints from rights holders. Since then the first court rulings have come in, and they do not all say the same thing:

  • in the United States, in June 2025, two federal judges held that training itself was fair use in the cases before them (Anthropic and Meta, sued by book authors). But in the Anthropic case the judge distinguished books the company had bought and scanned, which he accepted, from the millions of books downloaded from pirate libraries, which he did not. Anthropic reached a 1.5 billion dollar settlement, given final approval in July 2026;
  • in Germany, the Munich Regional Court ruled in November 2025, in the case brought by GEMA (the music rights society) against OpenAI, that the memorization of song lyrics inside a model amounted to reproducing the works; OpenAI has appealed.

So the landscape is still shifting and depends on the country: see what the courts have said about training. Meanwhile, website publishers have technical means to refuse collection (robots.txt, rights-reservation protocols), described in opt-out and access protocols.

Bias

The web reflects society's biases, and sometimes amplifies them. Models trained on this data reproduce stereotypes related to gender, ethnicity, and class. Filtering mitigates some problems, but no cleaning pipeline fundamentally solves the issue: biased data produces biased models.

Personal Data

Names, addresses, phone numbers, they're everywhere on the web. Filtering efforts try to remove them, but it's an impossible task to perform perfectly on trillions of tokens.

The Data Wall

Researchers talk about a data wall: high-quality human text is a finite resource, and we are approaching it. The reference estimate comes from the Epoch AI institute (Villalobos et al.). In its version updated in 2024, it puts the "effective" stock of public human-written text (weighted for quality and allowing a few repeated passes) at on the order of 300 trillion tokens, with wide uncertainty (from 100 trillion to 1 quadrillion). If trends continue, training corpora would reach the size of that stock between 2026 and 2032, and earlier if smaller models are trained on far more data than the compute-optimal amount (with 5x overtraining, as early as 2027).

Will we run out of data? Limits of LLM scaling based on human-generated data (Villalobos et al., 2022, updated 2024)

For scale: at 15 to 36 trillion tokens, the largest training runs published in 2025 already use a non-trivial fraction of that stock. We are inside the forecast window. The wall is not a cliff: it is a slope that makes every additional quality token more expensive. The industry's responses, all visible on this page, combine:

  • reread the best data (up to four nearly free passes, as seen above);
  • rewrite average web text instead of discarding it (Nemotron-CC);
  • dig out the text buried in PDFs and scanned books;
  • buy licensed data (see the training data market);
  • manufacture synthetic data, text produced by existing LLMs to train the next generation, like the synthetic textbooks of Hugging Face's Cosmopedia project.

That last lever carries a documented risk, model collapse: if models train generation after generation on their own output alone, replacing the human data, diversity shrinks and errors compound, like photocopies of photocopies. Work from 2024 showed the phenomenon does not occur when the human data is kept and synthetic data is added alongside; the known remedy is therefore never to remove real data from the mix. Details are on synthetic data for training.

Check your understanding0 / 6

1. What share of a Common Crawl snapshot typically survives filtering?

2. What lesson did The Pile establish in 2020?

3. What does Hugging Face report about FineWeb-Edu?

4. Can a too-small corpus be compensated by rereading it indefinitely?

5. What does Nemotron-CC (NVIDIA) do with web documents judged to be low quality?

6. What do Common Corpus and Common Pile, released in 2025, show?