How Adam combines gradient memory and adaptive scaling, why both bias corrections matter, and how AdamW, epsilon conventions and saved state change training.
Adam optimiser
The Adam optimiser is a gradient descent method that updates each model parameter using running averages of its gradients and squared gradients. Its name comes from adaptive moment estimation. In a quant model, this changes the path taken while fitting a loss function: two weights can receive different effective step sizes even when they share one learning rate. It does not establish whether the fitted signal survives a chronological test or trading costs.
Two memories, one update
For a gradient gt evaluated at the current parameters, Adam keeps a signed average mt and a squared-gradient average vt. Starting with both at zero, the original algorithm is
All arithmetic is coordinatewise. The decay factors β1,β2∈[0,1) control memory; αt>0 is the learning rate. The positive constant ϵ stabilises the denominator and is outside the square root in this convention. The second accumulator estimates a raw second moment, not a variance: it does not subtract the squared mean. These are the conventions in Kingma and Ba's Algorithm 1.
A persistent gradient direction reinforces the numerator. Large recent squared gradients enlarge the denominator. Neither mechanism removes the need to choose a learning rate or learning-rate schedule.
A first step that exposes a common mistake
Consider one fictional scalar parameter, initially θ0=1. Use g1=2, β1=0.9, β2=0.999, α1=0.1 and ϵ=10−8. These numbers make the arithmetic visible; they are not a training recommendation.
Quantity
First-step value
Signed accumulator m1
0.2
Squared-gradient accumulator v1
0.004
Corrected signed accumulator m^1
2
Corrected squared-gradient accumulator v^1
4
The parameter becomes
θ1=1−0.14+10−82≈0.9000000005.
At the first step, the correction factors cancel the initial averaging weights exactly. For a nonzero scalar gradient and negligible epsilon, the update is therefore approximately one learning rate in the opposite direction to the gradient, rather than the learning rate times the raw gradient.
Fictional Adam first step: gradient 2 produces m equal to 0.2 and v equal to 0.004; correcting gives 2 and 4. The corrected step magnitude is 0.100000, versus 0.316228 when both corrections are omitted.
Both correction factors matter. This compares the same scalar first step, with epsilon outside the square root in both cases.
Omitting both corrections would give a step magnitude of about 0.316228, over three times the corrected step. Correcting only the numerator does increase that numerator; it does not follow that correcting the entire ratio always increases the update.
Bias correction addresses the missing history caused by zero initial accumulators. Under constant first and second gradient moments, it removes that initialisation bias in the individual moment estimates. During training, those moments can change. Even unbiased moment estimates would not make their nonlinear ratio an unbiased estimate of the true gradient. This distinction follows from the moment calculation in Section 3 of the original paper.
INTERACTIVE EXPLORER
Optimiser trajectories
Compare gradient, momentum and Adam on a known convex loss.
AdamW changes where regularisation enters
With an L2 penalty λ∥θ∥2/2 added to the loss, the gradient passed into Adam includes λθ. The penalty therefore enters the moment accumulators and adaptive scaling.
AdamW instead applies weight decay separately from the loss-gradient update. One common learning-rate-scaled convention is
θt=(1−αtλ)θt−1−αtv^t+ϵm^t,
where the moments use the loss gradient without that penalty term. The decay shrinks parameters directly rather than passing through the adaptive denominator. Loshchilov and Hutter show why the familiar equivalence between L2 regularisation and weight decay for plain SGD does not generally extend to Adam. Record the decay convention and which parameters receive it when comparing experiments.
What must survive an experiment restart
Adam has a training history. Reloading model weights while resetting the moments and step counter changes subsequent updates. A training checkpoint needs the optimiser state as well as the parameters; full reproducibility also depends on the data order, random state and schedule. The PyTorch checkpoint guide explicitly distinguishes resuming training from saving weights for inference.
Implementation details also matter. In documentation checked on 1 November 2026, Keras Adam defines its epsilon as the paper's alternative “epsilon hat”, rather than Algorithm 1's epsilon. Matching parameter names and numerical epsilon values across libraries is therefore insufficient to establish identical updates. Check the actual formula, including epsilon placement and bias-correction convention.
Finally, adaptive scaling is not a convergence guarantee. The original paper's online convex convergence analysis was challenged by Reddi, Kale and Kumar, who identified a proof issue and constructed convex counterexamples, including for bias-corrected Adam. Their AMSGrad variant changes the second-moment memory and has guarantees under stated assumptions; neither result guarantees a global optimum for a neural network or profitable forecasts.
For a research workflow beyond the update rule, Reading Loss Curves explains experiment logging, validation-based selection and failed-training diagnosis. The preview is public; the full lesson requires membership.