﻿# AdamW separates weight decay from adaptive gradient updates

AdamW separates weight decay from Adam’s adaptive gradient update. Understand why adding an L2 gradient is not generally the same operation.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/adamw-decoupled-weight-decay/
Language: en

Weight decay and L2 regularization are often used interchangeably in informal explanations. Their equivalence depends on the optimizer update. AdamW makes a specific distinction: the parameter shrinkage is decoupled from the gradient term that enters Adam’s adaptive moment machinery. Following the update path explains why the distinction matters.

## Adam transforms the gradient using stored moments

Adam maintains moving estimates of gradient-related moments and uses them to scale parameter updates. A coordinate’s update therefore depends not only on the current gradient but also on its recorded history and the optimizer settings. If a parameter-proportional L2 contribution is added to the gradient before this machinery, that contribution enters the same moment and normalization path. It is not automatically a simple direct shrinkage of the parameter. The optimizer’s state is part of the calculation, rather than a passive log of earlier steps.

## Decoupling creates a separate shrinkage path

AdamW applies weight decay separately from the adaptive gradient transformation. In a simplified update description, a parameter receives the adaptive data-gradient step and a learning-rate-scaled decay component. The exact update contract includes the implementation’s ordering and numerical details. The conceptual separation allows decay strength to be considered independently of how Adam normalizes the data gradient. This is the point established by the decoupled-weight-decay formulation, not a claim that every setting called weight_decay across libraries has always used identical semantics.

## Compare coordinates with different optimizer history

Imagine two equally sized parameter coordinates with different accumulated gradient scales. An L2 contribution inserted into Adam can be transformed differently across those coordinates because their adaptive denominators differ. A separately applied proportional decay does not acquire that same coordinate-specific gradient normalization. This hypothetical comparison explains nonequivalence without requiring a benchmark. It also shows why matching an L2 coefficient to a decay coefficient by name alone is insufficient when reproducing a training recipe from another optimizer or another historical implementation.

## Parameter groups and schedules complete the recipe

Training recipes may apply different decay settings to different parameter groups, such as excluding selected bias or normalization parameters. That policy must be recorded rather than assumed to follow automatically from the optimizer name. Preserve learning-rate schedules, state initialization and effective update counts when comparing changes. A tiny controlled step with known gradients and moments can distinguish the data-gradient path from the decay path. This makes reproduction concrete and avoids attributing an observed result to AdamW when a simultaneous parameter-group or scheduling change actually altered the update.

## Primary research and implementation references

- [Adam: A Method for Stochastic Optimization](https://arxiv.org/abs/1412.6980).

- [Decoupled Weight Decay Regularization](https://arxiv.org/abs/1711.05101).

- [PyTorch: AdamW](https://docs.pytorch.org/docs/2.15/generated/torch.optim.AdamW.html).

## Related engineering context

[Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/); [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/).
