# AdamW (2017)

> Shows that L2 regularization and weight decay differ in Adam, and that decaying weights directly makes Adam generalize nearly as well as SGD.

Page: https://mralbu.github.io/ai-datasets/p/adamw

## Key facts

- Title: Decoupled Weight Decay Regularization
- Authors: Ilya Loshchilov, Frank Hutter
- Venue: ICLR 2019
- Category: Foundations
- Paper: https://www.alphaxiv.org/abs/1711.05101

## Why it matters

Adam had a reputation for training fast but generalizing worse than SGD; a large part of that turned out to be a regularization bug copied into every library. With the fix, AdamW and a cosine schedule became the standard recipe for Transformers, from GPT and BERT to today's large language models.

## The idea

With plain SGD, adding an L2 penalty to the loss is the same as shrinking every weight a little at each step. In Adam it is not: the penalty's gradient gets divided by each weight's running gradient size, so the weights with the largest gradients are barely regularized. AdamW takes the decay out of the gradient and shrinks the weights directly, separately from Adam's update. That also makes the best weight decay independent of the learning rate.

## The result

On CIFAR-10 and a 32×32-pixel version of ImageNet, AdamW cut Adam's test error by about 15% relative, closing most of the gap to SGD with momentum. The best learning rate and weight decay could be tuned one at a time, and a cosine learning-rate schedule helped Adam much more than expected.

## The data

- [CIFAR-10 (2009)](https://mralbu.github.io/ai-datasets/d/cifar10.md): 60,000 tiny 32×32 color images in 10 classes.
- [ImageNet (ILSVRC) (2009)](https://mralbu.github.io/ai-datasets/d/imagenet.md): 1.28 million photos across 1,000 classes, the dataset behind the deep learning boom.

## Builds on

- [Adam (2014)](https://mralbu.github.io/ai-datasets/p/adam.md)

## Led to

- [Muon (2025)](https://mralbu.github.io/ai-datasets/p/muon.md)

## Part of

- [Optimizers](https://mralbu.github.io/ai-datasets/t/optimizers.md) (step 4 of 7)
