Data Mixing Laws: Optimizing Data Mixtures by Predicting Language Modeling Performance

Jiasheng Ye, Peiju Liu, Tianxiang Sun, Jun Zhan, Yunhua Zhou, Xipeng Qiu

Pretraining a Large Language Model (LLM) is akin to following a complex recipe where the "ingredients" are diverse data domains—web text, code, academic papers, and more. While the ratio of these ingredients (the data mixture) critically dictates the final model's capabilities, finding the perfect recipe has historically relied on intuition, heuristics, or expensive trial-and-error.

Published at ICLR 2025, researchers from Fudan University and Shanghai AI Lab introduce a quantitative framework that demystifies this process. They demonstrate that model performance isn't just a random outcome of data composition; it follows predictable mathematical laws. By combining these "Data Mixing Laws" with standard scaling laws, they have created a pipeline to find the optimal data mix for large models using only small-scale, low-cost experiments.

We already rely heavily on "scaling laws" to predict how performance improves as we add more compute or parameters. However, the field has lacked a quantitative method to predict how performance shifts when varying the composition of the training data. This paper bridges that gap, turning data mixing from an art into a predictable science.

Discovering Data Mixing Laws

The core contribution of this research is the formulation of Data Mixing Laws. The authors discovered that the loss on a specific domain $i$ can be accurately predicted using an exponential function of the proportions of all training domains $r_j$:

$$L_i(r_1...M) = c_i + k_i \exp \left( \sum_{j=1}^M t_{ij} r_j \right)$$

To make this practical for large-scale training without prohibitive compute costs, the researchers developed a three-step nested pipeline:

  1. Training Step Laws: Predict how a small model's performance will improve with more training steps.
  2. Model Size Laws: Predict how performance scales as the model's parameter count increases.
  3. Data Mixing Laws: Predict performance for any unseen mixture proportion at scale.
The three-step pipeline uses nested scaling laws to predict the performance of large models on unseen mixtures from small-scale runs.

Crucially, the team also introduced Implicit Domain Aggregation. This technique allows them to optimize for a general validation set (like a benchmark of "real-world queries") even without knowing its exact domain composition. It works by treating the validation set as a mixture of "implicit" predictable domains and learning their proportions end-to-end.

Key Insights and Empirical Evidence

The researchers validated their findings across major datasets including The Pile, RedPajama, and Python Code. Their experiments yielded several critical insights:

  • Quantitative Predictability: The most significant breakthrough is that data mixture effects are mathematically predictable. When viewed on a log scale, reducible loss on a domain shows a clear linear correlation with domain proportions.
  • Domain Interactions: The laws successfully capture how domains interact. Some domains exhibit facilitation (training on one improves performance on the other), while others might conflict. The coefficients ($t_{ij}$) in their formula explicitly model these cross-domain synergies.
  • Small-to-Large Transfer: You don't need to train a massive 70B parameter model to find its ideal data mix. Experiments on models as small as 70M parameters provide enough signal to predict the optimal mixture for much larger models.
  • Avoiding Catastrophic Forgetting: In continual pretraining scenarios, these laws can identify the "critical mixture proportion"—the exact minimum amount of old data needed to prevent catastrophic forgetting while the model learns new skills.
Reducible loss on specific domains shows a predictable linear relationship with training proportions when plotted on a log scale.

Results and Efficiency Gains

The practical benefits of this framework are substantial. In a primary large-scale experiment optimizing a 1B parameter model trained on 100B tokens of RedPajama, the results were striking:

  • Faster Convergence: The model trained on the optimized mixture achieved the same performance as the default mixture using just 73% of the training steps.
  • Higher Ceiling: When trained for the full 100B tokens, the optimized mix reached a performance level that would have required 48% more training steps on the default mixture.
  • State-of-the-Art Optimization: The proposed method consistently outperformed other leading data mixing algorithms, such as DoGE and DoReMi, in finding the mixture that minimizes validation loss.

Limitations and Future Outlook

While groundbreaking, the framework has areas for future refinement. Currently, the concept of a "domain" is tied to dataset sources (e.g., "GitHub" or "Wikipedia"). Moving toward more granular, semantically defined domains via clustering could yield even sharper optimizations. Additionally, because the pipeline is "nested," small errors in predicting step or size scaling can accumulate, occasionally leading to an underestimation of the final loss.

Looking ahead, this work lays the foundation for dynamic data schedules. Rather than finding a single fixed "best" mixture, these laws could eventually guide training regimens where the data mixture dynamically shifts throughout the training process, maximizing learning efficiency at every single stage of an LLM's development.

Summary updated

BibTeX
@inproceedings{ye2025data,
  author = {Jiasheng Ye and Peiju Liu and Tianxiang Sun and Jun Zhan and Yunhua Zhou and Xipeng Qiu},
  title = {{Data Mixing Laws: Optimizing Data Mixtures by Predicting Language Modeling Performance}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=jjCB27TMK3},
}
Figure