Decoupled Weight Decay Regularization

Ilya Loshchilov, Frank Hutter
11/14/2017
cs.LGcs.NEmath.OC

Official code: loshchil/AdamW-and-SGDW (300 stars, BSD-3-Clause, last commit 2019-01-09). 2 more implementations below.

Abstract

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

View on arXivView PDF

Code Implementations(3)

BSD-3-Clause

Decoupled Weight Decay Regularization (ICLR 2019)

30026LuaNov 7, 20177 years agoBSD-3-Clause
TensorFlow

AdamW optimizer for Keras

11634PythonJul 3, 20187 years ago
adamadamwkerasoptimizertensorflow
MIT

Implementation of AdamW and AdamWR Algorithms in caffe.

101C++, CudaJul 16, 20188 years agoMIT
adamwadamwrcaffesolver

Cite this paper

@article{loshchilov2017decoupled,
  title  = {Decoupled Weight Decay Regularization},
  author = {Ilya Loshchilov and Frank Hutter},
  year   = {2017},
  eprint = {1711.05101},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1711.05101}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1711.05101.svg)](https://codeofpaper.com/paper/1711.05101)

Discussion