Adam vs AdamW - what exactly is "decoupled weight decay," and why did AdamW become the transformer default?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
The difference is where the weight-decay term enters the update. In "Adam + L2," you add λw to the gradient, so the penalty flows through Adam's machinery - including division by √v̂. In AdamW (Loshchilov & Hutter, "Decoupled Weight Decay Regularization"), decay is applied directly to the weights, outside the adaptive update:
# Adam + L2: penalty is rescaled by the adaptive term
g = grad + lam * w
w -= lr * m_hat / (v_hat.sqrt() + eps) # decay diluted where v_hat is large
# AdamW: decay decoupled from gradient adaptation
w -= lr * m_hat / (v_hat.sqrt() + eps)
w -= lr * lam * w # uniform multiplicative shrinkage
Full worked answer with diagram
The difference is where the weight-decay term enters the update. In "Adam + L2," you add λw to the gradient, so the penalty flows through Adam's machinery - including division by √v̂. In AdamW (Loshchilov & Hutter, "Decoupled Weight Decay Regularization"), decay is applied directly to the weights, outside the adaptive update:
# Adam + L2: penalty is rescaled by the adaptive term
g = grad + lam * w
w -= lr * m_hat / (v_hat.sqrt() + eps) # decay diluted where v_hat is large
# AdamW: decay decoupled from gradient adaptation
w -= lr * m_hat / (v_hat.sqrt() + eps)
w -= lr * lam * w # uniform multiplicative shrinkage
Why the coupled version is broken: parameters with large gradient history (large v̂) have the L2 term divided down - precisely the weights moving the most get the least regularization, and the effective decay strength becomes an uncontrolled function of gradient statistics. It also entangles λ with the learning rate schedule in messy ways, making hyperparameters non-transferable across runs. With plain SGD, L2 and weight decay coincide - the distinction only exists for adaptive optimizers, which is exactly the trap the question tests.
AdamW restores a clean interpretation - every weight shrinks by the same fraction lr·λ per step - decouples the λ/lr search dimensions, and empirically generalizes better. It became the default in essentially every transformer recipe (GPT-series, Llama, etc.), with typical settings λ ≈ 0.1, β₂ ≈ 0.95, and decay disabled for biases, LayerNorm/RMSNorm parameters, and often embeddings. As of 2026 it is still the safe default, but no longer the only serious option: Muon-family optimizers, which orthogonalize the momentum update for 2D weight matrices, were used to pretrain Kimi K2 and GLM-4.5, with AdamW kept for embeddings, the output head and norm gains. Decoupled weight decay carries over to them unchanged.
Worth sketching. Two paths from the same gradient, differing only in which side of the division the decay sits, is the entire fix in one picture.
flowchart TD
A["Gradient g"] --> B["Adam plus L2:<br/>g becomes g + lam w"]
B --> C["Divide by sqrt of v_hat"]
C --> D["Decay diluted exactly where<br/>gradients are largest"]
A --> E["AdamW: adaptive step<br/>computed from g alone"]
E --> F["Then w = w - lr lam w"]
F --> G["Same fractional shrinkage<br/>for every weight"]
What a good answer covers
- The difference is where the weight-decay term enters the update
- In "Adam + L2," you add λw to the gradient, so the penalty flows through Adam's machinery - including…
- Why the coupled version is broken
- It also entangles λ with the learning rate schedule in messy ways, making hyperparameters…
- With plain SGD, L2 and weight decay coincide - the distinction only exists for adaptive optimizers,…
Key terms: AdamW
In the glossary: Adam · AdamW · Weight decay · LayerNorm · RMSNorm · Momentum
Interviewer follow-ups to expect
Why is weight decay ≡ L2 under SGD but not under Adam?
Why exclude norm parameters from decay?
What happens to effective weight decay as the LR is cosine-annealed to near zero?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep