[Paper Review] Decoupled Weight Decay Regularization
The paper shows L2 regularization is not equivalent to weight decay for adaptive optimizers like Adam, proposes decoupled weight decay (AdamW/SGDW), and demonstrates improved generalization and easier hyperparameter tuning.
L$_2$ regularization and weight decay regularization are equivalent for standard stochastic gradient descent (when rescaled by the learning rate), but as we demonstrate this is \emph{not} the case for adaptive gradient algorithms, such as Adam. While common implementations of these algorithms employ L$_2$ regularization (often calling it "weight decay" in what may be misleading due to the inequivalence we expose), we propose a simple modification to recover the original formulation of weight decay regularization by \emph{decoupling} the weight decay from the optimization steps taken w.r.t. the loss function. We provide empirical evidence that our proposed modification (i) decouples the optimal choice of weight decay factor from the setting of the learning rate for both standard SGD and Adam and (ii) substantially improves Adam's generalization performance, allowing it to compete with SGD with momentum on image classification datasets (on which it was previously typically outperformed by the latter). Our proposed decoupled weight decay has already been adopted by many researchers, and the community has implemented it in TensorFlow and PyTorch; the complete source code for our experiments is available at https://github.com/loshchil/AdamW-and-SGDW
Motivation & Objective
- Motivate the study: adaptive gradient methods generalize poorly compared to SGD with momentum on image tasks.
- Show that L2 regularization is inequivalent to weight decay for adaptive optimizers.
- Propose decoupled weight decay as a fix and analyze its impact on generalization and hyperparameter tuning.
Proposed method
- Define weight decay as a decoupled step from gradient-based updates (Algorithm 1 SGDW).
- Extend the decoupling idea to Adam to form AdamW (Algorithm 2).
- Provide theoretical propositions showing inequivalence of L2 and weight decay for adaptive methods (Propositions 2 and 3).
- Justify decoupled weight decay via Bayesian filtering perspective (Aitchison 2018).
- Empirically compare Adam, AdamW, SGD, and SGDW on CIFAR-10, CIFAR-100, and ImageNet32x32 with various learning rate schedules.
Experimental results
Research questions
- RQ1Does L2 regularization equate to weight decay for adaptive gradient methods like Adam?
- RQ2Does decoupling weight decay from gradient updates improve generalization for Adam?
- RQ3How do learning rate schedules interact with decoupled weight decay in SGD/Adam?
- RQ4Is hyperparameter tuning easier when using decoupled weight decay?
Key findings
- L2 regularization is not equivalent to weight decay for adaptive gradient methods like Adam.
- AdamW with decoupled weight decay yields substantially better generalization than Adam with L2 regularization, achieving around 15% relative improvement in test error on tested datasets.
- Decoupling weight decay from the gradient update decouples the learning rate and weight decay hyperparameters, making hyperparameter tuning more separable.
- Cosine annealing and warm restarts enhance the performance of AdamW and SGDW, reducing the gap to SGD with momentum.
- AdamW reports better generalization across CIFAR-10, CIFAR-100, and ImageNet32x32, and AdamWR improves anytime performance significantly.
Better researchstarts right now
From paper design to paper writing, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.