Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Techniques

Data Mixture

About 4034 characters Updated Nov 30, 2026 30 views AI wiki

Data mixture refers to setting sampling weights for data from different sources, domains and languages within a pretraining corpus, thereby determining the model's "knowledge recipe". It is one of the cheapest yet most sensitive levers in large-model training: with the same total amount of data, simply changing the weights markedly shifts the distribution of the model's downstream capabilities. It is therefore regarded as a core decision in data engineering rather than a hyperparameter that can be set casually.

Core Principles

Contemporary large-model pretraining corpora are usually divided by source into several domains such as web pages, code, academic papers, books, encyclopedias, math problems and multilingual dialogue; each domain has its own size and quality distribution, with high mutual duplication and large differences in information density. The problem that mixture must solve is: under a fixed compute budget, how many tokens to draw from each domain for training so that the model achieves the best overall performance on general reasoning, coding, math and multilingual abilities. Intuitively, natural sampling in proportion to raw inventory is often not optimal, because web pages are extremely redundant and easily learned repeatedly, whereas code and math, though scarce, are information-dense, and appropriate upsampling can markedly improve logical reasoning.

Mainstream approaches fall into two paths. The first is heuristic tuning: early work such as The Pile and Gopher first gives empirical proportions and then fine-tunes with small-scale ablation experiments, and open models such as Llama and Qwen largely follow this line, that is, setting a skeleton ratio first and then adding or subtracting a few key domains. The second is optimization-based automatic mixture, whose representative work is DoReMi: it first trains a small proxy model alongside a reference distribution, then uses distributionally robust optimization (Group DRO) to gradually adjust the weights of each domain so as to minimize the loss on the worst domain, and finally transfers the learned weights to large-scale formal training. RegMix goes further, training several hundred small-scale models in parallel, fitting the "mixture to loss" relationship as a regression model, and then predicting and selecting the optimum from a set of candidate mixtures, essentially borrowing the extrapolation idea of scaling laws. Another common practice in domain weight adjustment is "multiple repetitions of high-quality domains", for example training two to four rounds on code and math.

Key Points

Small proxy models are the pivot of the whole methodology: searching mixtures directly on a large model is unaffordable, so several hundred short trainings are run on small models of a few hundred million to a billion-plus parameters, and after obtaining a relative ranking it is extrapolated to the large model. Proxy reliability is the biggest risk: the optimal mixture for a small model is not necessarily that for a large model, and scaling verification is usually essential to check whether the ranking reverses. Category granularity should be moderate: too coarse (only web and code) makes tuning almost impossible, too fine (hundreds of sub-sources) easily overfits noise under a small budget. Data repetition should be modeled explicitly: high-multiple repetition beyond about four rounds gives diminishing or even harmful returns, so mixture tuning should treat repetition rounds as a constraint rather than a free variable. Optimization objectives usually include several at once, such as validation perplexity, weighted downstream task scores and distribution distance from the reference model, to avoid being gamed by watching a single metric. In engineering, random seeds and tokenizers must also be fixed, otherwise differences between experiments cannot be attributed.

Common Misconceptions

The most common is treating the mixture as a static constant fixed once. In practice, late training often needs to enter an annealing phase and switch mixtures, and heavily mixing in high-quality data in the final stage yields very obvious gains. Second is looking only at the average score while ignoring imbalance across domains: if one domain is held too low, that capability collapses as a whole. Some believe that more data is always better, forgetting that mixture optimization presupposes that the total amount and compute budget have already been fixed.

Application Scenarios

Foundation model pretraining, continued pretraining of domain models, balancing multilingual capabilities, strengthening code and math abilities, constructing distillation data for small models, reproduction and ablation studies of open models.