The interview problem
Explain why adding an L2 penalty to an adaptive optimizer is not generally equivalent to decoupled weight decay.
Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.
1. Scope and worked approach
An L2 penalty contributes lambda times the parameter to the gradient, which an adaptive optimizer then transforms using its moment estimates. Decoupled decay instead shrinks the parameter separately from the loss-gradient update. State the exact loss normalization and optimizer convention before comparing lambda values. Biases and normalization parameters may be excluded under an explicit policy.
2. Trace the design or derivation
Compute task gradient → update moments → apply adaptive step → apply separate shrinkage
Over many zero-gradient steps with fixed learning rate eta and decay lambda, a parameter scales by (1−eta lambda)^t under this simplified decoupled rule. Comparing runs with different step counts requires considering cumulative shrinkage, not merely matching the printed decay coefficient.
3. Calculate the example
For parameter 10, learning rate 0.01 and decay 0.1, a separate multiplicative decay step gives 10×(1−0.001)=9.99 before any task-gradient update. An adaptively normalized L2 gradient need not produce this same shrinkage.
4. Failure cases and trade-offs
Calling both settings weight decay can conceal implementation differences. Large learning rates make the shrinkage schedule materially different even at the same coefficient. Decoupling simplifies interpretation but still requires tuning with the learning-rate schedule; it does not guarantee better generalization in every task.
5. Validation, follow-ups and self-review
Test a zero task-gradient case and inspect excluded parameter groups. Follow-up: what happens when the learning rate is scheduled to zero? Self-review: write both update rules and identify where adaptive scaling enters.
Sources and related practice
Technical reference: docs.pytorch.org — Decoupled weight-decay update.
Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.
Continue with Compare momentum and adaptive optimization; Connect regularization with probabilistic priors.
Continue your preparation
Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.