Intuition The ONE core idea of this whole topic
Adam is a rule for updating numbers (the network's weights) a little at a time so a loss shrinks — and its trick is to give each weight its own step size by remembering two things about that weight's recent gradients: their average direction and their typical size . Everything below is just the vocabulary you need before that sentence makes full sense.
This page assumes you have seen nothing . We name every letter, draw the picture it stands for, and say why the topic can't live without it. Read top to bottom — each item uses only the ones above it.
Before any Greek letters, picture the whole job.
θ (the knob)
A parameter is a single tunable number inside the network — a "knob" we are allowed to turn. We write one such knob as θ (Greek letter theta ). A real network has millions of them; think of θ as any one knob , and remember the same rule runs on all of them independently.
Picture: a slider you can drag left/right. Its position is a number.
L (the badness score)
The loss L is one number that says how wrong the network currently is. Big L = very wrong. Our entire goal is to make L small.
Picture (see figure): a landscape where height = L . We want to walk downhill .
g and the symbol ∇ θ L
The gradient g answers one question: "if I nudge this knob up a tiny bit, does the loss go up or down, and how steeply?" The notation ∇ θ L (read "nabla theta L", or "the gradient of L with respect to θ ") is just the formal name for that slope.
Sign of g : which way is uphill. We step the opposite way.
Size ∣ g ∣ : how steep the hill is right here.
Picture (see figure): an arrow on the loss landscape pointing straight uphill. We move against it.
Intuition Why a slope and not the loss value itself?
Knowing the loss is 5 tells you nothing about which way to move. Knowing the slope tells you the direction and steepness — exactly the two facts a step needs. That is why every optimizer is built on g , never on L directly.
The subscript t (as in g t , θ t ) just means "at time step t " — step 1, step 2, step 3… One minibatch of data = one t .
η (step size)
==η == (Greek eta ) is how big a step we take each time. Small η = tiny cautious steps; large η = big leaps that may overshoot.
Picture: the length of each footstep as you walk downhill.
The simplest possible rule, Stochastic Gradient Descent , is:
θ ← θ − η g t .
Read the arrow ← as "becomes" : the new knob value is the old one minus a step of size η in the downhill direction. That minus sign is why we go down the hill, not up.
Intuition Why SGD is not enough (the gap Adam fills)
One global η must serve every knob. But some knobs sit on cliffs (huge g ) and others on plains (tiny g ). A step size good for the cliff is far too timid for the plain, and vice-versa. Adam's whole reason to exist is: give each knob its own effective step size.
Adam never trusts a single noisy gradient. It keeps a running smoothed value . The tool for that is the exponential moving average.
Definition Exponential moving average (EMA) and decay
β
Given a stream of numbers x 1 , x 2 , x 3 , … , its EMA is built one step at a time:
m t = β m t − 1 + ( 1 − β ) x t , m 0 = 0.
The decay β (Greek beta ), a number between 0 and 1 , sets the memory length :
β near 1 ⇒ long memory, very smooth, slow to react.
β near 0 ⇒ short memory, jumpy, follows the newest value.
Picture (see figure): noisy dots (the raw x t ) with a smooth curve threaded through them. Each old value's influence fades geometrically — that's the "exponential" in the name.
Why is this the exponential moving average? Unrolling the recursion, the value from k steps ago is multiplied by β k — and β k shrinks like a decaying exponential. See Exponential Moving Average for the full unrolling; Adam uses it twice.
Intuition Why average at all?
Each minibatch gradient g t is a noisy sample — a slightly wrong estimate of the true slope (this noise is exactly the subject of Bias-Variance in Gradient Estimation ). Averaging many samples cancels the random wobble and reveals the trend. See Momentum and Nesterov Acceleration for how this same average also builds "momentum" down a valley.
The parent note calls β t (beta raised to the power t ) the "bias factor" — that is just β multiplied by itself t times, and because β < 1 , it shrinks toward 0 as t grows. Hold that thought; it powers bias correction .
Adam runs the EMA machine on two different streams .
m t — the smoothed gradient (direction)
Feed the EMA the gradient itself, x t = g t :
m t = β 1 m t − 1 + ( 1 − β 1 ) g t .
m t estimates the average gradient — mostly which way to go. Its decay is called β 1 (default 0.9 ).
Picture: a smoothed arrow that ignores single-step jitter.
v t — the smoothed squared gradient (magnitude)
Feed the EMA the square of the gradient, x t = g t 2 :
v t = β 2 v t − 1 + ( 1 − β 2 ) g t 2 .
g t 2 is always positive and grows with steepness, so v t estimates the typical size of the gradient in this coordinate. Its decay is β 2 (default 0.999 — longer memory than β 1 ). This magnitude idea is the heart of RMSProp .
Picture: a smoothed "how bumpy is it here" meter.
Common mistake "Why square the gradient — why not use
∣ g t ∣ ?"
Why it feels right: the absolute value also measures size. The fix: squaring makes the math of expectations clean (v t estimates E [ g 2 ] , the second moment ), and v t then recovers a size in the original units. It's the same reason variance uses squares, not absolute values.
The little hats — m ^ t and v ^ t — are the bias-corrected versions, m t / ( 1 − β 1 t ) and v t / ( 1 − β 2 t ) . Because m 0 = v 0 = 0 , the raw EMAs start too small; dividing by ( 1 − β t ) un-shrinks them. The parent note proves this exactly; here just know: a hat means "fixed for the cold start."
x — the square root
The square root v ^ t undoes the squaring from step 3, turning a "typical squared size" back into a "typical size" in the gradient's own units. That is why the update divides by v ^ t and not by v ^ t — the units must match m ^ t on top.
ϵ — the tiny floor
==ϵ == (Greek epsilon , default 1 0 − 8 ) is a tiny positive number added in the denominator, v ^ t + ϵ . It stops division-by-zero when v ^ t is near 0 , and it caps how large the effective step can grow.
Picture: a small pebble under the seesaw so it can never touch the ground.
λ — the weight-decay strength (AdamW)
==λ == (Greek lambda ) controls how hard we shrink every weight toward zero each step, the − η λ θ term in AdamW. Bigger λ = stronger pull to zero = simpler model. This is the "decoupled" cousin of Weight Decay and L2 Regularization .
Picture: a gentle spring always tugging each slider back toward 0 .
The figure shows the ratio m ^ t / v ^ t as a signal-to-noise dial: consistent gradients (mean ≈ size) give a full step near ± 1 ; noisy gradients (mean ≪ size) give a step near 0 . That normalization is the reason Adam adapts per-parameter.
second moment v magnitude
Each arrow means "you need the left box before the right one makes sense." Notice how everything funnels through the gradient g — that single arrow is the whole reason optimizers work.
Cover the right side and test yourself.
What does the knob θ physically represent? One tunable number (weight) inside the network; the same update runs on every one.
What single number is L , and what do we do to it? The loss — a badness score we try to make small.
What two facts does the gradient g carry? Its sign (which way is uphill) and its size ∣ g ∣ (how steep).
Why do we step against g (the minus sign)? g points uphill; we want to go downhill toward lower loss.
What does the learning rate η control? The length of each step.
Write the EMA recursion from memory. m t = β m t − 1 + ( 1 − β ) x t , with m 0 = 0 .
What does β near 1 do to the EMA's memory? Makes it long / very smooth / slow to react.
What stream feeds m t vs v t ? m t gets the gradient g t ; v t gets the squared gradient g t 2 .
What does a "hat" (m ^ , v ^ ) signify? Bias-corrected — un-shrunk to fix the cold start from 0 .
Why divide by v ^ t and not v ^ t ? The square root restores original gradient units so numerator and denominator match.
What two jobs does ϵ do? Prevents divide-by-zero and caps the maximum effective step.
What does λ control in AdamW? The strength of uniform weight decay pulling each weight toward zero.