Adam
Adam is an adaptive first-order optimizer. It keeps exponential moving averages of gradients and squared gradients, then scales each parameter update by an estimate of gradient magnitude.
For gradient :
Bias correction is:
The parameter update is:
where is the learning rate, controls momentum, controls the squared-gradient average, prevents division by zero, and is elementwise multiplication.
What Adam Is Estimating
Adam stores two optimizer-state tensors for each optimized parameter:
| State | Estimate | Effect |
|---|---|---|
| first moment of gradient | smooth update direction | |
| second raw moment of gradient | scale update by recent gradient magnitude |
The update can be read per coordinate:
Coordinates with consistently large squared gradients get smaller effective steps. Coordinates with small squared gradients get larger effective steps. This is why Adam is often robust early in training, but it also means that optimizer choice, learning-rate schedule, and parameter grouping are part of the model claim.
Bias Correction
At the start of training, and are biased toward zero because they are initialized at zero. Bias correction compensates for this:
so dividing by makes the early estimate comparable in scale. Without bias correction, the first updates can be too small or behave differently across implementations.
Epsilon and Numerical Boundary
The term is not just cosmetic:
sets a lower bound on the denominator. If is tiny, controls the effective step size. Different frameworks or fused kernels may place inside or outside the square root, which can change behavior in low-precision or small-gradient regimes.
Adam vs AdamW
Adam with an penalty and AdamW are not the same for adaptive updates.
| Choice | Update Meaning |
|---|---|
| Adam + penalty | decay term is mixed into and rescaled by adaptive moments |
| AdamW | decay term is applied directly to parameters |
Use Adam when describing the adaptive moment mechanism. Use AdamW when the training recipe depends on decoupled weight decay.
Checkpoint Boundary
A faithful resume needs:
Saving only changes the next update because bias correction, scheduler phase, and moment estimates are lost. This matters for long training, interrupted HPC jobs, and paper reproduction.
Why It Matters
- Adam adapts update sizes per parameter.
- It often trains deep networks faster than plain stochastic gradient descent.
- It introduces optimizer state: and must be checkpointed for faithful resume.
- Learning rate, warmup, and weight decay still matter.
Checks
- Are , , , and reported?
- Is the implementation using Adam, AdamW, or a framework variant?
- Is optimizer state saved with model checkpoints?
- Are comparisons fair when optimizer and schedule differ?
- Is gradient clipping applied before or after the optimizer sees ?
- Is placement or fused optimizer behavior relevant?
- Are bias correction, scheduler state, and step count restored on resume?
- Are parameter groups using the same learning rate and decay settings?