Abstract
In deep learning, a persistent performance gap exists between the optimization strategies preferred for computer vision and those for natural language processing. While Stochastic Gradient Descent (SGD) remains the gold standard for ImageNet, adaptive methods like Adam are essential for training Transformers. This paper identifies the root cause as the distribution of gradient noise: whereas vision models exhibit Gaussian-like noise, attention mechanisms generate heavy-tailed noise. We provide theoretical convergence bounds for clipped gradient methods under these conditions and propose ACClip, an adaptive coordinate-wise clipping algorithm that achieves state-of-the-art performance on BERT pre-training and fine-tuning.
Introduction: The Optimizer Divide
For years, the machine learning community has observed a "curious divide" in optimizer performance. On standard benchmarks like ImageNet, well-tuned SGD often matches or exceeds the performance of adaptive methods. However, when training attention-based models like BERT, SGD frequently fails to converge or performs significantly worse than Adam.
This paper identifies the specific culprit: the distribution of noise in stochastic gradients. While ImageNet gradients are "well-behaved" and concentrated around the mean, BERT gradients are "heavy-tailed." In such distributions, extreme outliers are common, causing standard SGD to be knocked off track by massive, infrequent gradient spikes.
The Culprit: Heavy-Tailed Gradient Noise
The researchers empirically compared the gradient noise of ResNet (on ImageNet) and BERT (on Wikipedia). They found that BERT's noise follows a power-law-like distribution. Interestingly, this volatility is not just a property of the data but of the architecture itself; attention mechanisms seem to generate more volatile gradients than convolutional layers, even when processing synthetic Gaussian data. Furthermore, in BERT training, the scale of gradient noise is non-stationary, changing drastically as training progresses.
Theoretical Foundations and ACClip
Theoretically, the authors provide the first tight upper and lower convergence bounds for clipped gradient methods under heavy-tailed noise. They prove that while standard SGD can fail to converge in these settings, clipping the gradients restores stability and achieves optimal convergence rates.
Building on this theory, the authors propose ACClip (Adaptive Coordinate-wise Clipping). Unlike global clipping, which scales the entire gradient vector, ACClip performs coordinate-wise clipping. It utilizes online moment estimation (an exponential moving average) to adapt the clipping threshold dynamically, allowing the optimizer to handle the non-stationary noise levels inherent in Transformer training.
Key Results
The authors validated ACClip across several industry-standard benchmarks:
- BERT Pre-training: ACClip achieved lower validation loss and higher Masked LM accuracy than Adam across BERT-Base and BERT-Large architectures.
- SQuAD Fine-tuning: On the SQuAD v1.1 dev set, ACClip consistently outperformed Adam in both Exact Match (EM) and F1 scores. For BERT-Large, ACClip reached an F1 of 91.40 vs. Adam's 90.87.
- Theoretical Optimality: The clipping strategy was mathematically proven to hit the theoretical lower bound for convergence under heavy-tailed noise, suggesting it achieves the best possible rate for these conditions.
Conclusion and Future Work
The primary reason adaptive methods like Adam work for Transformers is their inherent ability to act as a sophisticated form of coordinate-wise clipping. By formalizing this through ACClip, the authors provide a more stable and effective optimizer for heavy-tailed settings. Future work remains to determine the exact mathematical reason why attention operations (like softmax dot-products) induce these heavy tails and to explore if other popular optimizers can be re-analyzed through the lens of adaptive clipping.
Summary updated