ScaleBiO: Scalable Bilevel Optimization for LLM Data Reweighting

Rui Pan, Dylan Zhang, Hanning Zhang, Xingyuan Pan, Minrui Xu, Jipeng Zhang, Renjie Pi, Xiaoyu Wang, Tong Zhang

Abstract

Data quality and composition are critical to the performance of Large Language Models (LLMs), yet determining the optimal data mixture often relies on heuristic methods. Bilevel Optimization (BO) offers a theoretically grounded framework for data reweighting but has historically failed to scale beyond models with 1.5 billion parameters due to second-order derivative requirements. We present ScaleBiO, the first BO framework capable of scaling to models with over 30 billion parameters. By reformulating the nested optimization into a first-order minimax problem and integrating memory-efficient training techniques, ScaleBiO achieves significant performance gains across instruction following and mathematical reasoning tasks.

Introduction: The Data Mixture Dilemma

The success of state-of-the-art models like GPT-4 and Llama is largely attributed to high-quality training data. However, the process of selecting the right "mix"—balancing diverse sources like mathematical proofs, code, and conversational logs—remains an expensive trial-and-error process.

Bilevel Optimization (BO) provides a mathematical solution: an "inner" loop trains the model on weighted data, while an "outer" loop adjusts those weights based on performance on a high-quality validation set. Despite its elegance, standard BO requires calculating Hessians and Jacobians, making it computationally prohibitive for LLMs. Consequently, previous research was restricted to "toy" models with fewer than 1.5 billion parameters.

The ScaleBiO Approach

ScaleBiO bridges the gap between theoretical BO and massive-scale training through three primary innovations:

  1. Penalty-Based Reformulation: Instead of a nested loop, ScaleBiO reformulates the problem into a single-loop minimax problem. An auxiliary variable decouples inner and outer dependencies, allowing the optimization to proceed as a simultaneous "competitive game."
  2. Fully First-Order Hypergradient: By avoiding second-order information entirely, ScaleBiO reduces memory and compute requirements to levels comparable with standard first-order training.
  3. LISA Integration: To manage the memory footprint of 30B+ models, ScaleBiO incorporates Layer-wise Importance Sampling (LISA), enabling execution on standard hardware like 8×H100 GPU nodes.
Comparison of ScaleBiO against previous bilevel optimization methods, highlighting the leap in model scalability from 1.5B to 32B parameters.

Experimental Evaluation

The researchers evaluated ScaleBiO across multiple domains, including instruction following (~4.2M samples) and mathematical reasoning (~2.4M samples). Benchmarks included MT-Bench, GSM8K, and high-difficulty math competitions like AIME.

Key Results

ScaleBiO consistently outperformed established baselines, including uniform sampling, influence-aware filtering (LESS), and RHO-LOSS.

  • Instruction Following: On MT-Bench, ScaleBiO achieved a score of 7.12 for Llama-3-8B, a substantial improvement over the 6.11 achieved by uniform weighting.
  • Mathematical Reasoning: On GSM8K, accuracy improved by 1% to 9% across various models. Notably, ScaleBiO pushed Qwen-2.5-32B to 87.1% accuracy, a feat other scalable methods could not replicate due to memory constraints.
Performance comparison of ScaleBiO against baseline methods across different model architectures, showing superior scores on evaluation benchmarks.

Discussion and Insights

Beyond raw performance, ScaleBiO offers unique advantages for automated data curation:

  • Model-Specific Optimization: The "optimal" data mix is not universal; ScaleBiO identifies bespoke data ratios tailored to specific model families (e.g., Llama vs. Qwen).
  • Automatic Denoising: In controlled experiments, the framework successfully identified noisy or corrupted data, automatically assigning it near-zero weights without human intervention.
  • Efficiency: The minimax approach acts as a "helicopter" to the summit, reaching optimal weights significantly faster than traditional "winding road" BO approaches.

Conclusion and Future Work

ScaleBiO represents a significant milestone in making bilevel optimization practical for the LLM era. It is currently the only BO implementation capable of scaling to a 32B parameter model on a single node. While currently focused on fine-tuning, future iterations could extend to pre-training and multi-objective optimization (e.g., balancing accuracy with safety). The framework's ability to scale opens new avenues for automated, data-centric AI development.

Summary updated

BibTeX
@inproceedings{pan2025scalebio,
  author = {Rui Pan and Dylan Zhang and Hanning Zhang and Xingyuan Pan and Minrui Xu and Jipeng Zhang and Renjie Pi and Xiaoyu Wang and Tong Zhang},
  title = {{ScaleBiO: Scalable Bilevel Optimization for LLM Data Reweighting}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure