Abstract
Averaging checkpoints along the training trajectory is a simple yet powerful approach to improve the generalization performance of Machine Learning models and reduce training time. Motivated by these potential gains, and in an effort to fairly and thoroughly benchmark this technique, we present an extensive evaluation of averaging techniques in modern Deep Learning, which we perform using AlgoPerf, a large-scale benchmark for optimization algorithms. We investigate whether weight averaging can reduce training time, improve generalization, and replace learning rate decay, as suggested by recent literature. Our evaluation across seven architectures and datasets reveals that averaging significantly accelerates training and yields considerable efficiency gains, at the price of a minimal implementation and memory cost, while mildly improving generalization across all considered workloads. Finally, we explore the relationship between averaging and learning rate annealing and show how to optimally combine the two to achieve the best performances.
Introduction
Training state-of-the-art deep learning models is notoriously resource-intensive. While the search for superior optimizers continues, a simple post-processing step—weight averaging (WA)—is often overlooked. WA involves averaging model weights across different points in the training trajectory rather than relying solely on the final checkpoint. Despite its origins in the 1980s, a rigorous, large-scale "stress test" of WA on modern architectures and industrial-strength benchmarks has been lacking. This study addresses whether WA can reduce training time, improve generalization, and its relationship with learning rate decay.
Methods
The evaluation focuses on two primary weight averaging techniques:
- Latest Weight Averaging (LAWA): Maintains a rolling window (circular queue) of the most recent model checkpoints and averages them.
- Exponential Moving Averaging (EMA): Maintains a running average where the influence of older weights decays exponentially over time.
The study utilizes AlgoPerf, a benchmark designed for a level playing field in optimization. WA was applied to heavily tuned baselines, including NadamW and Distributed Shampoo, across seven distinct architectures.
Experimental Setup
The AlgoPerf suite covers diverse real-world workloads:
- Criteo 1TB: Click-through rate prediction (DLRM).
- FastMRI: Medical image reconstruction (U-Net).
- ImageNet-1k: Image classification (Vision Transformer).
- OGBG: Graph-based prediction (GNN).
- WMT: Machine translation (Transformer-Big).
- LibriSpeech: Speech recognition (Conformer and DeepSpeech).
Results and Discussion
Efficiency and Convergence
Weight averaging consistently accelerates convergence across various tasks. As shown in Figure 1, models with WA reach validation targets significantly earlier than the baseline.
Quantitatively, WA resulted in an average 12% reduction in total GPU hours to reach target validation scores. On average, models reached performance targets using only 82% of the steps required by the baseline NadamW optimizer, as illustrated in Figure 2.
The "Proxy" Effect and Complementarity
A key insight is that WA acts as a proxy for a "cooled down" learning rate, allowing for smoother, less noisy weights. However, WA is not a complete replacement for learning rate (LR) annealing. The best performance is achieved by combining both: using a standard LR decay schedule and applying WA on top. Furthermore, WA is remarkably robust to hyperparameters, with a wide range of averaging windows (approx. 1% of the budget) yielding consistent gains.
Conclusion
Weight averaging is a highly efficient, optimizer-agnostic technique that provides a "free lunch" for deep learning training. While it cannot recover a failing run, it significantly enhances successful ones with minimal implementation and memory overhead. Future work may explore "schedule-free" algorithms that integrate averaging more deeply into the optimization step itself, potentially removing the need for manual learning rate schedules.
Summary updated