Adam Optimizer
Adam (Adaptive Moment Estimation) is a first-order stochastic optimization algorithm that maintains exponentially decaying running averages of both the gradient (first moment) and its element-wise square (second moment), using these to compute per-parameter adaptive learning rates. Key result: combines the benefits of momentum and RMSProp with bias-corrected moment estimates, achieving robust convergence with minimal hyperparameter tuning. Where it applies: training deep neural networks, large-scale machine learning, non-convex stochastic optimization. Who/when: Diederik P. Kingma and Jimmy Ba, 2014 (ICLR 2015).
Different parameters in a high-dimensional model often have gradients of vastly different scales and statistics. Adam estimates, per coordinate, both the typical direction of descent (via an exponential moving average of gradients — the first moment) and the typical magnitude of fluctuations (via an exponential moving average of squared gradients — the second moment). Dividing the smoothed gradient by the square root of the smoothed squared gradient yields a signal-to-noise normalized step: coordinates with consistent gradients move confidently, while noisy coordinates are damped automatically. Bias correction repairs the systematic underestimation that arises from initializing the moving averages at zero.
Formal Statement
Let be a stochastic objective with parameters , and let be the stochastic gradient at step . Adam maintains two exponential moving averages, (first moment) and (second raw moment), and updates parameters as follows. The first moment estimate:
Derivation hint: this is an exponential moving average; expand recursively to see . The second raw moment estimate (element-wise square ):
Derivation hint: identical EMA structure applied to squared gradients; . Bias-corrected estimates:
Derivation hint: take expectation of assuming stationary gradients; , so divide by to remove bias. The parameter update:
Derivation hint: divide the bias-corrected mean step by the bias-corrected RMS magnitude; prevents division by zero.
Symbols: = step size (learning rate, default ); = first-moment decay (default ); = second-moment decay (default ); = numerical stabilizer (default ); = Hadamard (element-wise) product; all divisions and square roots are element-wise. Initialization: , .
Assuming , the magnitude of the effective step taken by Adam in each coordinate satisfies a bound:
In the common case (e.g. defaults: ), the bound is , establishing a trust region independent of gradient scale.
Derivation hint: bound and a corresponding term; in the sparse-gradient limit the ratio emerges from a single nonzero gradient.
Why It Holds / Derivation
We show that the raw moving average underestimates the true second moment, and that the correction in equation [3] removes this bias exactly under a stationarity assumption.
Step 1. Unroll the recursion in equation [2] from :
Derivation hint: substitute repeatedly; the geometric weights and the leading factor follow by induction.
Step 2. Take the expectation, and assume the second moment is approximately stationary, :
where is small if the stationarity assumption holds (it absorbs the drift of across time). Derivation hint: the finite geometric series cancels the leading .
Step 3. The factor is the source of bias — early in training ( small) it can be far below , severely shrinking . Dividing by it yields an unbiased estimate:
Derivation hint: divide equation [7] by ; the leading term becomes exactly. The identical argument applies to .
∎Diederik Kingma (then a PhD student at the University of Amsterdam under Max Welling) and Jimmy Ba (then at the University of Toronto under Geoffrey Hinton) introduced Adam in a paper submitted to ICLR 2015. Kingma is also a principal architect of the variational autoencoder (VAE) and normalizing flows; Ba contributed foundational work on layer normalization and attention. The name "Adam" derives from "Adaptive Moment estimation" and is not an acronym in the conventional sense, nor a person's name. Their paper provided both the practical algorithm and an attempted regret-based convergence analysis in the online convex optimization framework of Zinkevich.
Building Intuition
Picture rolling a ball down a noisy, anisotropic landscape. Momentum () gives the ball inertia: it accumulates velocity in consistent directions, smoothing over the jitter of mini-batch noise. The second moment () acts like a per-direction shock absorber: in directions where the gradient is large and erratic, is large, so the update is shrunk; in flat, quiet directions, is small, so the step grows. The ratio is essentially a signal-to-noise ratio. When gradients agree across mini-batches, and the ratio is near — full-step confidence. When gradients are pure noise with zero mean, while stays positive, so the ratio shrinks and Adam automatically slows down. This is why Adam needs so little manual tuning: it self-normalizes its step to the local geometry. Bias correction matters most in the first few dozen steps, where without it the zero-initialized averages would make the algorithm take dangerously large early steps.
Worked Examples
Given: a single parameter , first gradient , defaults , , , , with .
Step 1 — first moment: .
Step 2 — second moment: .
Step 3 — bias correction (): , .
Note that after correction, and exactly — the first step recovers the raw gradient and its square.
Step 4 — update:
The effective step is exactly — the trust-region bound of equation [5] is saturated on the very first step regardless of the gradient's actual size.
Given: suppose the gradient at a coordinate is zero-mean noise: it equals on odd steps and on even steps (so the true descent signal is zero, but the magnitude is constant). Compute the steady-state behavior with defaults.
Second moment (steady state): since always, , hence .
First moment (steady state): oscillates around . After many steps, the EMA of an alternating with has amplitude
(geometric series of alternating signs). After bias correction (factor at large ), .
Effective step:
Compare: a consistent gradient of would give , roughly 19× larger. Adam automatically suppresses the step in the noisy direction — its signal-to-noise adaptivity in action.
Common Misconceptions
A widespread belief is that Adam's published convergence proof guarantees convergence on all convex problems. This is false. Reddi, Kale & Kumar (2018, "On the Convergence of Adam and Beyond") identified a flaw in the original regret analysis: the proof incorrectly assumed a positive-semidefinite quantity that can in fact be negative. The effective learning-rate matrix need not be PSD because can decrease. They constructed simple convex problems where Adam converges to the worst possible solution.
Consider online linear optimization with the periodic loss sequence (period 3), :
for large constant . The optimal fixed decision is (the rare large positive gradient should dominate the two small negative gradients ). However, because Adam's heavily damps the rare large gradient (its squared value is averaged with weight and then divided by , which is dominated by the frequent contributions), the effective influence of the informative gradient is reduced, and Adam drifts toward — the opposite of optimal. This non-vanishing regret is impossible for plain SGD with decaying steps. The fix, AMSGrad, enforces so the denominator is non-decreasing, restoring the PSD property.
Empirically, on some tasks (notably image classification with CNNs), well-tuned SGD-with-momentum generalizes better than Adam despite Adam achieving lower training loss faster. Wilson et al. (2017) argue adaptive methods can converge to flatter-but-worse minima or solutions with larger weight norm. This motivated decoupled weight decay (AdamW), where weight decay is applied directly to parameters rather than folded into the gradient, since standard L2 regularization interacts poorly with adaptive per-coordinate scaling.
Connections
Adam sits at the confluence of several optimization lineages. Setting and removing the second-moment normalization recovers classical Momentum (specifically, heavy-ball with EMA). Setting and using only the second moment gives essentially RMSProp, Hinton's unpublished method. The element-wise division by approximates a diagonal preconditioner, linking Adam to Newton's Method and quasi-Newton ideas, though Adam uses only first-order information and a crude diagonal curvature surrogate. Adam is a member of the broader family of Stochastic Gradient Descent methods and is analyzed within Online Convex Optimization via regret bounds. Its bias-correction step has a clean interpretation in terms of Exponential Moving Average estimators. The relationship to Natural Gradient Descent is partial: resembles the diagonal of the empirical Fisher information, though this correspondence is only approximate and the subject of ongoing debate.
Real-World Applications
Historical Development
Subtleties & Limits
Several deep questions about Adam remain only partially resolved. (1) Generalization gap: there is still no complete theory explaining when and why SGD generalizes better than Adam, nor a sharp characterization of the minima each method selects in non-convex landscapes. (2) Non-convex convergence guarantees: rigorous convergence rates for Adam (and variants) on smooth non-convex objectives require additional assumptions (e.g. bounded gradients, specific relationships) and the constants are often vacuous; the precise role of in convergence is subtle. (3) The Fisher-information interpretation: whether should be viewed as a principled approximation to natural-gradient preconditioning, or merely an effective heuristic, is contested. (4) Hyperparameter coupling: the interaction between , , weight decay, and learning-rate warmup is poorly understood theoretically, despite enormous practical importance — RAdam's analysis of early-training variance is one partial answer. (5) Optimal scaling with batch size and sequence length for billion-parameter models remains largely empirical.
See Also
Momentum · RMSProp · AdaGrad · Stochastic Gradient Descent · Online Convex Optimization · Natural Gradient Descent · AMSGrad · AdamW · Nadam · Exponential Moving Average