Two things both called weight decay, which differ under Adam
counterexample▲▲▲Adding to the loss and subtracting from each update are the same operation under plain gradient descent. Show they are the same, then show they are not the same under Adam, and say which coordinates the difference falls on.
Hint
Under Adam the penalty’s gradient does not go straight into the update — it passes through the same division by as everything else.
Solution
Under plain descent they coincide. The penalty contributes , so
which is the update with a separate term. The two descriptions are one algorithm, which is why the names are used interchangeably.
Under Adam they diverge. L2 regularisation puts into before the moments are formed, so it is divided by along with everything else:
Decoupled decay (AdamW) applies it outside:
Which coordinates differ. Consider a parameter whose gradient is persistently large, so is large. Under L2 its decay term is divided by that large number and is therefore weak. A parameter with a small gradient has small and its decay is strong.
So L2-under-Adam regularises inversely to gradient magnitude: the parameters doing the most work are penalised least, and the ones already doing little are pushed towards zero hardest. That is the opposite of what a practitioner adding weight decay intends, and it is not a small effect — can differ by orders of magnitude across a network.
Decoupled decay applies uniformly, which is what the name describes.
Why this counts as a counterexample. The claim being refuted is the reasonable one that weight decay and L2 are two names for one thing. They are, under any optimiser whose update is proportional to the gradient — SGD, momentum, Nesterov. They are not, under any optimiser that rescales the gradient per coordinate, and Adam is the one everybody uses. The identity fails exactly where it is most relied on.
The practical residue. Loshchilov and Hutter’s AdamW is the decoupled form, and it is now the default in most training code. A configuration ported from an SGD recipe by copying across will not reproduce its regularisation under Adam, and the discrepancy is largest for the parameters that matter most.