10 · G · Step
AdamW, clip, and the schedule
Turning a gradient into a new θ without destroying a billion-parameter run.
Vanilla SGD is not what runs
Raw gradients in a Transformer have wild scale differences across layers. LLMs use AdamW: per-parameter adaptive steps, decoupled weight decay, a warmup-cosine schedule, and global-norm clipping.
AdamW
Let at optimizer step .
- scheduled learning rate
- first-moment decay, typically 0.9
- second-moment decay, 0.95 or 0.999
- weight decay, applied to θ directly (the “W”)
- 10^{-8}, avoid divide-by-zero
- elementwise square
Warmup then cosine decay
Gradient clipping
Before AdamW:
- clip threshold, often 1.0
- global L2 norm of the concatenated gradient
Why it mattersAdam normalizes per-parameter. Weight decay stops ‖θ‖ drifting. Clipping stops rare batches from destroying the run. The schedule starts gentle, then anneals so the model settles.