Introduction
Standard Large Language Model (LLM) pretraining typically involves uniform sampling from massive datasets, treating every token and sample with equal importance. This approach is computationally inefficient, as it spends significant resources on redundant or already-learned "easy" examples. While domain-level reweighting has shown promise, instance-level reweighting remains challenging due to the single-epoch nature of LLM training and the prohibitive cost of bilevel optimization at scale.
This paper introduces a zero-overhead, dynamic reweighting framework that adjusts sample importance on the fly based on their current loss. By down-weighting low-loss samples, the method accelerates convergence and improves downstream performance across models ranging from 124M to 7B parameters.
Methodology: Dynamic Shaping Functions
The proposed framework calculates the loss for each sample in a batch during the forward pass. These losses are normalized and passed through a shaping function to determine an importance weight before the backward pass.
The authors explore several strategies:
- LinUpper (Linear Upper-Bound): The primary strategy, which scales weights linearly with loss but caps them to avoid over-focusing on outliers or noise.
- Quadratic: Targets medium-loss samples by down-weighting both very easy and very hard instances.
- Extremes: Prioritizes both the highest and lowest loss samples.
A temperature parameter ($r$) acts as a curriculum, starting high to maintain diversity and decaying over time to allow for more aggressive filtering of redundant data. This approach adds virtually zero computational overhead as it reuses existing loss computations.
Key Results and Insights
The LinUpper strategy consistently outperforms uniform sampling. At the GPT-2 scale (300M), it achieved lower perplexity across most domains and improved few-shot reasoning. When scaled to Llama-sized models (1.4B and 7B), the benefits persisted, with a 7B model showing an average performance gain of +1.44% on language understanding tasks and +1.16% on QA benchmarks.
The results suggest that "easy" data becomes a drag on optimization once patterns are learned. Dynamic reweighting acts as an automated deduplication mechanism. Furthermore, the use of weight caps in LinUpper prevents the model from being derailed by the "hardest" samples, which in web-scale data are often noisy or malformed text.
Conclusion
Dynamic loss-based reweighting offers a simple yet powerful way to improve LLM pretraining efficiency. By focusing compute on high-signal data points without adding overhead, it provides a plug-and-play enhancement for standard training pipelines. Future work may extend these principles to adversarial training and other imbalanced learning contexts.
Summary updated