Weight Decay is a regularization method that pulls every weight toward 0 by a fixed fraction at each training update. Weights grow large only when truly needed to fit the training data, and the rest stay small. As a result, overfitting, where the model memorizes even the fine quirks of the training data, becomes less likely.
The idea of penalizing the size of the weights is old and has been in use since the late 1980s. In 1992, Krogh and Hertz explained theoretically why simple Weight Decay improves generalization and confirmed it with experiments on letter-to-phoneme data (NetTalk).
Weight Decay is often treated as the same thing as L2 regularization, which adds the sum of squared weights to the loss, and many libraries implement L2 regularization under the name "weight decay." However, in 2019 Loshchilov and Hutter showed that the two coincide only for plain SGD, not for optimizers such as Adam that adapt the step size per parameter. They proposed AdamW, which decouples weight shrinkage from the gradient computation. Today AdamW is widely used to train large models, starting with the Transformer.
The figure above compares where the weight-shrinking term enters for Adam with L2 regularization (left) and AdamW (right).

