Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Two pretraining runs share an identical 2T token budget, model size, and hyperparameters. Run A uses 10% code in the data mixture; Run B raises code to 30%, displacing general web text. Predict the direction of change for Run B relative to Run A on: (a) code generation benchmarks like HumanEval, and (b) held-out perplexity on general English web text.
At a fixed token budget, mixture ratios are zero-sum: tripling code share lifts code evals and degrades held-out web perplexity in proportion to the displacement.
Imagine packing a single suitcase for a two-week trip. You decide to bring three times as many running shoes. The suitcase did not get bigger, so something else (work shirts, a jacket) had to come out. You will run great. You will look worse at meetings. Pretraining mixtures work the same way: the token budget is the suitcase. Tripling the code share means less room for general web text, so the model gets better at writing code and a little worse at modeling everyday English. Neither result is surprising once you remember the suitcase is full.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
6 minutes: the fixed-budget displacement argument, why perplexity moves as a power law in tokens-seen, the second-order quality-saturation effect, and the operational case for running mixture ablations rather than guessing.
# Reweight the mixture: triple the code share, displace web proportionally.
mix = {"web": 0.75, "code": 0.10, "math": 0.08, "books": 0.07}
mix["code"] *= 3 # 0.10 -> 0.30
shortfall = 1.0 - sum(mix.values()) # negative: we overcommitted
mix["web"] += shortfall # absorb displacement on web
assert abs(sum(mix.values()) - 1.0) < 1e-9
print({k: round(v, 4) for k, v in mix.items()})
# {'web': 0.55, 'code': 0.30, 'math': 0.08, 'books': 0.07}Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Predicting that more code helps everything because code 'teaches reasoning', without accounting for the web tokens that had to be displaced at a fixed budget.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.