Choosing the data mixture: DoReMi, RegMix and proxy-model search
Read first: Training Compute-Optimal Large Language Models · DataComp-LM: In search of the next generation of training sets for language models
TL;DR. A pretraining corpus is a set of domains (web, code, books, papers, math), and the mixture says what fraction of training tokens comes from each. The mix changes downstream accuracy by several points, but you cannot afford to train many full-size models to compare mixes. This page covers three ways to choose a mix on small models. DoReMi (Xie et al., 2305.10429) trains a small proxy with Group DRO and reads off domain weights. Group distributionally robust optimization (Group DRO) alternates between an adversary that emphasizes the worst-served domain and a model that reduces the resulting weighted loss; in DoReMi the product we keep is the adversary’s average domain weights, not the proxy model. RegMix (Liu et al., 2407.01492), the main paper here, trains 512 tiny models on random mixes, fits a regression from mix to loss and picks the predicted best. Data mixing laws (Ye et al., 2403.16952) fit an explicit formula for loss as a function of the mix.
Why it matters now. Every frontier report has a mixture decision: Llama 3 used small-model experiments to set about 50% general knowledge, 25% math and reasoning, 17% code and 8% multilingual, and MAI-Thinking-1 chose its mix on a scaling ladder. The methods here are the published, reproducible versions of that search. They also show where small-scale search breaks. For IR readers, the same question appears whenever you train a retriever on many query sources.
Skip on a first read: the Group DRO derivation, the RegMix sampling details and the nested scaling laws in the mixing-law section. Read the two worked examples first.
Key idea
Section titled “Key idea”Notation. There are domains . The weights lie on the simplex (each and ). For the sampling model, choose a domain with probability , then sample a training example from it. Interpreting these weights as token fractions assumes equal-length packed examples or length-aware sampling; arbitrary variable-length documents need not produce those token fractions.
Why not grid search? With 17 domains and weights in steps of 0.1 there are mixtures. RegMix’s 64 different mixes for a 1B model on 25B tokens give averages from 43.7 to 47.9 across its benchmarks, and Lambada ranges from 18.9 to 33.5. The mix matters, and the space is far too large to train each candidate at full size. All three methods replace the full-size runs with small proxy runs.
DoReMi: learn the weights with a minimax proxy
Section titled “DoReMi: learn the weights with a minimax proxy”Intuition: give more weight to domains where the model can still improve. “Can still improve” is measured against a reference model.
- Train a small reference model on default weights (for the Pile, its standard weights).
- Train a proxy model of the same size with Group DRO. It minimises the worst weighted excess loss:
Here and are the summed token losses of the proxy and reference on document , and is its length in tokens. The bracket is the excess loss of domain per token.
- Train the large model on the averaged weights by ordinary resampling.
The inner max is solved online with a multiplicative-weights (exponentiated-gradient) step. At step , a minibatch is sampled uniformly over domains, and for each domain:
is the batch’s documents from domain , is the loss on token , is elementwise product, is the step size, is smoothing and is uniform. The proxy is then updated on the -weighted loss. The output is .
Why excess loss: noisy, high-entropy text has high loss for both models, so its excess is small; trivial text has low loss for both. Excess loss is high where the reference shows the text is learnable and the proxy has not learned it yet. Using only the proxy loss or only the reference loss did worse in the paper’s ablation.
Worked example (DoReMi, one domain triple, two steps). Domains web, code, forum; .
| web | code | forum | |
|---|---|---|---|
| proxy / reference loss (step 1) | 3.4 / 2.8 | 1.3 / 1.1 | 4.0 / 3.9 |
| (clipped excess) | 0.6 | 0.2 | 0.1 |
| 0.6074 | 0.4071 | 0.3684 | |
| normalised (sum 1.3829) | 0.4392 | 0.2944 | 0.2664 |
| after smoothing | 0.4391 | 0.2944 | 0.2665 |
| 0.4 | 0.3 | 0.1 | |
| 0.4862 | 0.2951 | 0.2187 | |
| 0.4626 | 0.2948 | 0.2426 |
(Here is treated as the mean of per-token clipped excess. The displayed domain-average proxy/reference losses are illustrative; in general you cannot subtract those averages and then clip. For two token differences and , clipping before averaging gives 0.5, while clipping the average gives 0.) Forum has the highest raw loss (4.0) but the lowest excess, so it falls. Code holds roughly steady even though its excess is positive, because weights are relative.
RegMix: treat the mix as a regression input
Section titled “RegMix: treat the mix as a regression input”Intuition: instead of learning weights inside one run, sample many mixes, train a tiny model on each, and learn a cheap function validation loss. Then search that function, not the training runs.
- Sample 512 mixtures from , where is the domains’ token share and varies the spread. This covers extreme mixes but stays tied to how much data each domain has. The released code also caps each weight so that no domain repeats more than a set number of epochs.
- Train a 1M-parameter model (non-embedding) on 1B tokens for each mix and record the target: validation loss on Pile-CC, chosen because it correlates best with downstream tasks.
- Fit a regressor: ridge linear regression , or LightGBM. LightGBM is an ensemble of boosted decision trees, so it can model nonlinear effects of the weights.
- Simulate one million Dirichlet mixtures with the regressor (under 10 CPU seconds), and average the top 100 predicted mixtures. The paper does this for robustness; the average stays on the simplex and within any shared convex weight caps, but it is not guaranteed to lie within the region the proxy runs covered, and it does not remove error shared by the top candidates.
- Train the large model on that average.
The key assumption is rank invariance: the ordering of mixtures by loss is the same for the tiny proxies and the target model. RegMix only needs the order to transfer, not the loss values.
Worked example (RegMix, 6 proxy runs). Domains web, code, books (books share is ). The target is web validation loss. These numbers are made up for teaching; they come from the toy function , where a little code helps.
| run | web | code | books | target loss | linear fit |
|---|---|---|---|---|---|
| 1 | 0.8 | 0.1 | 0.1 | 2.528 | 2.503 |
| 2 | 0.5 | 0.4 | 0.1 | 2.738 | 2.780 |
| 3 | 0.3 | 0.3 | 0.4 | 2.922 | 2.956 |
| 4 | 0.6 | 0.2 | 0.2 | 2.672 | 2.684 |
| 5 | 0.2 | 0.7 | 0.1 | 3.092 | 3.058 |
| 6 | 0.4 | 0.1 | 0.5 | 2.888 | 2.860 |
Least squares with books dropped (the three weights sum to 1, so keeping all three plus an intercept is collinear) gives . The fit ranks all six runs in the right order (Spearman ). Its minimum on the simplex is still a corner, 100% web. With a realistic cap of 70% web, the linear model picks (0.7, 0.0, 0.3) with predicted loss 2.589; the true loss there is 2.670, while (0.7, 0.3, 0.0) gives 2.562. A model that cannot represent the quadratic code effect (not a web×code interaction) ranks the observed runs well but sends the search to the wrong place. This is why RegMix prefers LightGBM, samples near realistic mixes and averages many top candidates.
Data mixing laws: fit a functional form
Section titled “Data mixing laws: fit a functional form”Intuition: loss falls as you add a helpful domain, with diminishing returns, and the falls combine. Ye et al. use an exponential, not a power law, because a power law diverges when a domain’s share goes to 0:
is validation loss on domain , is training share of domain , is the fitted mixture-independent floor and is a scale. The paper reads as “training on helps ”. On the simplex, however, increasing one share requires decreasing another: moving mass from domain to changes at rate . These contrasts, not an individual coefficient’s sign, decide whether that substitution helps (adding a constant to every and replacing by leaves unchanged). weights validation domains; if the validation set’s makeup is unknown, it is learned over implicit domains. The fitted were sparse: many domain pairs barely interact. For a two-domain check, take and with the share of A and equal validation weights. Setting the derivative to 0 gives and , against at 50/50.
To predict at large scale, they nest three fits: loss vs training steps, then vs model size (Chinchilla-style), then the mixing law on the predicted losses. Small models (70M to 410M) on many mixes then predict a 1B model on 100B tokens. Unlike simply transferring the best small-model mixture, the nested fits predict a new loss surface at the target size and budget, so its optimum is allowed to move with scale.
What the numbers say
Section titled “What the numbers say”DoReMi (Pile, 280M proxy → 8B model). Average one-shot accuracy on five generative tasks improves by 6.5 points, and the baseline’s final accuracy is reached at 75k instead of 200k steps (2.6× faster). Perplexity improves on all 22 domains, including downweighted ones. The two 280M runs cost 8% of the 8B run. Weights change a lot: Pile-CC rises from 0.1121 to 0.6057, while ArXiv falls from 0.1052 to 0.0036 and PubMed Central from 0.1071 to 0.0046. Proxy size matters non-monotonically (Table 3a, worst-case/average log-perplexity of the 8B model): baseline 1.71/1.64, 70M proxy 1.63/1.53, 280M 1.46/1.40, 1B 1.58/1.54. On GLaM’s six domains, iterated DoReMi converged in 3 rounds, and round 2 already matched weights tuned on downstream tasks.
RegMix (17 Pile domains, 1B model on 25B tokens). The 512×1M proxies cost about 2% of one 1B run. Check with : (the paper reports ) against . Table 4 averages:
| Mixture | Avg. | Search FLOPs |
|---|---|---|
| Human (Pile weights) | 45.1 | 0 |
| DoReMi | 46.8 | 3.7e19 |
| Pile-CC only | 46.8 | 0 |
| PPL filtering | 46.2 | 1.8e19 |
| RegMix | 47.3 | 3.5e18 |
RegMix is best on 7 of 14 tasks; HellaSwag rises from 37.4 (Human) to 44.2. DoReMi’s weights here were taken from its paper and renormalised to 17 domains, so this is not a fresh DoReMi run. At 7B on 100B tokens (App. J), RegMix averages 56.5 against 54.5, but loses on SciQ, LogiQA, QQP and MultiRC. This is an external check of the selected mixture, not an exhaustive 7B test of rank invariance across many mixtures. Similarly, DoReMi’s proxy-size ablation also changes its optimization procedure; it is not a clean two-mixture ranking reversal. With 100 FineWeb domains, LightGBM still reaches Spearman (99.53% in the paper’s table) at 1M. RegMix also finds that domain effects are hard to guess: PhilPapers appears to help all domains, and only DM Mathematics shows a near power-law loss vs. weight relation.
Data mixing laws (RedPajama → Pile validation). The optimised mix for a 1B model on 100B tokens reaches the default mixture’s 100k-step loss in about 73k steps. At 100k steps it reaches a still lower loss that the paper estimates would need about 148k steps with the default mixture; that second comparison extrapolates the default training curve. It also beats DoReMi and DoGE. In continual pretraining of Pythia-70M on Pile plus Python, the law predicts the smallest Pile share that keeps Pile loss from rising.
Pretraining mixes vs annealing mixes
Section titled “Pretraining mixes vs annealing mixes”The main DoReMi and RegMix experiments select a fixed mixture for training from scratch. Data mixing laws additionally fit mixtures for continual pretraining from an existing checkpoint. A mixture fitted from scratch should not be assumed to transfer to a late-stage checkpoint without a new test. Modern recipes also change the mix at the end, while the learning rate decays to 0. Annealing is the learning-rate decay; mid-training is a later training stage that may change the mixture, context length and other objectives. They often occur together, but are not synonyms. Llama 3 valued candidate datasets by annealing a half-trained 8B model over 40B tokens, assigning 30% to the candidate dataset. Separately, a diagnostic that included the GSM8k and MATH training sets reported gains of 24.0% and 6.4%, respectively, on their validation sets at 8B, but negligible gains at 405B. Those benchmark training sets were excluded from the final annealing mixture. OLMo 2 spends 5–10% of FLOPs on the Dolmino mix and chose its sources with 19 microanneals totalling 130B tokens. MAI-Thinking-1 shifts mid-training to 55% code and 35% STEM/math. Annealing tests are cheaper than from-scratch proxies because they start from a real checkpoint, but they answer a different question: what helps a trained model at the end, not what mix to learn from.
Caveats
Section titled “Caveats”- Rank invariance can fail. RegMix checks it only up to 1B parameters. On the site, MAI-Thinking-1 shows a STEM-heavy mix winning on held-out STEM NLL at small scale and losing to a code-heavy mix at 23B active parameters on about 20T tokens. The authors hypothesize that two high-quality but more duplicated, less diverse STEM sources contributed to the reversal; their weights were 11.8% in the STEM-heavy mixture versus 0.3% in the code-heavy mixture. The report does not isolate duplication with a controlled ablation. DoReMi’s 1B proxy chose very different weights from its 280M proxy (Pile-CC 0.1199 vs 0.6057), and the 8B model did worse with them.
- Data limits. RegMix assumes each domain has unlimited data. A mix that upweights a small domain forces repetition; data-constrained scaling suggests about 4 epochs cost little, more do not. The released code caps sampling for this reason.
- The target decides the answer. RegMix optimises Pile-CC loss; MMLU and GSM8K are near random at its scales. DoReMi optimises worst-case excess loss, not a downstream metric.
- Domains are given. All methods need named domains in advance and, for RegMix, the same tokenizer for proxies and the target model. What counts as a domain changes the result.
- Mixing interacts with filtering. DCLM found adding curated sources helped C4 but hurt the stronger DCLM-Baseline, so the best mix depends on how each domain was filtered.
- Number check. RegMix App. F gives DoReMi’s 280M-proxy Pile-CC weight as 0.67; DoReMi’s own table says 0.6057. This page uses DoReMi’s figure.
IR connection
Section titled “IR connection”Retriever training is also a mixture problem. Contrastive embedding models train on dozens of sources (QA pairs, search logs, title–body pairs, synthetic queries). Nomic Embed draws each batch from one source, and Gemini Embedding grid-searches its fine-tuning mixture and finds an English-only diverse-task mix (66.75 on MTEB Multilingual) beats a multilingual retrieval-only one (58.24). Treat query sources or query types as domains, held-out BEIR-style nDCG@10 or validation contrastive loss as the target, and a small encoder trained briefly as the proxy. DoReMi’s excess loss maps to a familiar idea: train more on queries where your retriever is wrong but a stronger reference retriever is right.
Try it (optional)
Section titled “Try it (optional)”Re-run the two worked examples in a few lines of Python: implement the DoReMi update with math.exp and check the table, then fit the six RegMix runs by least squares and search a 0.05 grid over the simplex with and without the 70% web cap. Then refit with a feature and see the optimum move. The RegMix notebook does the real version with Dirichlet sampling and the top-k average.
Connections
Section titled “Connections”- Chinchilla — how compute is split between model size and tokens; mixing laws reuse its loss decomposition.
- Data-constrained scaling — how much repetition a small upweighted domain can absorb.
- Over-training scaling laws — another case of small runs predicting large ones.
- DCLM, FineWeb and Dolma — building the domains that get mixed.
- Phi-4 — a hand-tuned mix with 40% synthetic data, repeated many epochs.
- Llama 3, OLMo and MAI-Thinking-1 — mixture and annealing decisions in real reports.
- Embedding recipes compared — mixture choices for retrievers.
You should now be able to…
- explain why mixture weights matter and why they are searched with proxies;
- write the DoReMi update and run it by hand;
- describe the RegMix pipeline and its rank-invariance assumption;
- write the data mixing law and interpret , and ;
- tell a pretraining mix from an annealing mix;
- name cases where proxy results did not transfer and how to check for them.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Run one DoReMi weight update by hand for three domains that start at uniform weights, with clipped excess losses of 0.5, 0.0 and 0.2, step size η = 1 and smoothing c = 0.001. Then explain why the domain with zero excess loss still loses weight, and what the final weights used for the large model are.
What a strong answer covers
- Unnormalised weights are (1/3)·e^0.5, (1/3)·e^0, (1/3)·e^0.2 = 0.5496, 0.3333, 0.4071; their sum is 1.2900.
- Normalising gives about (0.4260, 0.2584, 0.3156); mixing in 0.1% uniform gives about (0.4259, 0.2585, 0.3156).
- The update is multiplicative and then renormalised, so weight is relative: a domain with zero excess loss is multiplied by 1 while the others grow, so its share falls from 0.333 to about 0.26.
- The large model is not trained on the last step's weights but on the average of the weights over all proxy training steps.
- Mechanism
DoReMi upweights domains by excess loss (proxy loss minus reference loss) rather than by the proxy's raw loss. Explain what excess loss measures for a high-entropy domain, a nearly memorised domain and a learnable domain, and what the paper's ablation found when either term was used alone.
What a strong answer covers
- High-entropy text (noisy forums, random strings) has high loss for both models, so the difference is small and it is not upweighted even though its raw loss is highest.
- Very easy or repetitive text has low loss for both models, so excess loss is also small; extra tokens there teach little.
- A domain where the reference model does well but the proxy still lags has large excess loss: the gap shows there is learnable structure left.
- Ablation: using only the proxy loss (favouring the hardest domains) or only the negative reference loss (favouring the easiest) both did worse than excess loss.
- The idea is close to Moore–Lewis cross-entropy difference used for data selection, and to choosing training queries where a model is wrong but a stronger model is right.
- What if…
RegMix makes several design choices: many tiny proxies rather than fewer longer runs, LightGBM rather than linear regression, and averaging the top 100 predicted mixtures rather than taking the single best. Using the paper's numbers, explain what each choice buys and why a linear model alone would be a risky optimiser over the simplex.
What a strong answer covers
- Fig. 4: more proxy runs beats more tokens per run; gains from tokens per proxy flatten around 0.25B, and 512 runs at 0.2B beat 128 runs at 0.8B.
- Table 2 reports ρ = 0.9008, 0.8926 and 0.8801 for linear regression on 1M, 60M and 1B target models, versus 0.9845, 0.9864 and 0.9712 for LightGBM.
- A linear function on the simplex is minimised at a corner (one domain at 100%), so a linear fit can rank observed runs well yet send the search to an untested extreme.
- Averaging the top 100 predicted mixtures is intended to make selection more robust. It preserves the simplex and any shared convex weight caps, but does not guarantee interpolation within the training mixtures or remove shared regression error.
- Appendix K compares 128×1B proxies with 512×1M proxies, each trained on 1B tokens: target averages are 56.4 and 56.5. This supports the cheap configuration in that comparison, but model count and size changed together, so it is not an isolated proxy-size ablation.
- Critique
RegMix transfers mixture rankings from tiny models to larger ones. Distinguish the evidence from its multi-mixture rank tests, its selected-mixture 7B result, DoReMi's proxy-size ablation and MAI-Thinking-1's two-mixture reversal. Which tests directly assess rank invariance, what confound remains in each, and what intermediate-scale experiment would you run?
What a strong answer covers
- Support: RegMix reports high Spearman ρ across 1M, 60M, 280M and 1B models and 1B to 25B tokens, but only up to 1B, and admits that checking 3B would need 64 models on 50B tokens each.
- DoReMi with a 280M proxy gives Pile-CC 0.6057; with a 1B proxy it gives 0.1199 and puts most weight on OpenWebText2 (0.3289). The 8B model trained on 1B-proxy weights was worse than with 280M-proxy weights.
- DoReMi's worse 1B-proxy weights can reflect Group DRO optimization quality, as its authors suggest; this is not by itself proof that a fixed pair of mixtures reverses order with scale.
- MAI-Thinking-1 Fig. 6: a STEM-heavy mix wins on held-out STEM NLL at small scale but loses to a code-heavy mix at 23B active parameters on about 20T tokens. The authors hypothesize that two high-quality but more duplicated, less diverse STEM sources (11.8% of the STEM-heavy mix vs 0.3% of the code-heavy mix) contributed; no controlled ablation isolates duplication.
- Repetition and limited diversity are plausible scale-dependent failure modes, not a demonstrated universal law that small models prefer repeats. Vary duplication or source availability while holding mixture, model size and token budget controlled.
- Mitigation: confirm the top few candidates at one or two intermediate scales and cap each domain by available tokens times a tolerable number of epochs.
- Design
You train a dense retriever on a mix of query sources: web search logs, community QA, scientific claims, code search and synthetic LLM-generated queries. Adapt RegMix or DoReMi to choose the sampling weights, and say what plays the role of the target loss, the proxy model and the reference model.
What a strong answer covers
- Domains are query sources or query types; keep one source per batch, as Nomic and Gemini Embedding do, so in-batch negatives are not trivially easy.
- Optimize a held-out development collection: maximize mean nDCG@10, or minimize negative nDCG or contrastive validation loss. Keep final BEIR-style test tasks untouched by mixture selection.
- RegMix version: train many short runs of a small encoder on Dirichlet-sampled mixtures centred on source sizes, regress the target on the weights, and average the top predicted mixes.
- DoReMi version: a reference retriever trained on the default mix, then a proxy whose per-source weights rise where its contrastive loss exceeds the reference's.
- Check the chosen weights with a full-size run, and cap small sources so the encoder does not see them for too many epochs.
- Connect
Compare data mixing laws (Ye et al.) with RegMix. Write the mixing-law functional form, explain each parameter, and say what each method assumes about how loss depends on the mixture and on scale, and how each relates to late-stage annealing mixes such as Llama 3's and OLMo 2's.
What a strong answer covers
- Mixing law: L_i = c_i + k_i·exp(Σ_j t_ij·r_j). Shares r_j sum to one; c_i is the fitted mixture-independent floor, k_i > 0 a scale, and replacing domain h with j is helpful when t_ij − t_ih < 0.
- Mixing laws assume an explicit parametric form and handle scale with nested step and model-size scaling laws; RegMix assumes no form but assumes the ranking of mixtures is the same at small and large scale.
- Mixing laws: for a 1B model, the optimised mix reached the default mix's 100k-step loss in about 73k steps, and its 100k-step loss would need about 148k default-mix steps (extrapolated); RegMix matched or beat DoReMi with about 10% of its search compute.
- Annealing mixes are chosen at the end of training with the learning rate decaying to 0: Llama 3 valued candidate datasets by annealing a half-trained 8B model over 40B tokens with 30% weight on the candidate; OLMo 2 ran microanneals.
- DoReMi and RegMix's main experiments select from-scratch mixtures, whereas Ye et al. also refit a mixing law for continual pretraining. For a late-stage anneal, fit or validate at the relevant checkpoint and learning-rate schedule rather than transplanting the from-scratch optimum.