Abstract
Training Large Language Models (LLMs) incurs significant cost; hence, any strategy that accelerates model convergence is helpful. In this paper, we investigate the ability of a simple idea—checkpoint averaging along the trajectory of a training run—to improve both convergence and generalization quite early on during training. Here we show that models trained with high learning rates observe higher gains due to checkpoint averaging. Furthermore, these gains are amplified when checkpoints are sampled with considerable spacing in training steps. Our training recipe, LAWA (LAtest Weight Averaging), outperforms conventional training and popular checkpoint averaging baselines such as exponential moving average (EMA) and stochastic moving average (SWA). We evaluate our training recipe by pre-training LLMs, where high learning rates are inherently preferred due to extremely large batch sizes. Specifically, we pre-trained nanoGPT-2 models of varying sizes (125M, 335M, and 770M) on the OpenWebText dataset. Additionally, we present results for publicly available Pythia LLMs (1B to 12B) trained on the PILE-deduped dataset.
Introduction: The Compute Wall and Learning Rates
The "compute wall" remains the primary obstacle in modern AI development. To train LLMs efficiently, engineers utilize massive batch sizes to maximize GPU saturation. However, large batches necessitate high learning rates (LR) to maintain optimization speed. This creates a trade-off: while high learning rates accelerate training, they often lead to "noisy" training trajectories and poorer generalization on unseen data.
Standard techniques like Stochastic Weight Averaging (SWA) typically only provide benefits at the very end of the training cycle, while Exponential Moving Average (EMA) can be slow to adapt to rapid changes in the training landscape. This research introduces a method to capture the benefits of weight averaging much earlier in the process, reducing the total tokens and compute hours required to reach target performance.
Methodology: LAtest Weight Averaging (LAWA)
The authors propose an adapted version of LAWA (LAtest Weight Averaging). Unlike traditional SWA, which is often triggered after 75% of training is complete, LAWA is designed to run throughout the training trajectory using a sliding window mechanism.
The Core Mechanism
- Sampling: Model checkpoints are saved periodically every $n$ steps.
- Averaging: At any point in training, the $k$ most recent checkpoints are averaged to produce the final model weights.
- Spacing ($\nu$): A critical innovation is the use of "distant" checkpoints. Rather than averaging consecutive checkpoints, the researchers found that spacing checkpoints by thousands of steps (the $k\_stepsize$ or $ u$) yields significantly better results.
Mathematically, this process acts as a post-hoc surrogate for learning rate decay. It allows the model to explore the loss landscape rapidly with a high LR, while the averaging process "settles" the weights into a flatter, more stable region of the landscape.
Key Insights: The Synergy of High LR and Spacing
A fascinating discovery of this work is that high learning rates are a feature, not a bug, when combined with weight averaging. Models trained with higher LRs exhibit more "diversity" in their checkpoints. When these diverse checkpoints are averaged, they cancel out noise more effectively than checkpoints from a low-LR run.
Furthermore, averaging checkpoints that are far apart in time is superior to averaging consecutive ones. For larger models, weights change more meaningfully over longer intervals; averaging these "stale" weights helps identify a more robust central point in the optimization space. This method also naturally smooths out "loss spikes"—sudden performance degradations common in large-scale training—by acting as a temporal buffer.
Experimental Results
The researchers validated LAWA across multiple scales, including nanoGPT-2 (125M to 770M parameters), the Pythia Suite (1B to 12B parameters), and even Diffusion Models (422M parameter UNet) to ensure the logic holds outside of language modeling.
Performance Gains
- Faster Convergence: LAWA-derived checkpoints reached the final perplexity of original training runs significantly earlier. For instance, a LAWA model at 105K steps often outperformed the original baseline at 141K steps.
- Compute Efficiency: For the Pythia-12B model, reaching specific performance thresholds with LAWA could save hundreds of A100 GPU hours.
- Zero-Shot Accuracy: On downstream tasks such as Lambada, SciQ, and ARC-easy, LAWA consistently improved accuracy. In several cases, a LAWA model trained on only half the data outperformed the full-run baseline.
Limitations and Future Work
The primary limitation identified is the "Phase Transition." LAWA is generally ineffective during the very early stages of training (the first ~8K steps). The model must first reach a state of "Linear Mode Connectivity"—where the path between different sets of weights is relatively flat—before averaging becomes beneficial.
Future research directions include applying LAWA to federated and continual learning scenarios, exploring weighted averaging schemes, and developing methods to automatically optimize window size ($k$) and spacing ($\nu$) during the training process.
Summary updated