What Weight Decay Really Does
Scale invariance, effective learning rates and rotational equilibrium: why decay matters when it barely regularizes.
In a network with normalization layers, multiplying a layer's weights by ten changes nothing the network computes, so a penalty on their size cannot be shaping the function directly. Yet taking weight decay away still hurts. This lesson derives what decay does instead: it sets the effective learning rate, drives normalized weights into a rotational equilibrium that turns them by about radians per step, and in language-model training stabilizes optimization where there is nothing to overfit.
What you’ll learn
- Contrast the classical readings of weight decay with what it does in normalized networks, and derive the effective per-coordinate penalty of AdamW versus an term inside Adam.
- Prove that scale invariance implies and , and derive the norm growth and the shrinking effective learning rate of SGD without decay.
- Derive the equilibrium norm and the equilibrium angular update , and the exact equivalence of decay with an exponentially growing learning rate (Li & Arora, 2020).
- Explain the intrinsic learning rate , the timescale and AdamW's moving-average view, and what decay does in single-pass language-model training.
- Apply the practical conventions: which parameters to decay, how decay couples to the learning-rate schedule, and its role in grokking.
Three classical readings, and a decoupling
Weight decay has three classical readings. As a penalty, it adds to the loss. As a prior, it is MAP estimation under with . As capacity control, small weight norms mean a small function class, which norm-based generalization bounds turn into guarantees (Generalization Bounds for Deep Networks). For linear networks, Krogh and Hertz (1992) showed that decay suppresses the components of the weights that the target does not need and, if well tuned, reduces the effect of noise in the targets.
All three readings assume that the size of the weights shapes the function. Before showing why that is often false in modern networks, finish the story of how decay enters adaptive optimizers. The Representation lesson showed that an term inside Adam decays coordinate at the rate per step. Fixed points tell the other half.
With the penalty inside Adam's gradient, a stationary point needs the averaged gradient of to vanish: the fixed points are those of plain , even though the path decays coordinates unevenly.
AdamW updates . At a stationary point , so
With frozen, this is the stationary condition of an penalty whose strength differs per coordinate:
So AdamW is not a uniform penalty either: it penalizes coordinates with a large gradient scale more. Loshchilov and Hutter (2019) proved that no coefficient reproduces decoupled decay when the preconditioner is not a multiple of the identity, and found the decoupled form generalized better. Why it is better is a separate question; Kosson, Messmer and Jaggi (2024) give an answer in terms of normalized layers, developed below.
Scale invariance
Batch normalization standardizes each unit's pre-activation over the batch; layer normalization and RMSNorm standardize a layer's whole pre-activation vector. Either way, scaling the weights that feed the normalization scales the pre-activations, and the normalization undoes it. For a unit followed by batch norm, its incoming weights satisfy for every ; for layer norm the same holds for the whole weight matrix together with its bias, up to the small constant inside the normalization. This is scale invariance.
(i) The function is constant, so its derivative vanishes; at it is the radial derivative:
(ii) Differentiate the identity with respect to by the chain rule, and (iii) once more:
So the gradient is always tangent to the sphere through , and the further is from the origin, the flatter the loss looks: the same function, seen at a larger radius, has gradients scaled by and curvature by .
Take an SGD step . Since , Pythagoras gives a norm that can only grow:
Write , where is the gradient at the unit vector (property ii). The direction turns by an angle of about , so on the sphere SGD runs with an effective learning rate
Feed this back into the norm. With and a roughly constant , the increments are , so :
Without decay, normalized weights grow like and their effective learning rate decays like , a hidden schedule that in the long run does not even depend on . In normalized networks the weight norm matters only through the effective learning rate (van Laarhoven, 2017; Hoffer et al., 2018).
Two copies of a batch-normalized network compute the same function, but in copy B every weight vector that feeds a batch-norm layer is 10 times longer. Both are trained with SGD at the same learning rate. How do their steps compare?
- Identical, since the networks compute the same function
- B's gradients are 10 times smaller and its directions turn about 100 times more slowly
- B's gradients are 10 times larger, so it trains faster
- B's gradients are 100 times smaller but its directions turn at the same rate
Show the answer
B. B's gradients are 10 times smaller and its directions turn about 100 times more slowly
By , B's gradients are 10 times smaller, and the angle turned per step, , is times smaller: B trains as if its learning rate were .
Rotational equilibrium
Now add decay, . Decay pulls the norm in, and the orthogonal gradient steps push it out. The two must balance:
The cross term vanishes because , so with as before:
At a fixed point :
The angle turned per step is the step length over the radius, :
The gradient size has cancelled. In equilibrium, every normalized weight group, whatever its gradients, turns by about radians per step: decay sets the speed of learning on the sphere. Linearizing the norm recursion around shows deviations shrinking by a factor of about per step, so the norm settles within a few multiples of steps.
A normalized network is trained with plain SGD at and weight decay . In equilibrium, by roughly how many radians does each normalized weight vector turn per step?
Show the answer
0.01 rad
rad, about per step. A simulation of the norm recursion with random orthogonal gradients lands on 0.0100. With heavy-ball momentum the prediction becomes rad.
| Optimizer | Equilibrium angle per step | Equilibrium norm |
|---|---|---|
| SGD | ||
| SGD, momentum (decay added to the gradient) | ||
| AdamW, first-moment decay | for a group of weights | |
| Adam with an term | depends on each neuron's gradient size | depends on each neuron's gradient size |
Divide the decayed update by and set :
Scale invariance converts the gradient at into one at :
So SGD with decay visits exactly the same directions, and hence computes exactly the same functions, as SGD without decay whose learning rate grows by a factor every step. For , and 391 steps per epoch, a classic CIFAR-10 recipe, that is about 4% per epoch, a factor of about 50 over 100 epochs. Li and Arora proved the equivalence also with momentum, for networks in which every trained layer is scale-invariant.
Decay where nothing overfits
Large language models are pretrained for roughly one pass over their data, so training and validation losses nearly coincide and there is no generalization gap for decay to close. Yet decoupled weight decay is standard: GPT-3 used AdamW with (Brown et al., 2020), and PaLM, trained with Adafactor, used a decay equal to the square of the current learning rate (Chowdhery et al., 2023). D'Angelo, Andriushchenko, Varre and Flammarion (2024) studied why, training GPT-2-style models of 124 million parameters:
- Not a regularizer here. Decay lowered the training loss at the end of training. Early on, its larger effective learning rate keeps the loss higher, because the noise term dominates; as the learning rate is decayed, the faster contraction of the remaining error wins and the run ends lower.
- A different effective learning rate. Adam's steps have roughly fixed size per coordinate, , whatever the radius, so the angle turned per step is about : the effective rate scales as , not as for SGD. A schedule matching it reproduced AdamW's loss curve without decay, in float32.
- Stability in low precision. Without decay, runs at a higher learning rate diverged late in training in bfloat16 precision but not in float32, and matching the effective learning rate did not prevent it; decay made the higher learning rate stable in bfloat16.
Write AdamW as , with Adam's normalized update, and unroll:
The coefficients sum to . After a few multiples of steps the initialization is forgotten and the weights are times an exponential moving average of the negated updates, with timescale :
Wang and Aitchison (2025) took this view seriously: they found the best timescale, measured in epochs, roughly constant as model and dataset size change, which implies that at fixed learning rate and batch size the best should shrink as the dataset grows.
AdamW runs with and . Over roughly how many recent steps do the weights average their updates?
- About 10
- About 3,300
- About 33,000
- About 3.3 million
Show the answer
C. About 33,000
steps; an update's influence halves after steps. A run much shorter than never forgets its initialization, while one much longer forgets everything older than a few .
Practice and open questions
What to decay. Common practice decays weight matrices and leaves biases and normalization gains alone ("no bias decay" is one of the tricks collected in He et al.'s "Bag of tricks for image classification with convolutional neural networks", 2019). The theory explains why the distinction matters: for scale-invariant matrices decay works through the effective learning rate, while for parameters that are not scale-invariant, such as gains, biases or an unnormalized output layer, decay pulls on the function itself, and shrinking a gain toward zero simply switches its units off.
Coupling to the schedule. In PyTorch's AdamW the decay per step is , so it fades with the learning rate during a cooldown. And since normalized weights in equilibrium depend on , learning-rate and weight-decay sweeps should be read together rather than tuned one at a time.
Grokking. Decay is central to grokking on small algorithmic tasks: a network that has memorized its training set later moves, under decay, to a lower-norm solution that generalizes (Grokking).
Key takeaways
- Classically, weight decay is a penalty, a Gaussian prior and capacity control. AdamW is not a uniform penalty either: at its fixed points it acts like a per-coordinate penalty .
- Normalization makes the loss scale-invariant in the weights that feed it: and . Without decay, SGD makes grow like and the effective learning rate decay like .
- With decay, gradient push and decay pull balance at , where every normalized weight group turns by about per step; exactly, decay equals a learning rate growing by per step (Li & Arora, 2020), and is the intrinsic learning rate.
- AdamW's weights are times a moving average of its updates over steps. In single-pass language-model training decay is an optimization and stability tool, not a regularizer (D'Angelo et al., 2024).
- Decay matrices, not biases or gains; tune and jointly; and expect decay to matter in grokking.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
A loss satisfies for all . Which statement is true?
- , and the gradient points along
- The gradient is zero everywhere, since the loss does not change along rays
- , since the function is the same
- , and the gradient is orthogonal to
Show the answer
D. , and the gradient is orthogonal to
Differentiating in gives , and in gives . Gradient steps are tangent to spheres, and they shrink as the radius grows.
In rotational equilibrium under SGD with weight decay, what sets the angle a normalized weight vector turns per step?
- The product alone, giving about for every such vector
- Its gradient norm: neurons with larger gradients turn faster
- Nothing: the norm is constant in equilibrium, so the vector stops moving
- The learning rate alone, giving about radians
Show the answer
A. The product alone, giving about for every such vector
The equilibrium norm satisfies , and the angle then equals : the gradient scale cancels.
For a loss that is scale-invariant in all trained weights, SGD with weight decay is exactly equivalent to which procedure?
- SGD without decay and a learning rate that decays like
- SGD on the loss plus with learning rate
- SGD without decay and a learning rate multiplied by about every step
- Projected SGD on the unit sphere with a constant learning rate
Show the answer
C. SGD without decay and a learning rate multiplied by about every step
Rescaling and using gives SGD without decay at learning rate , growing by per step; both runs pass through the same directions (Li & Arora, 2020).
In single-pass language-model pretraining, what did D'Angelo et al. (2024) find weight decay mainly does?
- It closes a large gap between training and validation loss
- It lowers the final training loss when combined with a decaying learning rate, and keeps bfloat16 training stable at higher learning rates
- It makes the model sparser, so inference is cheaper
- Nothing measurable; it is kept only for historical reasons
Show the answer
B. It lowers the final training loss when combined with a decaying learning rate, and keeps bfloat16 training stable at higher learning rates
With one pass there is little generalization gap. Decay changes the optimization instead: a higher effective learning rate that pays off once the learning rate decays, and protection against late loss divergences in bfloat16.
Further reading
- I. Loshchilov & F. Hutter, "Decoupled weight decay regularization," ICLR (2019).
- T. van Laarhoven, "L2 regularization versus batch and weight normalization," arXiv:1706.05350 (2017).
- Z. Li & S. Arora, "An exponential learning rate schedule for deep learning," ICLR (2020).
- A. Kosson, B. Messmer & M. Jaggi, "Rotational equilibrium: how weight decay balances learning across neural networks," ICML (2024).
- F. D'Angelo, M. Andriushchenko, A. Varre & N. Flammarion, "Why do we need weight decay in modern deep learning?," NeurIPS (2024).
- G. Zhang, C. Wang, B. Xu & R. Grosse, "Three mechanisms of weight decay regularization," ICLR (2019).