Abstract
The performance of Large Language Models (LLMs) is heavily dependent on the composition of their pretraining data. Traditionally, the "recipe" for mixing diverse data domains—such as code, web text, and academic papers—has been determined through manual heuristics or computationally expensive trial-and-error. This paper discusses DoReMi (Domain Reweighting with Minimax Optimization), an algorithm that automates this process. By utilizing a small proxy model to minimize the worst-case excess loss across domains, DoReMi identifies optimal domain weights that transfer effectively to much larger models. Experimental results on The Pile and GLaM datasets demonstrate that DoReMi can accelerate training by over 2x and improve downstream accuracy by up to 6.5 percentage points without requiring downstream labels during the optimization phase.
Introduction
Pretraining LLMs involves processing trillions of tokens from disparate sources. The relative proportion of these sources, or the "data mixture," is a critical hyperparameter. A poor mixture can lead to models that excel in one area (e.g., casual conversation) but fail in others (e.g., mathematical reasoning). Despite its importance, determining the optimal mixture remains an ad-hoc process. DoReMi addresses this challenge by framing data selection as a minimax optimization problem, aiming for a balanced performance profile that benefits all domains.
The Challenge of Data Composition
Current approaches to data weighting typically rely on simple heuristics—such as weighting Wikipedia more heavily than raw web crawls—or "grid searches" where multiple small models are trained on different mixtures to see which performs best on specific benchmarks. These methods are problematic for two reasons:
- Inconsistency: Heuristics are subjective and may not reflect the actual information density of a domain.
- Overfitting: Tuning mixtures based on specific downstream tasks risks creating a model that is specialized rather than general-purpose.
The DoReMi Methodology
DoReMi introduces a structured, three-step workflow to derive optimal domain weights:
1. Training a Reference Model
First, a small reference model (e.g., 280M parameters) is trained on a baseline data mixture (e.g., a uniform distribution or a standard heuristic mixture). This model provides a performance baseline for each domain.
2. Minimax Optimization via Group DRO
The core of DoReMi is the training of a "proxy" model using Group Distributionally Robust Optimization (Group DRO). Instead of minimizing the average loss across all data, the proxy model focuses on minimizing the worst-case excess loss.
Excess loss is defined as the difference between the proxy model's current loss and the reference model's loss. By focusing on excess loss rather than raw loss, the algorithm accounts for the inherent difficulty of different domains (e.g., code typically has higher raw perplexity than prose). During training, the algorithm dynamically increases the weights of domains where the proxy model is underperforming relative to the reference model.
3. Large-Scale Training
The domain weights derived from the proxy model are averaged over the run and used to resample the dataset. Finally, a full-scale model (e.g., 8B parameters) is trained from scratch using this optimized "recipe."
Experimental Results
The authors tested DoReMi using two large-scale datasets: The Pile (22 domains) and the GLaM dataset (8 domains), evaluating performance on standard benchmarks like TriviaQA, NaturalQuestions, and LAMBADA.
Efficiency and Speedup
One of the most significant findings is the efficiency of the optimization. The weights discovered using a 280M parameter proxy model transferred seamlessly to an 8B parameter model—a 30x increase in scale. The compute overhead for this optimization was only 8% of the total training budget. On The Pile, the 8B model trained with DoReMi reached the same downstream accuracy as the baseline model 2.6x faster.
Performance Gains
DoReMi consistently outperformed baseline mixtures:
- Accuracy: On The Pile, average few-shot downstream accuracy increased by 6.5 percentage points.
- Perplexity: Surprisingly, DoReMi reduced log-perplexity across all 22 domains of The Pile, even those that received lower weights in the final mixture. This suggests that the optimized mixture fosters "positive transfer," where the model learns fundamental patterns more effectively across the entire dataset.
- Task Agnosticism: On the GLaM dataset, DoReMi's task-agnostic weights matched the performance of mixtures that had been manually tuned using downstream task labels.
Discussion and Limitations
DoReMi demonstrates that the "data recipe" is as important as model architecture or scale. By focusing on the domains where a model has the most room to improve, researchers can create more robust and efficient LLMs.
However, several areas remain for future exploration:
- Domain Definition: The current method relies on pre-defined domain labels (e.g., "GitHub"). Automated clustering could potentially identify more nuanced data sub-types.
- Reference Sensitivity: The initial mixture used for the reference model may influence the final outcome, necessitating further study on "optimal" reference starting points.
- Extreme Scaling: While transferability was proven at 8B parameters, further research is needed to confirm if these weights hold for models with hundreds of billions of parameters.
Conclusion
DoReMi provides a principled, automated, and computationally efficient way to optimize data mixtures for LLM pretraining. By moving away from heuristics and toward minimax optimization, it offers a path to faster training and more capable general-purpose models.
Summary updated