This page assumes nothing. We build every letter, slash, and squiggle the parent note (Pretraining Data Curation and Cleaning) throws at you, in an order where each idea leans on the one before it.
Imagine a giant bag of scraps of text — web pages, comment threads, menus, articles. Curation is the act of sorting this bag: throw out the junk, throw out the copies, keep the good stuff. Two questions repeat everywhere:
How junky is this one scrap? → answered with ratios.
Are these two scraps secretly the same? → answered with sets and probabilities.
Hold that bag in mind; every symbol below is a tool for one of those two questions. Figure 1 draws this bag and the two questions it splits into.
Figure 1 — The corpus as a bag of coloured scraps. The magenta arrow leads to Q1 ("how junky?", answered by ratios); the violet arrow leads to Q2 ("are two the same?", answered by sets and probability).
Why does the topic need counts? Because the only cheap thing you can do to a trillion tokens is tally features of them. You never "understand" a page; you count its ingredients and judge by the recipe.
Two of the parent's ratios use only counts you already have (§1), so we can read them now:
rsym=WS,fdup-line=LD.
rsym ("symbols per word"): small for prose (<0.1), large for symbol-spam.
fdup-line ("fraction of lines that are repeats"): a number between 0 and 1.
A third ratio, ed ("effective epochs"), also has this bad-count-over-total shape, but its pieces (wd, T, Nd) aren't built yet — we assemble it in §7. The subscript (the little text below, like the "sym" in rsym) is just a name tag so you know which ratio; it changes nothing about the maths. Figure 2 shows why the ratio, not the raw count, is the fair judge.
Figure 2 — A short doc and a long doc with different raw symbol counts land on the same value r=0.15 because dividing by word count cancels length. The violet wall at 0.1 then judges both fairly.
A probability is itself a ratio: (favourable outcomes) / (all outcomes). So it fits the §2 mental model perfectly — it's a fraction that always lands in [0,1].
Now the language rule from the pipeline reads cleanly: keep a doc if p(en∣doc)>τ. In words — keep it if the classifier's confidence that the doc is English clears the language wall τ (from §3).
A k-shingle is how we fill the circles. First, what is k? It is just a whole number you pick, at least 1 (an integer ≥1) — it sets how long each chunk is. To shingle a document: chop it into every overlapping run of k consecutive words. With k=2, the text "the cat sat on" becomes the set {"the cat","cat sat","sat on"}. Small k (like 1) makes almost everything overlap (too loose); large k (like 10) demands long identical runs (too strict) — typical near-dedup uses k around 5 to 10 words. Two docs sharing many shingles overlap a lot. Figure 3 draws the two circles and names each region.
Figure 3 — Two document sets A and B as overlapping circles. The central lens is A∩B (shared shingles); the whole blob is A∪B; Jaccard is the lens divided by the blob.
The diagram below is a teaching aid, not decoration: read it top-down as a dependency chain. Counts (top) are the raw material; they branch into ratios (the left path, feeding quality filtering) and into sets → Jaccard → probability → minhash (the right path, feeding deduplication). Big-O joins in to explain why dedup must be clever. All three coloured paths converge on the parent's curation pipeline at the bottom — so nothing on the parent page floats free of these roots.
Ready to go deeper into the moving parts? See Tokenization (how words become the shingles and tokens we count), MinHash and LSH (the dedup engine), Deduplication and Memorization, Benchmark Contamination, Data Mixture and Domain Weighting, and Scaling Laws for LLMs (why token budgets are fixed).
Read the item as a question, then reveal to check yourself.
What does the fraction bar in S/W mean and why use a ratio here?
It means "S divided by W"; we use a ratio to cancel document length so the same threshold judges a tweet and a novel fairly.
What does rsym>0.1 tell you to do?
Drop the document — symbol density this high signals SEO/menu spam, not prose.
What should happen when W=0 or L=0 before computing a ratio?
The ratio is undefined (division by zero); drop the empty document as a special case instead of evaluating the fraction.
How do N and Nd differ?
N is the number of whole documents in the entire corpus; Nd is the token count available in one domain d — same letter, unrelated quantities, flagged by the subscript.
What does the subscript in wd or rsym change about the maths?
Nothing — it's just a name tag identifying which domain / which ratio.
What is the difference between ≥ and ≤?
≥ is "greater than or equal to", ≤ is "smaller than or equal to" — mirror images deciding which side the wall itself belongs to.
Read p(en∣doc)>τ in plain words.
Keep the doc if the classifier's confidence it is English exceeds the language-keep wall τ.
What do curly braces {} denote?
The set containing exactly the listed items — order does not matter and repeats are collapsed.
What is k in a k-shingle and how is it chosen?
k is a whole number ≥1 setting the chunk length; small k is too loose, large k too strict, typically 5–10 words.
Draw the picture for A∩B and A∪B.
Two overlapping circles: ∩ is the lens where they cross; ∪ is the whole blob covered by either.
What is a k-shingle?
A set of every overlapping run of k consecutive words in a document.
State Jaccard J(A,B) and say what J=1 vs J=0 mean.
J=∣A∩B∣/∣A∪B∣; J=1 identical sets, J=0 no shared chunk.
What happens to J(A,B) when both sets are empty?
∣A∪B∣=0 makes it 0/0, undefined; define it by convention (usually 0) or drop empty docs first.
What is minhashh(A)?
Stamp every shingle in A with hash h, take the smallest resulting value.
Why does Pr[minhash(A)=minhash(B)]=J(A,B) make dedup fast?
It lets a cheap probability of matching hashes estimate the expensive set-overlap, avoiding all-pairs comparison.
What does ∑dwd=1 enforce?
The domain weights are shares of a whole, so they add up to one like pie slices.
What must you do with a domain where Nd=0 before using ed=wdT/Nd?
Exclude it first (it would divide by zero) and renormalise the remaining weights to sum to 1.
Interpret ed=wdT/Nd=1.5.
You pass through domain d's data one and a half times during training.
Contrast O(N) and O(N2), and say what N counts here.
N is the number of documents; O(N) work doubles when docs double, O(N2) quadruples — comparing every pair, infeasible at a billion docs.