The three optimizers you actually need
- SGD (with momentum) — the classic. Cheap memory, well-understood, can match or beat Adam with proper learning-rate scheduling on vision tasks. Default for CIFAR / ImageNet replications.
- Adam — adaptive learning rates per parameter via running estimates of first and second gradient moments. Great default when you don't know much about your task.
- AdamW — Adam with decoupled weight decay. The actual modern standard for Transformers, fine-tuning, and most non-vision deep learning. The "Adam" people refer to in 2026 papers is almost always AdamW.
Why AdamW and not Adam
The "weight_decay" argument in Adam used to add a term to the gradient. AdamW applies weight decay after the gradient update, which is mathematically equivalent to L2 regularization on the parameters and behaves better empirically. For any modern training setup, prefer AdamW.
Per-parameter-group settings
The optimizer accepts either a flat list of parameters OR a list of parameter groups, each with their own settings. The classic use: lower learning rate on a pretrained backbone, higher on the new head. Or: no weight decay on bias / LayerNorm parameters (a Transformer convention).