Pretraining a large language model (LLM) is like cooking a massive feast: the quality of the final dish depends entirely on the ratio of your ingredients. In the world of AI, these "ingredients" are data domains—code, math, web crawls, and academic papers.
While researchers have developed "regression-based" methods to find the perfect recipe, these methods often struggle as the number of ingredients grows. A new paper from researchers at the University of Warsaw and the University of Vienna, titled "LinMix: Data Mixing as Linear Domain Attribution," proposes a surprisingly simple fix: stop overcomplicating the math and start picking better samples.
TL;DR
LinMix simplifies LLM data mixing by treating it as a linear attribution problem. By sampling data mixtures at the "corners" (vertices) of the possible space rather than randomly in the middle, it enables a simple, interpretable linear model that significantly outperforms complex non-linear baselines, especially when scaling to hundreds of data domains.
What Problem Does This Paper Address?
To find the best data mix, state-of-the-art methods typically train a "swarm" of tiny proxy models on different random mixtures of data. They then fit a regression model to these results to predict how a full-scale model would perform on a specific benchmark (like math or coding).
However, current approaches face two major hurdles:
- Poor Experimental Design: Most use "Dirichlet sampling" to create their proxy mixes. This tends to cluster samples around the original data distribution, providing very little signal for the regression model to learn from—especially when dealing with hundreds of domains.
- Complexity vs. Interpretability: Because the sampling is poor, researchers often resort to complex, non-linear "black-box" models (like gradient-boosted trees) to find patterns. This makes it impossible to see why a specific domain is considered valuable.
Methods
The authors introduce LinMix, which shifts the focus from the regression model to the experimental design (how we choose the proxy mixes).
- Vertex Sampling: Instead of sampling randomly near the "average" mix, LinMix samples at the vertices of the feasible region. In practice, this means for any given proxy run, a domain is either at its maximum allowed "cap" or it is completely absent. This decorrelates the effects of different domains.
- Linear Attribution: Because the sampling is so spread out, the authors find that a simple linear model ($y \approx \beta^\top \pi$) is sufficient. The coefficients ($\beta$) act as "domain attributions," directly measuring the marginal contribution of each domain to the target benchmark.
- Hyperparameter-Free: Unlike Dirichlet sampling, which requires tedious tuning of "concentration" and "temperature" parameters to avoid failing in high-dimensional spaces, LinMix's vertex sampling works out of the box.
Datasets
The researchers tested LinMix across several scales:
- Corpus: The 200B-token WebOrganizer corpus (based on CommonCrawl), later extended with Nemotron-CC-Math and Stack-Edu for a total of 416B tokens.
- Domains: They tested both "coarse" (24 topics) and "fine-grained" (288 topic-format pairs) granularities.
- Models: Proxy models ranged from 30M to 100M parameters, with target models at 1B (OLMo2) and 4B (Qwen3.5) parameters.
- Evaluation: Benchmarks included ARC (science), HellaSwag (reasoning), MBPP (code), GSM8K (math), and the Common Pile (general loss).
Key Insights and Ideas
- The "Aha!" Moment for Linearity: The authors prove that if you sample the right points (the vertices), the relationship between domain weights and performance is remarkably linear. Complex non-linear models are often just compensating for poor data sampling.
- Dirichlet's High-Dimensional Failure: As the number of domains increases, Dirichlet sampling becomes increasingly likely to produce mixes that violate "caps" (limits on how much you can up-sample a domain). This leads to a "rejection" loop that forces samples to stay very close to the prior, starving the regression model of useful data.
- Interpretability is a Feature: Because LinMix uses a linear model, you get a clear heatmap of which domains help which tasks. For example, it clearly shows that "Math" and "Software Development" domains are up-weighted for coding tasks, while "Entertainment" is down-weighted.
Key Results
LinMix demonstrated substantial gains over state-of-the-art baselines like RegMix and OLMix:
- Specialized Tasks: On the 4B Qwen3.5 model, LinMix achieved a 46.1% relative gain on MBPP (coding) and a 31.6% gain on MATH compared to the best baseline.
- Scaling to 288 Domains: While Dirichlet-based methods saw their performance collapse as domains increased, LinMix improved benchmark accuracy by 11% on average over the best non-linear baseline.
- Robustness: As shown in Figure 3, the linear fit for LinMix remains highly accurate (high Spearman $\rho$) even with a small budget of proxy models, whereas Dirichlet-based methods fail to transfer as the domain count grows.
Limitations and Future Work
- Proxy Cost: Like all regression-based methods, LinMix requires training a "swarm" of small models. While the authors argue this is only ~4% of the total target model's compute cost, it is still a significant upfront investment.
- Single-Run Variance: The experiments rely on a single training run per target model. LLM training can be noisy, and future work could explore the variance of these optimized recipes.
- Non-linear Potential: The authors acknowledge that while a linear model is sufficient, combining vertex sampling with a non-linear model might yield even better results, a direction they leave for future research.
By returning to the fundamentals of experimental design, LinMix provides a more robust, scalable, and—most importantly—understandable way to "cook" the data for the next generation of AI.
Summary updated