Optimizer

An optimizer turns gradients into parameter updates. Different optimizers use momentum, adaptive moments, weight decay, or second-order information to change the update rule.

For an objective , the optimizer receives a gradient estimate:

and produces an update:

where is optimizer state and denotes hyperparameters such as learning rate, momentum, and weight decay.

Stochastic gradient descent is:

Momentum keeps a velocity:

Adam-style optimizers track moving averages of gradients and squared gradients:

With bias correction:

and the Adam update is:

AdamW separates adaptive optimization from weight decay:

where is the decoupled weight decay coefficient.

Update Boundary

The optimizer usually steps after gradients are accumulated, synchronized, optionally clipped, and optionally unscaled for mixed precision:

This boundary should match training step accounting, scheduler updates, logging, and checkpointing.

Checks

  • Is weight decay applied to the intended parameter groups?
  • Are bias, normalization, embedding, and matrix parameters treated appropriately?
  • Is the optimizer state saved in checkpoints?
  • Is the optimizer step counted separately from micro-steps?
  • Are gradient clipping and mixed-precision unscaling applied before the update?
  • Does the optimizer choice matter after controlling learning rate and schedule?