Remembering past gradients
Plain gradient steps treat every iteration on its own, so they zig-zag across narrow valleys and crawl along flat ones. Momentum keeps a velocity, a running sum of past gradients: , . Gradients that point the same way keep adding up, while gradients that flip sign cancel out. With a constant gradient the velocity grows toward times the gradient, so ends up taking steps ten times larger than plain descent.
RMSProp fixes a different problem, parameters on different scales. It tracks a running average of the squared gradient of each coordinate and divides the step by , so a coordinate with a large, noisy gradient takes small steps and a coordinate with a small gradient takes bigger ones. Adam combines both ideas: it averages the gradient (, the momentum part) and the squared gradient (, the RMSProp part). Both averages start at zero, which makes them too small in the first steps, so Adam divides by to correct that bias. The usual defaults are , and .
- Momentum: smooths zig-zag and speeds up along consistent directions.
- RMSProp: divides each coordinate by the running root-mean-square of its gradient.
- Adam: both, plus a bias correction because the averages start at zero.
Because Adam's step is about per coordinate whatever the gradient size, becomes the main tuning knob: too large and the loss bounces, too small and training crawls. Decay over time on noisy problems, and compare against a well-tuned SGD with momentum before trusting Adam's result, since the two can settle in different minima.
Lab · what's graded
7 tasks · 100 pts- Momentum velocity15 pts
- The long-run amplification15 pts
- RMSProp average10 pts
- The RMSProp step scale15 pts
- Adam's first step15 pts
- Match method and idea15 pts
- Why per-coordinate scaling helps15 pts