Ask what should change under a concrete input, then trace that expectation through the equation.
Foundation Lab
Weight Decay & AdamW: Decoupled Regularization
AdamW is the standard optimizer for LLM training—GPT, LLaMA, etc. all use it
Selected Foundation Object
Keep the equation fixed; move through the evidence.
Adam rescales gradients, so L2 regularization gets rescaled too—breaking the intended effect
Use the key equation and canonical papers as the available witnesses, without implying that a runnable panel exists.
The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.
Use prerequisites, dependents, and semantic links to repair the next gap without leaving the object behind.
Why It Matters for Modern Models
- AdamW is the standard optimizer for LLM training—GPT, LLaMA, etc. all use it
- The distinction between L2 and weight decay is a common source of bugs in training
- Weight decay strength is one of the most important hyperparameters for generalization
What Tutorials Skip
What is still poorly explained in textbooks and papers:
- Adam rescales gradients, so L2 regularization gets rescaled too—breaking the intended effect
- AdamW applies weight decay after the Adam update, preserving the regularization strength
- Weight decay = "prefer simpler models"—it keeps weights small unless data strongly supports them
Visualization Status
Core Math (Optional Deep Dive)
If you want intuition first, start with the key equation and cited sources. Come back here for the full walkthrough.
L2 regularization adds penalty to loss:
Weight decay directly shrinks weights:
For SGD: L2 regularization = weight decay. For Adam: they differ!
AdamW decouples weight decay from gradient updates: