Fast Data Mixture Optimization via Gradient Descent

Haoru Tan, Sitong Wu, Yanfeng Chen, Jun Xia, Ruobing Xie, Bin Xia, Xingwu Sun, Xiaojuan QiICLR 2026

TL;DR

FastMix is a novel framework that automates the search for the optimal "data recipe" (mixture ratios) for Large Language Model (LLM) training using a single proxy model and gradient descent. By reformulating data sampling into a differentiable optimization problem, FastMix achieves state-of-the-art performance while being up to 550x faster than previous methods—reducing search time from hundreds of GPU-hours to just over one.

What Problem Does This Paper Address?

The performance of LLMs depends heavily on the "data mixture"—the specific ratio of different datasets (e.g., 10% code, 40% web text, 20% math) used during training. Finding the optimal balance is a significant open problem for researchers.

Currently, teams rely on two main strategies:

  1. Manual Trial-and-Error: Human experts guess ratios based on heuristics, which is slow, unscientific, and often sub-optimal.
  2. Proxy-based Search: Methods like RegMix or CLIMB train hundreds of tiny "proxy" models under different ratios to identify the best performer. While effective, this is computationally expensive, often requiring hundreds of GPU-hours just to find the recipe before the actual training even begins.

The authors tackle the central question: How can we efficiently determine effective data mixtures for large-scale training without the prohibitive overhead of training hundreds of models?

Methods

The core innovation of FastMix is a mathematical "reparameterization" that turns data selection into a bilevel optimization problem solvable via gradient descent.

  • The "Aha" Moment: Usually, data mixtures are treated as sampling probabilities, which are non-differentiable. FastMix proves that optimizing these ratios is mathematically equivalent to assigning per-source loss weights while sampling data uniformly.
  • Bilevel Optimization: The framework uses two alternating optimization loops:
  • Inner Loop: Updates the model's parameters on training data using the current mixture weights.
  • Outer Loop: Updates the mixture weights based on feedback from a validation set.
  • Gradient Alignment: The mixture weights are updated by evaluating the "alignment" between a specific data source's training gradient and the overall validation gradient. If a source's updates help reduce validation loss, FastMix automatically increases that source's weight.
  • Regularization: To prevent the model from "collapsing" (putting all weight on just one dataset), the authors employ entropy-based regularization to ensure a diverse data mix.

Datasets

The authors evaluated FastMix across both pre-training and post-training (Supervised Fine-Tuning, or SFT) scenarios:

  • Pre-training: They used The Pile (17 uncopyrighted subsets). The search target was the Pile-cc subset, and they evaluated the resulting 1B-parameter model on 14 downstream benchmarks, including HellaSwag, Social IQA, and PiQA.
  • Post-training (SFT): They optimized mixtures for a Qwen2.5-7B model across 8 domains, including OpenR1-Math-220k (Math), OpenThoughts-114K (Code), ShareGPT (Dialogue), and Platypus (STEM).
  • Evaluation: Benchmarks included GSM8K and gaokao2023en for math, LiveCodeBench for coding, and GPQA-Diamond for STEM.

Key Insights and Ideas

  • Efficiency through Differentiability: By making the mixture weights differentiable, the authors can use standard optimizers (like SGD or Adam) to find the best data mix, eliminating the need to train hundreds of separate models.
  • Single Proxy Power: FastMix only requires one proxy model. This makes it significantly more scalable as models and datasets grow.
  • Generalization: The data mixtures found on small proxy models (e.g., 1M or 1B parameters) transfer remarkably well to much larger models (7B+), suggesting that "data quality" signals remain consistent across scales.
  • Stability: Ablation studies demonstrated that FastMix is robust to different random initializations, consistently finding high-performing mixtures regardless of the search's starting point.

Key Results

FastMix dominates existing baselines in both speed and accuracy across pre-training and post-training phases.

Performance vs. Time-cost comparison
  • Pre-training Speedup: FastMix completed its search in just 1.3 GPU-hours. For comparison, RegMix took ~720 hours (550x slower) and CLIMB took ~72 hours (55x slower).
  • Pre-training Performance: It achieved an average score of 48.2 across 14 benchmarks, outperforming CLIMB (47.5) and RegMix (47.2).
Detailed downstream task performance and search cost for pre-training
  • Post-training (SFT) Gains: In the SFT setting, FastMix reached a score of 65.4, a massive +5.5 point gain over the next best method, while finishing the search in 2.2 hours (vs. 115+ hours for competitors).

Limitations and Future Work

  • Static vs. Dynamic: Currently, FastMix optimizes a static mixture that remains constant throughout training. The authors suggest that future work could explore dynamic mixtures (curriculum learning) where the data recipe evolves as the model learns.
  • Proxy Objective Dependency: When the validation metric is non-differentiable (like raw accuracy), FastMix requires a differentiable "proxy" objective (like SFT loss). While effective, the choice of this proxy is crucial to the framework's success.
  • Outer-loop Horizon: The mathematics are most stable when the mixture is updated after every single model update. Longer horizons (waiting many steps before updating the recipe) currently lead to numerical instability or high memory costs.

Summary updated

BibTeX
@inproceedings{tan2026fast,
  author = {Haoru Tan and Sitong Wu and Yanfeng Chen and Jun Xia and Ruobing Xie and Bin Xia and Xingwu Sun and Xiaojuan Qi},
  title = {{Fast Data Mixture Optimization via Gradient Descent}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=5gFKVyohGd},
}
Figure