Adam keeps two running averages per parameter: the first moment (mean of gradients, like momentum) and the second moment (mean of squared gradients). Both are bias-corrected at the start.
The update divides the momentum term by the square root of the second moment, so each parameter gets its own adaptive step size.
Typical defaults: learning rate 1e-3, beta1 0.9, beta2 0.999, epsilon 1e-8.
Caveats: it can generalize slightly worse than well-tuned SGD with momentum on some vision tasks, uses extra memory (two states per parameter), and its L2 penalty interacts badly with the adaptive scaling.
AdamW decouples weight decay from the gradient update and is the standard choice for transformers.
Loading…