Skip to content
Adam: A Method for Stochastic Optimization 4 min

Diederik P. Kingma, Jimmy Ba · ICLR 2015

Adam: A Method for Stochastic Optimization

A single global learning rate is a poor fit for millions of parameters with wildly different gradient behavior. Adam gives every parameter its own adaptive learning rate by combining momentum with a bias-corrected running average of squared gradients, and became deep learning's default optimizer.

Read the original paper

AI & ML · intermediate · 4 min read

Adam: A Method for Stochastic Optimization

Training a deep neural network means repeatedly asking "which direction should I nudge millions of parameters to reduce the loss?" This is a classic problem in stochastic optimization, and the plain stochastic gradient descent approach answers it with one number, a single global learning rate applied uniformly to every parameter. That is a strange simplification: some parameters see huge, frequent gradients, others see tiny, rare ones (this is common with sparse features, or embeddings for rare words), and forcing them to share one step size is rarely ideal.

In 2015, Diederik Kingma and Jimmy Ba published Adam, short for Adaptive Moment Estimation, which gives every single parameter its own learning rate, computed automatically from that parameter's own gradient history. It combines two ideas that already existed separately, momentum and per-parameter adaptive rates, into one update rule, and it is very likely the single most widely used optimizer in deep learning, including in the Transformer paper that popularized modern NLP.

Adam keeps a running average of each parameter's past gradients (momentum) and past squared gradients (an adaptive, per-parameter learning rate), corrects both for their startup bias toward zero, and uses them together to compute a stable, well-scaled update for every parameter independently.


The two ingredients Adam combines

Adam is best understood as a blend of two optimizers that came before it.

Momentum: smoothing out noisy gradients

A single mini-batch gives you a noisy estimate of the true gradient. Momentum keeps an exponential moving average of past gradients, so a consistent downhill direction accumulates speed while noise from batch to batch tends to cancel out:

mt=β1mt−1+(1−β1) gtm_t = \beta_1 m_{t-1} + (1-\beta_1)\, g_t

The raw gradient bounces around from one mini-batch to the next. The exponential moving average m_t rides through that noise and tracks the underlying trend instead.

Adaptive learning rates: RMSProp

AdaGrad and later RMSProp took a different idea: track a moving average of each parameter's squared gradients, and divide the update by the square root of that average. A parameter with consistently large gradients gets a smaller effective step, one with small or sparse gradients gets a relatively larger step:

vt=β2vt−1+(1−β2) gt2v_t = \beta_2 v_{t-1} + (1-\beta_2)\, g_t^2

Adam simply keeps both moving averages, mtm_t (the first moment, mean of the gradient) and vtv_t (the second moment, uncentered variance of the gradient), for every parameter.

The bias correction that makes it actually work

Both moving averages start at zero: m0=v0=0m_0 = v_0 = 0. Early in training, with β1\beta_1 and β2\beta_2 close to 1 (defaults are 0.9 and 0.999), the running averages are still overwhelmingly weighted toward that initial zero, so they badly underestimate the true mean and variance for the first several steps.

Just after initialization, the raw second-moment estimate is a tiny fraction of the true value. Dividing by (1 − β₂ᵗ) corrects for it, and the correction fades out automatically as t grows.

The fix is a bias-corrected estimate, applied at every step t:

m^t=mt1−β1t,v^t=vt1−β2t\hat{m}_t = \frac{m_t}{1-\beta_1^t}, \qquad \hat{v}_t = \frac{v_t}{1-\beta_2^t}

As t grows, β1t\beta_1^t and β2t\beta_2^t both shrink toward zero, so the correction factor shrinks toward 1 and quietly disappears, exactly when it is no longer needed.

This is the detail most summaries of Adam skip, but it is the difference between "a nice idea" and "the optimizer everyone actually uses." Without bias correction, Adam takes wildly oversized steps in the first few iterations of training, before the moving averages have had time to warm up.

Putting it together: the update rule

The final parameter update combines the two corrected estimates:

θt=θt−1−α⋅m^tv^t+ϵ\theta_t = \theta_{t-1} - \alpha \cdot \frac{\hat{m}_t}{\sqrt{\hat{v}_t} + \epsilon}

Read this as: take the smoothed gradient direction (m^t\hat{m}_t), and scale the step size down for parameters whose gradients have historically been large (dividing by v^t\sqrt{\hat{v}_t}), while a tiny ϵ\epsilon (commonly 1e-8) just prevents division by zero. The paper's suggested defaults, α=0.001\alpha = 0.001, β1=0.9\beta_1 = 0.9, β2=0.999\beta_2 = 0.999, are still the starting point most training scripts reach for today, almost a decade later.

On an ill-conditioned loss surface (steep in one direction, shallow in another), plain SGD zigzags, momentum overshoots past the minimum, and Adam's per-parameter scaling heads there directly.

Known limitations, and what came after

Adam was not the final word on optimization. A widely cited 2018 paper, "On the Convergence of Adam and Beyond," showed that in some settings Adam's exponential moving average can forget important large gradients too quickly, in principle preventing convergence on certain convex problems, and proposed a fix called AMSGrad that keeps a running maximum of past vtv_t values instead of an exponential average.

A separate, more practically important fix came from Loshchilov and Hutter's 2017 paper "Decoupled Weight Decay Regularization," which showed that combining Adam with the traditional L2 weight decay trick (adding a penalty term to the gradient) interacts badly with Adam's adaptive scaling, effectively weakening regularization for parameters with large gradients. Their fix, AdamW, applies weight decay directly to the parameters, decoupled from the adaptive gradient update. AdamW, not the original Adam, is the default optimizer in most modern large-model training today, including for training Transformers.

If a modern paper or codebase says it used "Adam," check the details, it is quite often actually using AdamW under a loose naming convention. The distinction between coupled and decoupled weight decay is small on paper but measurable in practice for large models.

Why this paper still matters

Adam's real contribution was making adaptive optimization robust and simple enough to become the default choice with almost no tuning required. Before it, getting SGD with momentum to train a deep network well usually meant carefully hand-tuning a learning rate schedule. Adam, with its default hyperparameters, reliably got most models training without that ritual.

That reliability is a large part of why deep learning research accelerated as quickly as it did in the years that followed: an optimizer that "just works" removes one entire axis of manual tuning from every new architecture experiment, letting researchers iterate faster on the actual model instead of chasing a fragile hyperparameter schedule.

Key takeaways: Adam tracks an exponential moving average of both the gradient (momentum) and the squared gradient (adaptive scaling), corrects both for their bias toward zero early in training, and combines them into a per-parameter, well-scaled update, largely replacing hand-tuned learning rate schedules for most deep learning.

Found this breakdown useful?

Share it with someone else wrestling with this paper.

Discussion0

Join the Discussion

Sign in to leave comments, reply to others, or like insights.

Sign In to ScaleDojo

No comments yet. Be the first to start the thread!

Enjoyed this? Get more like it.

New paper breakdowns, levels, and one concept worth knowing, straight to your inbox.

No spam, ever. Unsubscribe in one click.

Enjoyed this content?

Your support keeps us creating free resources

We put a lot of hours into researching and writing these guides. If it helped you, consider buying us a coffee. Every bit goes toward keeping ScaleDojo's content free and growing.

$

One-time payment via Stripe. ScaleDojo account required.