Search

Search IconIcon to open search

Weight Decay

Last updatedUpdated: by Jakub Žovák · 2 min read

Properties
created 15.03.2026, 09:28
modified 26.07.2026, 13:38
published Empty
topics Regularization, Weight Penalization, Optimizers
authors Jakub
ai-assisted Yes

Weight decay is a regularization technique that directly reduces each weight by a small fraction at every update step, independent of the gradient. It was originally proposed as a simple mechanism to prevent weights from growing unboundedly.

# Update Rule

$$
w_t \leftarrow (1 - \eta \lambda), w_t - \eta \nabla_w \mathcal{L}
$$

where:

  • $\eta$ is the learning rate
  • $\lambda$ is the weight decay coefficient
  • The factor $(1 - \eta \lambda)$ decays the weight directly

# Relationship with L2 Regularization

In SGD, weight decay and L2 Regularization are mathematically equivalent:
$$
w \leftarrow w - \eta(\nabla \mathcal{L} + \lambda w) = (1 - \eta\lambda) w - \eta \nabla \mathcal{L}
$$

In Adam, they diverge. Adam scales gradients by an adaptive factor $\frac{1}{\sqrt{\hat{v}_t} + \epsilon}$, which also scales the L2 gradient penalty — distorting it away from a true weight decay. Decoupled weight decay (used in Adamw) applies the decay directly to weights, bypassing the gradient scaling ( Loshchilov & Hutter, 2019).

# Coupled vs Decoupled

L2 in AdamWeight Decay (AdamW)
Penalty applied toGradient (then scaled)Weights directly
EffectDistorted by adaptive LRClean, uniform shrinkage
RecommendedNoYes

# Properties

  • Computationally free: just a scalar multiply on weights per step
  • Decoupled weight decay (AdamW) is the current standard for transformer training
  • Typical values: $\lambda \in [10^{-4}, 10^{-1}]$