Adam and Adaptive Optimizers
Adam gives every single parameter its own personal learning rate that automatically shrinks for parameters with noisy, wildly varying gradients and stays larger for parameters with calm, consistent ones — a per-parameter version of momentum plus a per-parameter volume knob.
Prerequisites: Momentum and Nesterov Acceleration
A single global learning rate is a compromise across every parameter in a network at once, and different parameters can badly disagree about what rate suits them. A parameter whose gradient is huge and jumpy needs small, cautious steps; a parameter whose gradient is small and steady could safely take bigger ones. Plain gradient descent and even plain momentum apply the same step size to both, which means the rate is always wrong for somebody. Adam fixes this by giving every parameter its own adaptive step size, updated automatically as training goes.
The analogy: a thermostat that also watches how jumpy the room is
A basic thermostat adjusts temperature by a fixed amount per correction, regardless of context. A smarter one watches not just the current reading but how erratically the temperature has been swinging lately — in a drafty room with wild swings, it makes small, cautious adjustments to avoid overcorrecting into an oscillation; in a stable room, it can afford bigger, more confident adjustments. Adam does exactly this per parameter: it tracks not only the recent average direction of the gradient (like momentum) but also the recent average size of the gradient, and divides its step by that size — large, volatile gradients get dampened, small, steady ones get amplified relative to a fixed rate.
The maths: two running averages, then a ratio
Adam keeps two exponentially weighted averages per parameter: , tracking the mean gradient (like momentum), and , tracking the mean squared gradient (a running estimate of how large the gradient tends to be, in either direction):
In words: is "which way has this parameter's gradient generally been pointing," is "how big has this parameter's gradient generally been, squared so sign doesn't matter." The update then divides the momentum term by the square root of the magnitude term:
(with small bias-corrected versions of , and a tiny constant preventing division by zero). In words: a parameter whose gradients have recently been large gets its step shrunk by that same large size, and a parameter whose gradients have recently been small gets a relatively larger step — the division automatically equalises the effective step size across parameters with very different gradient scales.
Worked example 1: a noisy parameter versus a calm one
Parameter A has recent squared gradients averaging (large, volatile gradients); parameter B has (small, calm gradients). Both currently have and use , . Parameter A's step: . Parameter B's step: . Despite an identical raw momentum term, A moves by and B moves by — a 100x difference, entirely from Adam noticing that A's gradients are inherently 100x larger in magnitude and dividing that scale back out.
Worked example 2: bias correction near the start of training
At , with and an initial , a single gradient of gives . That's a severe underestimate of the true squared-gradient scale, since started at zero and has barely moved from it after one step. Adam's bias correction divides by : — recovering the actual value exactly. Without this correction, early steps would be wildly overconfident (dividing by a near-zero produces a huge, unstable step); the correction exists specifically to fix this cold-start problem.
Compare the paths in the explorer above: Adam's per-parameter scaling is designed to avoid both the slow crawl of too-small a learning rate and the overshoot of too-large a one, by letting each parameter effectively pick its own point on that trade-off.
Both and are exponentially weighted running averages, settling toward their true values the way the running average in the explorer above settles toward the truth — Adam's bias correction (worked example 2) exists purely to fix the slow start of exactly this kind of average.
Adam divides each parameter's momentum-smoothed gradient by that same parameter's recent typical gradient magnitude, giving every parameter its own effective learning rate without any manual per-parameter tuning.
What this means in practice
Adam is the default optimiser for the large majority of deep learning training today because it's robust to a poorly chosen global learning rate and handles the wildly different gradient scales common across a deep network's layers with no manual intervention. Its main weakness is that the adaptive per-parameter scaling can sometimes generalise slightly worse than well-tuned plain SGD with momentum, which is why some final-stage training runs switch to SGD once Adam has gotten the model into a good region.
The classic mistake is assuming Adam makes the learning rate irrelevant. It doesn't — is still the outer scale of every step, and a badly chosen still causes divergence or painfully slow training; Adam only removes the need to tune a separate rate per parameter, not the need to tune the global rate at all. A second common trap: Adam's adaptivity can make it look like training is progressing (loss decreasing steadily) while quietly overfitting, since its aggressive early steps can memorise noise before regularisation has a chance to matter.
Related concepts
Practice in interviews
Further reading
- Kingma & Ba, Adam: A Method for Stochastic Optimization (2014)
- Goodfellow, Bengio & Courville, Deep Learning, ch. 8.5