AdamW

AdamW is Adam with decoupled weight decay. The key distinction is that weight decay is applied directly to parameters, rather than being mixed into the gradient that Adam rescales.

Adam’s adaptive step is:

AdamW applies:

where is the weight decay coefficient. Some implementations write the last two terms as:

More explicitly, a common step is:

The decay magnitude depends on both and . A learning-rate schedule also changes the effective amount of shrinkage over training.

Why Decoupling Matters

In classical L2 regularization, the penalty contributes to the gradient. Adam rescales gradients per parameter, so coupling L2 penalty to the adaptive gradient can change the intended regularization. AdamW keeps the decay term separate.

The distinction can be summarized as:

MethodGradient Seen by AdamParameter Shrinkage
Adam + adaptive, coordinate-scaled
AdamWdirect

Parameter Groups

Deep learning code often applies weight decay only to selected parameters:

  • Usually decayed: large weight matrices in linear, convolution, and attention projections.
  • Often not decayed: biases, normalization scale/shift parameters, and sometimes embeddings.

This is an implementation contract, not a universal law. The paper, code, or run record should state the grouping.

Parameter TypeCommon AdamW ChoiceReason
linear/attention/convolution weightsdecayregularize large learned maps
biasno decaybias magnitude is not usually a capacity proxy
normalization gain/biasno decaycan harm scale calibration
embedding tablestask-dependentlarge tables may need separate tuning
adapter or LoRA weightstask-dependentoften use separate learning rate and decay

Training Recipe Boundary

AdamW should be recorded together with:

where is the parameter-group assignment. Reporting “AdamW” without is incomplete because two runs can use the same optimizer name but decay different parameters.

Failure Modes

FailureSymptom
decay applied to all parameters blindlynormalization or bias parameters become poorly calibrated
coefficient copied across batch/schedule changesvalidation changes without clear model reason
Adam + L2 mistaken for AdamWreproduction mismatch
parameter groups not checkpointed or loggedrun cannot be reconstructed

Checks

  • Is the optimizer actually AdamW, not Adam with L2 penalty?
  • Which parameter groups receive weight decay?
  • Is the weight decay coefficient reported separately from the learning rate?
  • Are normalization and bias parameters excluded intentionally?
  • Are optimizer state and scheduler state saved for resume?
  • Does the learning-rate schedule change the effective decay strength?
  • Are embedding, adapter, or task-specific heads using separate groups?