Topic 1 of 5 · 4 min read
What goes into pre-training data
Goal: Describe the main sources of a pre-training mix and explain how filtering shapes what a model knows well or poorly.
A model knows what its pre-training data contained, in the proportions the builders chose, after the filters they applied. The mix is the model's whole education, so its gaps become the model's gaps.
Check yourself · 1 of 3
Why do pre-training pipelines deduplicate the data?
Why it matters
When a model is strong in Python and weak in a small language, or confident about 2022 and vague about last month, the cause is usually the data. Knowing the mix lets you predict where to trust it and where to check.
The main ingredients
- Web crawls. Projects such as Common Crawl collect billions of pages. This is the largest source and the messiest: menus, ads, spam, duplicated pages and every kind of writing.
- Books and papers. Longer, edited text. It teaches long arguments and formal style.
- Code. Public repositories and documentation. Code also seems to help general reasoning, so even chat-focused models include a lot of it.
- Reference and forums. Encyclopedias, question sites, discussion threads.
- Synthetic data. Text written by an earlier model, often to cover maths, code or step-by-step explanations that the web has too little of.
What the cleaning does
Raw crawl data is not used as it is. Builders typically:
- Extract the main text from each page and drop the rest.
- Remove pages in unwanted languages, or low quality by rule or by a small classifier.
- Deduplicate, so one popular text does not appear thousands of times and get memorised.
- Filter out personal data, adult content or malware where they can.
- Choose weights: how often each source is sampled, so a small high-quality set can be seen several times.
The FineWeb write-up shows that each of these steps changes how well the resulting model scores. Filtering is a design choice, not a neutral clean-up.
Before and after
Weak: "The model was trained on the internet, so it knows everything about our city's tax rules."
Better: "The model was trained on a filtered web crawl. Local tax rules appear on few pages, change often, and may have been removed as low quality or duplicate. I will paste the current rule and ask it to work from that."
What goes wrong
- Assuming coverage is even. English, popular topics and well-documented tools are over-represented. Niche and local subjects are thin.
- Assuming the data is current. Every model has a cutoff, and newer material is often sparse in its first months online.
- Assuming the filter is fair. A quality classifier trained on one style of writing can quietly drop dialects and informal text.
- Ignoring synthetic loops. A model trained largely on model-written text can repeat the earlier model's habits and errors.
Companies seldom publish their exact mixes, so treat any specific claim about one model's data with care unless the vendor documents it.
Examples
Reading a mix as a table
A team compares two imaginary models. Model X is mostly filtered web text with a little code. Model Y has twice as much code and some synthetic maths. Without testing anything, the team guesses Y will do better on programming and arithmetic questions, and plans to check that guess with their own prompts.
A small code branch: dropping duplicates
Deduplication can be as simple as hashing normalised text. Real pipelines also catch near-duplicates, but the idea is the same.
seen = set()
unique = []
for doc in docs:
key = hash(doc.lower().strip())
if key not in seen:
seen.add(key)
unique.append(doc)
Key points
- A model's strengths and gaps follow the mix of its pre-training data, not a general wish to know everything.
- Web crawls are the largest source, and also the noisiest, so most of the work is cleaning them.
- Deduplication stops popular text from being repeated so often that the model memorises it.
- Filtering and source weighting are design choices that change what the model does well.
- Niche, local and very recent topics are thinly covered, so check them against a real source.
Common mistakes
- Treating "trained on the internet" as a promise that every topic is covered well.
- Believing the training data is current up to today.
- Thinking cleaning is only about removing bad words rather than shaping the whole mix.
- Repeating claims about a vendor's exact data mix that the vendor never published.
Check yourself · 2 of 3
A model answers questions about a tiny regional dialect poorly. What is the most likely cause?
Check yourself · 3 of 3
What is synthetic data in a pre-training mix?
Practice items, not counted towards your mastery.
Start here
- Andrej Karpathy: Deep Dive into LLMs like ChatGPT (opens in a new tab)VideoFree
A three-hour walk through pre-training data, tokens, base models and post-training, from a practitioner.
- FineWeb: decanting the web for the finest text data at scale (opens in a new tab)ArticleFree
A worked example of turning Common Crawl into training data: filtering, deduplication and what each step changes.
- Training Compute-Optimal Large Language Models (Chinchilla) (opens in a new tab)PaperFree
The study showing that, for a fixed compute budget, model size and training tokens should grow together.
More for this topic
- Common Crawl (opens in a new tab)ToolFree
The open web archive behind many pre-training sets; shows what raw crawl data looks like and how to opt out.