60 minutes · 6 sub-sections: Thesis · MinHash/LSH · Semantic Dedup · Perplexity · Decontamination · Curriculum
The data-quality module. Where 80% of fine-tuning gains are.
Pillar 1 — Data
Anyone can generate a million samples — almost nobody can clean them.
| Mystery | Why the thesis explains it |
|---|---|
| Why "generate more data" is the wrong instinct | Doubling a noisy dataset doubles the noise. Clean first, scale second. |
| Why decontamination is non-negotiable | If your data has benchmark items, your evals are fiction. The #1 cause of post-launch retraction. |
| Why your data pipeline is the moat | Algorithms + bases are public. Your cleaned dataset is the one artifact competitors can't copy. |
Exact hashing misses near-duplicates (1 char changed, whitespace, rephrasing). MinHash catches them.
| Step | What happens |
|---|---|
| 1. Shingle | Split into overlapping n-grams (k=3). Captures local structure. |
| 2. Hash | k independent hash fns per shingle; keep min per fn → k-length signature. P(share min hash) = Jaccard. |
| 3. Band (LSH) | Chop signature into b bands of r rows; shared band hash → candidate pair. Avoids O(n²). |
| 4. Verify | For each candidate pair, compute actual Jaccard. ≥ 0.8–0.9 → drop as duplicate. |
Tools: datasketch (canonical Python lib) · text-dedup (CLI wrapper). Used by CC, RedPajama, DCLM.
MinHash sees
Lexical duplicates — same words in same order.
"the cat sat on the mat" vs "the cat sat on the mat."
MinHash misses
Paraphrases — same meaning, different words.
"the cat sat on the mat" vs "a feline rested on the rug."
Same machinery → quality subset selection: cluster-and-select (pick K nearest centroids), or fastText quality classifier keeping top decile. DCLM: quality filtering ≈ 4× compute.
Train a small LM on clean data. Score every sample. Drop the high-perplexity tail — those are samples the model finds "surprising" = garbage.
| Perplexity | What it means | Action |
|---|---|---|
| Low | Model expected it. Clean, well-formed. | Keep |
| Mid | Normal variation. | Keep |
| High | Surprising. Mojibake, OCR, noise, code corruption. | Drop (top ~10%) |
Tool: kenlm (fast n-gram, the pretraining workhorse). Or any small pretrained transformer you can score with.
In continued pretraining, keeping only low-perplexity tokens measurably mitigates catastrophic forgetting.
Same logic in fine-tuning, weakly: high-perplexity samples pull weights hard. Dropping them removes garbage AND reduces forgetting risk.
The algorithm: n-gram matching.
13-gram shared = essentially unique evidence. 8-gram shared = weak (common phrases trip it). Tools: lm-eval-harness decontamination, datatrove, OpenAI's GPT-3 scripts.
| Skip this stage… | Cost |
|---|---|
| Dedup | A few points of efficiency |
| Perplexity filter | Some garbage in training |
| Decontamination | The ability to trust ANY benchmark you report |
There is no scenario in which skipping decontamination is the right call. A reviewer can debunk a contaminated model in 30 seconds by grepping your data for a GSM8K problem.
Order samples easy → hard. Build a stable representation on easy data, then refine on harder.
A typical messy set loses 20–50% between generate and train. That is the moat being built.
| Stage | Sample count | Removed |
|---|---|---|
| Generate | 10,000 | — |
| After MinHash dedup | 8,200 | −1,800 near-dupes |
| After semantic dedup | 6,800 | −1,400 paraphrases |
| After perplexity filter | 6,100 | −700 garbage |
| After decontamination | 5,950 | −150 benchmark items |
| Final quality subset | 2,000 | diverse, high-quality |
Numbers illustrative. Shape is real.
Next: FT07 — Tokenizers & Chat Templates