papers / adamw2019
Next task →
Research Papers/Optimization foundations/Decoupled Weight Decay Regularization
Optimization foundations · #4 · seminal

Decoupled Weight Decay Regularization

Ilya Loshchilov, Frank Hutter · 2019 · ICLR
reproduction difficulty: lowOptimizationDeep Learning

1. Research problem

With adaptive optimizers, adding an L2 penalty to the loss is not equivalent to weight decay, so regularization strength implicitly depends on the gradient scaling.

2. Motivation

The authors wanted regularization whose effect is independent of the adaptive learning rate, making hyperparameter transfer between SGD and Adam reliable.

3. Previous approaches

Standard practice added lambda*||w||^2 to the loss for both SGD and Adam, inheriting a equivalence that only holds for plain SGD.

4. Core contribution

Showed analytically and empirically that L2 regularization in Adam is scaled by the adaptive denominator, and proposed AdamW, which applies weight decay as a separate parameter update.

5. Mathematical formulation

w_t = (1 - alpha*lambda)*w_{t-1} - alpha*m_hat/(sqrt(v_hat)+eps), i.e. decay is applied outside the adaptive gradient step.

6. Methodology

Theoretical decomposition of the Adam update under L2 regularization, followed by controlled hyperparameter-search experiments.

7. Architecture

Optimizer modification applicable to any network; tested on ResNets and transformers.

8. Experimental setup

Image classification with ResNet on CIFAR-10/ImageNet and language modeling with an LSTM/transformer on WikiText.

9. Datasets

CIFAR-10, ImageNet, WikiText-2, WikiText-103.

10. Results

AdamW matched or exceeded tuned SGD with momentum on image classification and gave better language-model perplexity than L2-regularized Adam.

11. Limitations

Does not resolve all of Adam's generalization gaps, and introduces a separate decay hyperparameter that still needs tuning; schedules interact with decay.

12. Critical analysis

A small algorithmic change with outsized practical impact, now the default optimizer for transformer pretraining; it exposes how poorly understood optimizer-regularization interactions were.

13. Implementation tasks

  • 1.Implement AdamW and Adam-with-L2 side by side and compare effective decay under different gradient scales.
  • 2.Tune weight decay for a small ResNet on CIFAR-10 and compare final test accuracy.
  • 3.Verify the equivalence of L2 and weight decay for plain SGD but not for Adam numerically.

14. Follow-up work

  • 1.Adam: A Method for Stochastic Optimization (Kingma and Ba, 2015)
  • 2.On the Convergence of Adam and Beyond (Reddi et al., 2019)

15. Open research questions

  • 1.How should weight decay be scheduled for very large pretraining runs?
  • 2.Does decoupled decay fully explain the generalization difference between Adam and SGD?
16. Reproduce it. Record the hypothesis, configuration, dataset, metrics and discrepancies in the Experiment Tracker. A reproduction is not complete until you have run the experiments, performed at least one ablation and documented the differences from the reported numbers.