Why are Adaptive Methods Good for Attention Models?

Jingzhao Zhang, Sai Praneeth Karimireddy, Andreas Veit, Seungyeon Kim, Sashank J. Reddi, Sanjiv Kumar, Suvrit Sra

TL;DR

This paper reveals that the secret to Adam's success in attention models (like BERT) isn't just "adaptive learning rates," but its ability to handle heavy-tailed gradient noise. The authors prove that stochastic gradient descent (SGD) fails when gradient outliers are frequent and introduce ACClip, a coordinate-wise clipping algorithm that outperforms Adam on BERT pre-training and fine-tuning.

What Problem Does This Paper Address?

In the deep learning world, there is a curious schism: Stochastic Gradient Descent (SGD) is the gold standard for computer vision (e.g., ResNets), yet it fails miserably compared to adaptive methods like Adam when training attention-based models (e.g., Transformers).

Standard optimization theory usually assumes that gradient noise is "well-behaved"—meaning it follows a Gaussian-like distribution where extreme outliers are rare. However, this doesn't match the reality of training large language models. The authors set out to answer why SGD struggles with attention and whether the "adaptivity" in methods like Adam is actually a clever way of performing gradient clipping to ignore massive, noisy updates.

Methods

The researchers bridge the gap between theory and practice through three main contributions:

  1. Noise Analysis: They empirically measure the distribution of stochastic gradients. They find that while ResNet noise is concentrated (Gaussian), BERT noise is "heavy-tailed" (modeled by $\alpha$-stable distributions), meaning the optimizer frequently encounters gradients much larger than the average.
Comparison of gradient noise distributions and optimization trajectories for ImageNet vs. BERT.
  1. Theoretical Framework: They analyze convergence under a "Bounded $\alpha$-moment" assumption (where $1 < \alpha < 2$). This is a more relaxed—and realistic—condition than the standard "bounded variance" assumption. They provide the first tight upper and lower bounds for clipped gradient methods in this heavy-tailed regime.
  2. ACClip (Adaptive Coordinate-wise Clipping): Building on their theory, they propose a new algorithm. Unlike standard clipping which uses a fixed global threshold, ACClip:
  3. Operates coordinate-wise (clipping each dimension of the gradient independently).
  4. Uses an online moment estimator (an exponential moving average) to adapt the clipping threshold over time as the noise levels change during training.

Datasets

The authors validated their findings and the ACClip algorithm using:

  • ImageNet: Used with ResNet50 to demonstrate "well-behaved" noise.
  • Wikipedia + BooksCorpus: Used for BERT-base and BERT-large pre-training.
  • SQuAD v1.1: Used for BERT fine-tuning tasks.
  • PTB (Penn Treebank): Used for training a Transformer-XL model as a proof of concept.
  • Synthetic Data: They used synthetic Gaussian and Levy-stable noise to isolate the effects of noise distribution on optimization.

Key Insights and Ideas

  • The "Aha!" Moment on Noise: The paper demonstrates that heavy-tailed noise isn't just caused by the data (e.g., Wikipedia text); it is inherent to the Attention architecture itself. Even with synthetic Gaussian input, the attention mechanism produces heavy-tailed gradients.
  • SGD’s Fatal Flaw: In the presence of heavy tails, a single "outlier" gradient can be so large that it pushes the model parameters into a region of the loss landscape from which it cannot recover. SGD has no mechanism to "ignore" these kicks.
  • Clipping = Stability: The authors prove that clipping is not just a "hack"—it is theoretically optimal for heavy-tailed noise. It allows the optimizer to ignore the "wild" parts of the noise while still moving in the correct average direction.
  • Non-Stationarity: They observed that gradient noise in BERT is non-stationary; it starts very "wild" and becomes more concentrated as training progresses. This justifies why the clipping threshold needs to be adaptive (the "A" in ACClip).

Key Results

  • Superior Performance: ACClip consistently outperformed Adam. On BERT-base (12 layers), ACClip achieved a validation loss of 1.615 compared to Adam’s 1.718.
  • Downstream Success: On the SQuAD v1.1 benchmark, ACClip beat Adam across all model sizes (6, 12, and 24 layers) in both Exact Match (EM) and F1 scores. For example, on BERT-large, ACClip hit 84.93 EM vs. Adam's 83.94.
  • Theoretical Optimality: The authors proved that their clipping strategy achieves the mathematically "optimal" convergence rate for the heavy-tailed setting, matching the lower bounds they established.

Limitations and Future Work

  • Hyperparameter Sensitivity: While ACClip is powerful, it introduces new hyperparameters (like the EMA coefficients $\beta_1, \beta_2$) that might require tuning for different architectures.
  • Scope of "Attention": The paper focuses heavily on BERT/Transformers. It remains to be seen if other "hard-to-train" architectures (like certain GANs or RL agents) exhibit similar heavy-tailed noise and would benefit from ACClip.
  • Unified Theory: The authors suggest that popular methods like RMSProp and Adam can be re-interpreted as forms of adaptive clipping. A formal, unified theory linking all adaptive methods to clipping under heavy-tailed noise is a promising next step.

Summary updated

BibTeX
@inproceedings{zhang2020why,
  author = {Jingzhao Zhang and Sai Praneeth Karimireddy and Andreas Veit and Seungyeon Kim and Sashank J. Reddi and Sanjiv Kumar and Suvrit Sra},
  title = {{Why are Adaptive Methods Good for Attention Models?}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=CAGi364DjqM},
}
Figure