Part VIII — Neural Network Fundamentals, Backpropagation & Optimizers · Chapter 9

Optimizers: Momentum, RMSProp, Adam & AdamW

Hook

Part II gave gradient descent a memory. What if it also kept a running estimate of how big its steps have been, and used that too?

Intuition
Step 0 — orange=momentum, teal=RMSProp, grey=Adam

Same ravine as Part II's momentum chapter, same starting point, three optimizers stepping at once. Take a few steps and watch orange zigzag through the steep direction while teal barely wobbles at all.

Formalize

RMSProp — short for Root Mean Square Propagation — keeps a running average of each parameter's squared gradient, then divides the step by its square root — a direction with a big, steep gradient gets its step shrunk automatically:

vβv+(1β)g2,θθηv+ϵgv \leftarrow \beta v + (1-\beta)g^2, \qquad \theta \leftarrow \theta - \frac{\eta}{\sqrt{v}+\epsilon}\,g
  • vv — the running average of the squared gradient.
  • β\beta — the decay rate controlling how much history that running average keeps.
  • gg — the current gradient.
  • θ\theta — the parameter being updated.
  • η\eta — the learning rate.
  • ϵ\epsilon — a tiny constant that keeps the division from blowing up when vv is near zero.
  1. Adam combines RMSProp with momentum

    Adam — short for Adaptive Moment Estimation — keeps a running average of the gradient itself (mm, momentum's idea) and of its square (vv, RMSProp's idea).

  2. Both averages get corrected for startup bias

    Adam corrects both mm and vv for their startup bias before combining them the same way RMSProp does.

Play
momentum=4.12, RMSProp=4.12, Adam=4.12

Watch the distance-to-target numbers rather than the picture. Early on, RMSProp's per-direction scaling lets it beeline almost straight there while momentum is still fighting its own oscillation off the steep axis.

Worked example

At the very first step from (4,1)(4,1) on f(x,y)=x2+10y2f(x,y)=x^2+10y^2:

  1. Find the gradient
    • f/x=2x=2(4)=8\partial f/\partial x = 2x = 2(4) = 8
    • f/y=20y=20(1)=20\partial f/\partial y = 20y = 20(1) = 20

    giving (8,20)(8,20)2.5×2.5\times larger in yy than xx.

  2. Compute RMSProp's first update

    Before its running average has accumulated any history, the update reduces to ηsign(g)/1β\eta \cdot \text{sign}(g)/\sqrt{1-\beta} on each axis — with η=0.3\eta=0.3, β=0.9\beta=0.9, that's a step of 0.3/0.10.9490.3/\sqrt{0.1}\approx0.949 on both axes.

  3. See what that means

    RMSProp actively cancels out the difference in steepness between directions, something plain gradient descent and momentum never do.

Checkpoint

Keep stepping until all three optimizers land within 0.2 of the target.

Step 0 — momentum=4.12, RMSProp=4.12, Adam=4.12
Take a step to try it
Summary
vβv+(1β)g2,θθηv+ϵgv \leftarrow \beta v + (1-\beta)g^2, \qquad \theta \leftarrow \theta - \frac{\eta}{\sqrt{v}+\epsilon}\,g

Adam is the default optimizer for most modern networks precisely because it combines momentum's "keep going in a consistent direction" with RMSProp's "don't let one steep direction dominate the step size." Neither idea alone is enough on landscapes with wildly different curvature in different directions — which every real network has.