AI Research Scientist · Optimization Algorithms & Schedules
Adam optimizer
Adam optimizer
First and second moment estimates
For each parameter, Adam keeps two running averages of its gradients: , an exponentially-decayed mean (first moment), and , an exponentially-decayed mean of squared gradients (second moment, uncentered variance). Both update every step: , .Bias-Correcting the Moment Estimates
- 1Zero-initialized state, so raw estimates start biased low, especially with typical , .
- 2Divide by (1 − β^t) and rescale the raw estimates upward, most strongly at small .
- 3Correction fades over timeAs grows, , so , — the fix matters only early in training.
- 1Raw moments: , .WhyAfter one step, and .
- 2Bias-corrected: , .WhyDividing by removes the early zero-init bias.
- 3Update ratio: , then scaled by .WhyRoot-second-moment normalization keeps the step near unit scale.
Recall check from the same lesson
Because Adam divides by the bias-corrected second moment, a parameter whose gradient is mostly zero (sparse) gets a proportionally larger effective step on the rare occasions it does receive a nonzero gradient, compared to a parameter with the same-magnitude but constantly-present gradients.
Review the explanation
Answer: True. When a parameter's gradient is mostly zero, its running second-moment estimate $v_t$ decays toward zero between the rare nonzero gradients. So when a nonzero gradient does arrive, $\sqrt{\hat v_t}$ is small, making the normalized step $\hat m_t/(\sqrt{\hat v_t}+\epsilon)$ large relative to a parameter whose gradient is always present at similar magnitude, where $v_t$ stays consistently high and keeps the normalized step near unit scale. This per-parameter adaptivity is exactly why Adam handles sparse gradients well.
Sources
One sitting · 20–30 minutes
A focused session on your AI Research Scientist interview
LearnBench starts from what you already know — skip what you have, master what you’re missing.
Start now