Weight Decay › Summary
Michael BrenndoerferJanuary 27, 20262 min read
Language AI HandbookAll chapters Part 32 of 67Training Optimization
Weight Decay › SummaryOne section · Sections in this chapter10 / 11 ↓
Sections in this chapter11
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Weight decay adds a penalty proportional to the squared magnitude of model weights to the training loss, discouraging large weights and encouraging solutions that generalize better. The key ideas from this chapter are:
- L2 regularization adds to the loss, producing a shrinkage factor on weights at each update step. This is mathematically equivalent to weight decay for SGD but not for adaptive optimizers.
- Decoupled weight decay (AdamW) applies the weight decay term directly to parameters rather than through the loss gradient, making sure uniform regularization across all parameters regardless of their gradient history. This outperforms standard Adam with L2 regularization for most large-scale training setups.
- Selective application matters: bias terms and layer normalization parameters are typically excluded from weight decay to preserve training stability. The standard heuristic excludes all one-dimensional parameters.
- Coefficient selection typically starts around for transformer training and is tuned based on dataset size and model capacity, with larger values for smaller datasets. Published configurations from BERT (), GPT-3 (), and LLaMA () provide useful starting points.
- The learning rate coupling means effective regularization per step scales with both and the learning rate, which is worth considering when using aggressive learning rate schedules.
- Fine-tuning requires care: standard weight decay pulls weights toward zero, not toward the pretrained initialization, which can hurt fine-tuning on small datasets. Use smaller or L2-SP regularization when adapting pretrained models.
The next chapter covers gradient accumulation, another training optimization technique that addresses the practical constraint of GPU memory limits by simulating large batch training through accumulated gradient updates.