Aioli: A Unified Optimization Framework for Language Model Data Mixing

Mayee F. Chen, Michael Y. Hu, Nicholas Lourie, Kyunghyun Cho, Christopher Ré

Abstract

Language model performance depends on identifying the optimal mixture of data groups to train on (e.g., law, code, math). Prior work has proposed a diverse set of methods to efficiently learn mixture proportions, ranging from fitting regression models over training runs to dynamically updating proportions throughout training. Surprisingly, we find that no existing method consistently outperforms a simple stratified sampling baseline in terms of average test perplexity. To understand this inconsistency, we unify existing methods into a standard framework, showing they are equivalent to solving a common optimization problem: minimize average loss subject to a method-specific mixing law -- an implicit assumption on the relationship between loss and mixture proportions. This framework suggests that measuring the fidelity of a method's mixing law can offer insights into its performance. Empirically, we find that existing methods set their mixing law parameters inaccurately, resulting in the inconsistent mixing performance we observe. Using this insight, we derive a new online method named Aioli, which directly estimates the mixing law parameters throughout training and uses them to dynamically adjust proportions. Aioli outperforms stratified sampling on 6 out of 6 datasets by an average of 0.27 test perplexity points, whereas existing methods fail to consistently beat stratified sampling, doing up to 6.9 points worse. Moreover, in a practical setting where proportions are learned on shorter runs due to computational constraints, Aioli can dynamically adjust these proportions over the full training run, consistently improving performance over existing methods by up to 12.012 test perplexity points.

Introduction

Training a Large Language Model (LLM) requires balancing diverse data sources—such as code, mathematics, legal documents, and web crawls. The proportions of these "ingredients" significantly impact the final model's quality. Current practitioners typically use either offline methods, which run small-scale experiments to predict static mixtures, or online methods, which dynamically adjust proportions during the main training run.

However, empirical analysis reveals a surprising trend: none of these existing methods consistently outperform stratified sampling (a simple uniform baseline). This inconsistency suggests that current algorithms rely on flawed assumptions or inaccurate parameters. To address this, we introduce a unified theory to explain the performance of data-mixing strategies and propose a new, more robust method.

Overview of the Aioli framework: (1) Unifying existing methods under Linear Mixing Optimization, (2) analyzing the fidelity of mixing laws, and (3) introducing the Aioli method for dynamic parameter estimation.

A Unified Framework: Linear Mixing Optimization

We propose the Linear Mixing Optimization (LMO) framework, which demonstrates that most existing data-mixing methods (e.g., DoReMi, Skill-it, DoGE) are solving the same underlying optimization problem. These methods aim to minimize average loss subject to a "mixing law"—an assumption that the change in loss is a (log)-linear function of the mixture proportions.

Our analysis shows that while the "mixing law" assumption itself is valid (with $R^2$ values often exceeding 0.9), existing methods fail because they set their internal parameters inaccurately. Specifically, they often overlook cross-domain interactions—how training on one domain (like code) might improve performance on another (like math).

The Aioli Method

Building on the LMO framework, we developed Aioli, an online mixing method designed to overcome the parameter mismatch of previous approaches. Aioli stands out through three key features:

  • Parameter Estimation (LEARNPARAMS): Instead of pre-defining interaction parameters, Aioli allocates a small fraction ($\delta$) of each training round to "interleave" different data mixtures. This allows the model to observe real-time changes in loss and estimate the mixing law parameters directly.
  • Exponentiated Gradient Descent (EGD): Aioli uses these estimated parameters to greedily update data proportions, ensuring the model continuously moves toward the optimal mixture.
  • Efficiency: Unlike competitors that require expensive auxiliary "proxy models" or "reference runs," Aioli learns the optimal mix during the actual training process, requiring zero extra runs.

Experimental Results

We evaluated Aioli using the SlimPajama dataset across various scales and configurations, including small-scale mixes, full-scale mixes (7 domains), and instruction tuning tasks.

Performance and Scalability

In unrestricted settings, Aioli outperformed stratified sampling on 6 out of 6 datasets, achieving an average test perplexity improvement of 0.27 points. In contrast, popular existing methods often performed worse than the simple baseline.

Aioli also proved highly effective in "restricted" settings, where training begins with a sub-optimal mix derived from a short run. By dynamically adjusting proportions mid-stream, Aioli improved performance in 28 out of 30 cases, with gains reaching up to 12.012 perplexity points. These results scaled effectively from 160M parameter models to 1.4B parameter models.

Conclusion and Future Directions

Aioli provides a theoretically grounded and empirically superior approach to data mixing. By unifying existing methods under the LMO framework, we identified that accurate parameter estimation is the primary bottleneck in current strategies.

While Aioli is highly effective, it does introduce some inference overhead due to repeated validation set evaluations. Future work could focus on mitigating this cost through data subsetting. Additionally, while this framework assumes pre-defined data groups, future research could explore automated data partitioning and the direct integration of downstream task signals into the mixing law to further bridge the gap between perplexity and task-specific performance.

Summary updated

BibTeX
@inproceedings{chen2025aioli,
  author = {Mayee F. Chen and Michael Y. Hu and Nicholas Lourie and Kyunghyun Cho and Christopher Ré},
  title = {{Aioli: A Unified Optimization Framework for Language Model Data Mixing}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=sZGZJhaNSe},
}
Figure