Introduction
The current paradigm for training Large Language Models (LLMs) relies on massive, curated datasets. However, this "curation" is typically a static, one-time process—such as filtering for quality or deduplicating—that occurs before training begins. This approach suffers from two primary limitations: it assumes a model's data preferences remain constant throughout its development, and it evaluates data samples in isolation, ignoring the joint effects of samples within a training batch.
This paper introduces a Data Weighting Model (DWM) that addresses these gaps by dynamically adjusting the importance of training samples during the pre-training process. By employing a bi-level optimization framework, the DWM learns to prioritize different types of data as the LLM evolves, leading to superior performance and the ability to transfer weighting strategies across different model scales.
Methodology: Dynamic Bi-level Optimization
The core of the proposed approach is a Dynamic Bi-level Optimization framework that trains the DWM alongside the primary LLM. The process is structured as follows:
- Lower-Level Optimization: The LLM is trained on a batch of data where the loss of each sample is scaled by a weight provided by the DWM. This allows the DWM to directly influence the gradient direction of the LLM.
- Upper-Level Optimization: The DWM is optimized to maximize the LLM's performance on a separate validation set (specifically, the LAMBADA dataset). Using the chain rule, the DWM is updated based on how changes in data weights would have impacted the LLM's validation performance.
- Multi-stage Iteration: To maintain training stability and minimize computational overhead, the process is divided into discrete stages (e.g., five stages). The DWM is updated at the start of each stage and held fixed while the LLM trains for that segment, allowing the weighting strategy to evolve at key intervals.
The DWM itself is a small, separate module—based on a Llama-2 370M architecture in these experiments—that can be "plugged into" the training pipeline of significantly larger models.
Shifting Data Preferences
A key insight from this research is the observation of "shifting preferences" during training. In the early stages of pre-training, the DWM prioritizes data characterized by high-quality writing style. As the model matures, the DWM shifts its focus toward expertise and educational value. This suggests a pedagogical progression: once a model masters the structural nuances of language ("how" to speak), it requires more substantive, knowledge-dense information ("what" to say).
Experimental Results and Transferability
The authors evaluated the DWM framework using the SlimPajama dataset and the lm-evaluation-harness across nine benchmarks, including ARC, SciQA, and HellaSwag.
- Performance Gains: On a 370M parameter model trained on 30B tokens, DWM improved average zero-shot accuracy from 44.0% to 45.0% and two-shot accuracy from 45.1% to 46.4% compared to random selection. DWM-enhanced selection often outperformed or matched sophisticated static methods like DSIR.
- Model Transferability: One of the most significant findings is that a DWM trained on a small 370M model can be successfully applied to a 1.3B parameter model. In this transfer scenario, the DWM improved average two-shot performance from 47.6% to 48.7%.
- Efficiency: While the initial bi-level optimization is computationally intensive, applying a pre-trained DWM for forward-only inference adds only approximately 9% computational overhead. This overhead percentage decreases as the size of the target model increases, making it a scalable solution for large-scale training.
Conclusion
The Data Weighting Model demonstrates that how data is utilized during training is as critical as which data is selected. By allowing data importance to evolve dynamically, DWM provides a more nuanced and effective training regime than static filtering. Furthermore, the transferability of the DWM suggests a computationally feasible path for optimizing the training of massive LLMs by leveraging insights gained from smaller-scale experiments.
Summary updated