II · THE IDEA · ARTIFICIAL INTELLIGENCE
Data Selection via Perplexity for Language Model Training
▶ Listen · narrated
Training data is no longer only gathered. It is scored, cut, and rebalanced, often by a model far smaller than the one that will eventually train on it.
At a glance
- Core idea
- Use a small model to judge which text, and which domains, deserve training budget
- Deduplication
- Removing exact and near-duplicate examples improves models and reduces memorisation
- DoReMi
- Optimise domain mixture weights on a proxy, then train the large model on that mix
- Signal used
- Language-modelling loss and related excess loss across domains, not hand-written rules alone
- Payoff
- Fewer steps to a given perplexity and stronger downstream results in reported setups
Think of a vast second-hand book market. Much of what is on the tables is the same paperback stacked twenty times, plus leaflets nobody asked for. Before you hire a scholar to read for a year, you send an assistant first. The assistant throws out the obvious duplicates, then notes which topics still feel hard after a quick pass, and tells you to spend more of the scholar’s time on those shelves.
That is the spirit of these methods. Deduplication removes repeated and near-repeated web pages so the main training run does not keep rereading the same text and accidentally getting test questions it has already seen in disguise. DoReMi uses a smaller “assistant” model to decide how heavily to sample each domain of text when the large model trains. The assistant is trained so that domains which stay relatively hard get more weight. The large model then trains on that adjusted diet.
Nothing mystical is happening. The small model only knows what its training loss says is surprising or under-served. Used carefully, that is enough to waste fewer updates on junk and imbalance. Used carelessly, it can over-delete odd but useful pages or overweight the wrong domains.
Two complementary interventions appear in the source papers.
Deduplication (Lee et al., 2021) targets exact and near-duplicate training examples in large web corpora. Near-duplicate detection (for example MinHash-style similarity) removes pages that differ only superficially. Effects reported include reduced memorisation of training strings, mitigation of train–test overlap that inflates evaluation metrics, and improved training efficiency: models reach comparable or better accuracy in fewer steps when trained on the cleaned set. This is example-level filtering; it changes support of the empirical distribution by deleting mass.
DoReMi (Xie et al., 2023) — Domain Reweighting with Minimax Optimisation — targets domain-level sampling weights rather than individual page deletion. A small proxy is trained with group DRO over domains, using excess loss relative to a reference model so optimisation does not collapse onto domains with inherently high entropy. The learned weights define the mixture for a larger main pretraining run. Empirically, the reweighted mixture can reach base perplexity targets in fewer steps (reported up to a few-fold in their setups) and improve downstream evaluations versus baseline mixes. The proxy size is intentionally far below the main model; transfer of weights is the point.
Mechanically, both interact with token-level cross-entropy. Deduplication reduces repeated easy loss spikes on copied spans and leakage into eval. DoReMi reallocates gradient budget according to domain-wise excess loss. Limitations: domain taxonomies are coarse; DRO hyperparameters and reference choice affect weights; aggressive near-dedup can drop legitimate variants; loss-based scores need not match human quality rubrics or safety filters. In production stacks these steps usually sit beside classifiers and heuristic filters rather than replacing them.
Look closer
Duplicates are not a side issue
Web crawls repeat the same pages, boilerplate, and mirrored sites. The 2021 deduplication work shows that both exact matches and near-duplicates are common enough to matter: models trained without removing them memorise more string content and can look better on evaluation sets that secretly overlap the train set. Cleaning the corpus is therefore both a quality step and a measurement step.
The proxy never has to match the final size
DoReMi trains a comparatively small proxy with a group-distributionally robust objective so that domain weights are driven by which domains remain hard relative to a reference. Those weights are then frozen and used to sample data for a much larger model. The expensive run inherits a mixture chosen on a cheaper one, rather than treating every token of every domain as equally worth another gradient step.
Selection and mixture are different levers
Deduplication decides whether a particular example should appear at all, and how often. Mixture optimisation decides how much mass each domain — encyclopaedia text, code, forums, and so on — receives in the stream. Both change the effective dataset; only one of them is mainly about deleting redundancy, and only one is mainly about rebalancing sources that are already considered usable.
The story
Raw web text is abundant and uneven. Some passages are carefully written prose; many more are menus, cookie notices, duplicated product listings, or the same article scraped from a dozen mirrors. A language model will spend gradient updates on whatever it is shown. If the stream is full of repeats and low-value domains, those updates are not free: they cost compute, they shape what the model memorises, and they can distort evaluation when test documents are cousins of training documents.
One response is to clean the corpus before any large training run begins. Deduplication work from 2021 makes the case in plain terms. Exact duplicate removal is the easy end of the spectrum; near-duplicate detection catches pages that differ by a banner, a timestamp, or a thin rewrite. After such filtering, models tend to memorise less verbatim text and to need fewer steps to reach a given level of language-modelling performance. Overlap between train and evaluation data also falls, which means reported gains are less likely to be artefacts of having already seen the test distribution in slightly altered form. The method is unglamorous — hashing, similarity thresholds, held-out checks — but it changes the dataset the optimiser actually sees.
Cleaning still leaves a second problem. Even a deduplicated corpus is a mixture of domains that do not contribute equally to downstream usefulness or to the losses the trainer cares about. Uniform sampling by source size is a policy, not a law of nature. It may over-serve domains that are easy or huge, and under-serve domains that remain hard for the model yet matter for the tasks people care about later.
DoReMi attacks that mixture problem with a proxy. Instead of guessing domain weights by hand, it trains a smaller model under a minimax-style objective: group distributionally robust optimisation over domains, using excess loss relative to a reference so that the procedure does not simply pour all mass into intrinsically high-entropy domains. The output is not a new architecture. It is a set of sampling weights. Those weights are then used when a larger model is pretrained. In the reported experiments, the large model reaches target perplexities in fewer steps than a baseline mixture, and downstream evaluations improve under the reweighted data. The proxy is doing the expensive search over how much of each domain to keep in the stream; the main run mostly consumes the answer.
Perplexity and training loss sit near the centre of both stories even when the paper titles do not say “filter every document by a single perplexity cutoff.” A language model’s loss on a span is a direct score of how surprising that span is under the model. Deduplication removes mass that would otherwise be predicted with artificially high confidence because it was seen in near-identical form. Mixture optimisation reallocates mass toward domains whose excess loss says they are still under-served. In practice, teams often combine families of tricks: drop trash and duplicates, score documents with a small model or a classifier distilled from human preference, then set domain weights with something like DoReMi or with simpler heuristics. The shared pattern is that data is no longer treated as a fixed pile. It is ranked and budgeted.
None of this makes the large model “understand quality” in a human sense. The proxy only knows what its own training signal defines as costly. If that signal is misaligned with the evaluation you care about, the selected mixture can be confidently wrong. If near-deduplication thresholds are too aggressive, rare but legitimate variants disappear. If domain labels are coarse, weight optimisation moves blunt blocks of the internet rather than fine slices. The papers are clear that the gains are empirical and setup-dependent, not a universal proof that every corpus should be carved the same way.
What they do establish is a shift in habit. At web scale, the bottleneck is not only how many parameters you can afford. It is whether each token in the stream deserves its place. A small model, used either to help strip redundancy or to rebalance domains, is one of the few tools cheap enough to run across the pile before the main training bill begins.
Why it mattered then
By the early 2020s, pretraining corpora had grown into web-scale scrapes where repetition and uneven domain mass were no longer anecdotal. Evaluation suites could silently overlap train data through duplicated pages, and compute budgets were large enough that wasting steps on near-copies or on poorly weighted mixtures had become a first-order cost. Deduplication gave a concrete, measurable fix for redundancy and memorisation. DoReMi arrived in a setting where practitioners already believed data mix mattered but often tuned it by hand or by coarse rules; it offered a procedure to derive weights from a proxy objective instead of from intuition alone. Together they marked a turn from “more text is better” toward “which text, and how often,” at a moment when that question had become expensive enough to study carefully.
Why it matters now
Open and closed training runs still begin with crawls that look nothing like a curated library. Teams routinely face the same two pressures these papers isolate: memorisation and leakage on the one hand, and slow or uneven learning across domains on the other. Proxy-based scoring and reweighting remain attractive because they scale sublinearly with the final model size — the small model reads the corpus so the large one does not have to discover the same imbalance from scratch. Anyone assembling a mixture of web text, code, books, and specialised domains is still making the choices deduplication and DoReMi tried to discipline: what to delete, what to down-sample, and how to defend those decisions with a loss-based argument rather than with folklore.
The surprising detail
The striking move in DoReMi is not that data mix matters — practitioners already suspected that — but that a proxy small enough to be trained under a robust-optimisation loop can hand its domain weights to a model many times larger and still transfer. The expensive run inherits a sampling policy from a cheaper one. Deduplication has a quieter surprise: some of what looked like strong evaluation performance was partly train–test overlap created by duplicated web pages, so cleaning the data can make a benchmark harder and a model more trustworthy at the same time.
What is disputed
Reported speed-ups and downstream gains for DoReMi are tied to particular domain taxonomies, proxy sizes, and evaluation suites; they are not a guarantee for every corpus. Deduplication gains likewise depend on how aggressive the similarity threshold is and on how much duplication a given crawl actually contains. Neither paper claims that loss-based selection alone captures every human notion of quality.
Remember this
At web scale, data work is selection under a budget: drop redundant text, then let a small model’s losses decide how much of each remaining domain the large model should see.
Test yourself
A team trains on a web mixture and sees strong held-out perplexity, then applies near-deduplication and domain reweighting from a proxy. Perplexity on the old held-out set worsens slightly, yet memorisation probes improve and a downstream suite rises. What two separate mechanisms, one from each paper’s concern, could explain that pattern?
Deduplication may have removed near-duplicate overlap between the training stream and the old held-out set, so the previous perplexity number was partly inflated by leakage; the new number is lower on a cleaner split even if the model is healthier. Separately, proxy-driven domain reweighting can shift mass toward domains that matter more for downstream tasks but are not the easiest way to drive generic held-out perplexity on the original mixture, so the loss-based headline metric and the task suite need not move in lockstep.
Go deeper
- [2107.06499] Deduplicating Training Data Makes Language Models Better · arxiv.org
- [2305.10429] DoReMi: Optimizing Data Mixtures Speeds Up Language Model Pretraining · arxiv.org
Image: Original diagram, The Daily Triptych. Licence: Original work. Source.