Bring the mental model from Derivatives; this page will reuse it instead of restarting from zero.
Optimization
Adam Optimizer
Adam is an adaptive optimizer that combines momentum (EMA of gradients) with per-parameter RMS normalization (EMA of squared gradients).

Concept Structure
Adam Optimizer
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learning map
Adam OptimizerConceptual Bridge
What should feel connected as you move through this page.
Adam is an adaptive optimizer that combines momentum (EMA of gradients) with per-parameter RMS normalization (EMA of squared gradients).
The next edge should feel earned: use the demo prediction here before following Weight Decay & AdamW: Decoupled Regularization.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
Training is noisy: mini-batch gradients bounce around, and different parameters can have very different natural scales.
Adam combines two simple stabilizers:
- Momentum: smooth the gradient over time, so you don’t overreact to one noisy batch.
- RMS normalization: keep an exponential moving average of squared gradients so each parameter gets a step size that matches its typical gradient scale.
A useful mental model is: Adam maintains a per-parameter “velocity” (direction) and a per-parameter “uncertainty/scale” (how big gradients usually are), then divides one by the other.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let be the (stochastic) gradient at step .
Adam keeps exponential moving averages:
Because and start at zero, Adam uses bias correction:
Update rule:
The division is elementwise, so Adam acts like a diagonal preconditioner: coordinates with consistently large gradients get smaller effective steps, while coordinates with consistently small gradients get larger relative steps. Bias correction matters most early in training because the moving averages are initialized at zero. The small is not a learning signal; it prevents division by zero and can affect stability when gradients are tiny.
Typical defaults: , , .
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import torch
alpha = 0.1
beta1, beta2 = 0.9, 0.999
eps = 1e-8
theta = torch.tensor([3.0], requires_grad=True)
m = torch.zeros_like(theta)
v = torch.zeros_like(theta)
for t in range(1, 51):
loss = (theta ** 2).sum()
loss.backward()
g = theta.grad.detach()
m = beta1 * m + (1 - beta1) * g
v = beta2 * v + (1 - beta2) * (g * g)
mhat = m / (1 - beta1 ** t)
vhat = v / (1 - beta2 ** t)
theta = (theta - alpha * mhat / (vhat.sqrt() + eps)).detach().requires_grad_(True)
if t in [1, 5, 10, 50]:
print(t, "theta=", theta.item(), "loss=", loss.item())
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
Use the demo to compare Adam to SGD variants and see how the moving averages change the effective step size.
Live Concept Demo
Explore Adam Optimizer
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what Adam Optimizer should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Adam is an adaptive optimizer that combines momentum (EMA of gradients) with per-parameter RMS normalization (EMA of squared gradients).

Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Adam Optimizer should make visible.
Visual Inquiry
Make the image answer a mathematical question
Adam is an adaptive optimizer that combines momentum (EMA of gradients) with per-parameter RMS normalization (EMA of squared gradients).
Which visible object should carry the first intuition?
Pick the cue that should make Adam Optimizer easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Grounds Adam's first- and second-moment estimates, bias correction, and adaptive step-size mechanics.
Open sourceClaim Review
Adam is an adaptive optimizer that combines momentum (EMA of gradients) with per-parameter RMS normalization (EMA of squared gradients).
Claims without a substantive review badge still need exact source-support review.
kingma-2014-adam
Use equation, code, and demo objects to check whether the source support is operational.
Kingma and Ba's Algorithm 1 initializes m0 and v0 to zero, updates biased first-moment and second raw-moment estimates from gt and gt^2, computes bias-corrected estimates, and updates parameters with alpha*mhat_t/(sqrt(vhat_t)+epsilon), with vector operations elementwise. The page's equations, code witness, and demo instantiate those mechanics and expose the per-coordinate effective step scaling.
Sources: Adam: A Method for Stochastic OptimizationThis checks Adam's original adaptive-moment update mechanics, not convergence guarantees, AdamW decoupled weight decay, AMSGrad, optimizer generalization debates, sparse-gradient variants, or framework-specific implementation details.A bounded review summary is present; still check caveats and exact source scope.Checked Kingma and Ba Algorithm 1 plus sections 2 and 3: the paper initializes m0 and v0 as zero vectors, updates biased first and second raw moment estimates from gt and gt^2, divides by 1-beta1^t and 1-beta2^t for bias correction, states vector operations are element-wise, and updates theta with alpha*mhat/(sqrt(vhat)+epsilon). Scope is original Adam update mechanics only.
Reviewer: codex+oracle; reviewed 2026-05-06Practice Loop
Try the idea before it explains itself
Adam is an adaptive optimizer that combines momentum (EMA of gradients) with per-parameter RMS normalization (EMA of squared gradients).
Before touching the demo, predict one visible change that should happen in Adam Optimizer.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Adam Optimizer
What is the smallest example that makes Adam Optimizer click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:optimization/adam.
- Source ids to inspect: kingma-2014-adam
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Adam Optimizer Object key: concept:optimization/adam Context: Optimization Anchor id: concept/concept-notebook/optimization/adam Open question: What is the smallest example that makes Adam Optimizer click without losing the math? Evidence to inspect: - Source ids to inspect: kingma-2014-adam - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/optimization/adam
concept:optimization/adam