Model and Inference EngineeringTraining execution and recoveryStaff
How can changing AdamW parameter groups alter training without causing a numerical error?
By Amit Kumar2 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A refactor places every trainable tensor into an AdamW group with weight decay. The previous recipe excluded normalization scales and biases. Both runs have finite gradients, but normalization scales shrink in the new run. Explain the decay mechanism, distinguish it from the task gradient, and decide how to validate the intended group policy and continuation.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Decoupled weight decay directly shrinks a parameter according to its assigned decay and learning rate, in addition to the adaptive gradient update. For a hypothetical scalar of 1.0, learning rate 0.01 and decay 0.1, the decay-only factor is 1-0.01×0.1=0.999 for that update. A zero task gradient need not mean zero movement when the optimizer processes that parameter. Whether normalization scales should receive this treatment is a recipe choice that must survive the refactor.
AdamW applies a decoupled decay to parameters assigned a nonzero weight-decay value, independent of whether the current task gradient wants a scale or bias to shrink. PyTorch's AdamW documentation describes the decoupled update and parameter-group settings. Excluding normalization and bias from decay is a common recipe choice, not a universal theorem. What matters here is that a supposedly identical training run changed its optimization recipe by moving those parameters into a decay group.
I would enumerate all trainable parameters by logical name and identity, the optimizer group they enter, learning rate and decay, including tied weights and any newly introduced modules. Check that each parameter appears exactly once and that the intended group policy matches the saved training configuration. On a single step, compute the expected contribution of decay for a selected normalization scale, separate from the adaptive gradient update. Compare with the previous run using the same weights and microbatch. A norm scale may also decline because of gradients, so the graph alone does not prove decay caused it.
Then choose the recipe deliberately. Typical transformer training excludes norm scales and biases, while applying decay to many weight matrices, but embedding and output-head policy can differ. If weights are tied, they cannot meaningfully live in two conflicting optimizer groups. A layer name filter is easy to get wrong after a refactor, so validate by parameter type and explicit exceptions, then emit a group inventory with the checkpoint. Evaluate training and downstream quality over enough steps to distinguish a transient from a persistent effect. If the new policy was intentional, record it as a changed experiment rather than calling the runs comparable.
The interviewer may ask why this is separate from The optimizer checkpoint loads. Did its moments attach to the right parameters?, where moments attach to the wrong parameters after loading. Here the optimizer can be freshly created, every state correctly attached and every update numerically valid. The failure is the policy of which parameters receive decay. The new LoRA adapter has gradients. Why do its weights never change? is a missing LoRA parameter. This parameter is present, but it gets an update the old recipe did not authorize.
Related questions
Keep practising model and inference engineering
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux