3.2.4 · D1Training Deep Networks

Foundations — AdaGrad and RMSprop

2,607 words12 min readBack to topic

This page builds every symbol used in the parent note from absolute zero. If you have never seen a gradient, a subscript, or a square-root-in-a-denominator, start at line one and don't skip.


1. A parameter — the knob we are turning

Picture it: imagine a mixing board with many sliders. Each slider is one . Push it up or down and the network's predictions change.

Why the topic needs it: the whole point of AdaGrad/RMSprop is to decide how far to push each slider on each step. No parameter, nothing to update.


2. The subscripts and which knob, when

There are two labels stuck onto every symbol. They answer two different questions.

So reads: "the value of slider number at time-step ." Two labels, two totally separate meanings — don't blend them.

Figure 1 (below) lays the sliders out as a grid: move right and time advances; move up and you pick a different coordinate . The yellow dot is one specific — one slider frozen at one moment. Use it to see that the two subscripts point along two different axes.

Figure — AdaGrad and RMSprop

Why the topic needs it: AdaGrad's whole trick is a per-coordinate step, so we must be able to talk about coordinate alone. And because the step depends on history, we must track time .


3. Loss — the "how wrong are we" number

Picture it: is the height of a landscape. The sliders are your east–west, north–south position. Walk to the lowest valley → smallest loss.


4. The gradient and the symbol — which way is downhill

Here is the first genuinely new tool. Why do we need it?

Picture it: stand on a hillside. The gradient is an arrow pointing in the steepest uphill direction; its length is how steep. To go down, we step in the opposite direction — that minus sign is where the "" in every update rule comes from.

Figure 2 (below) draws the loss as a bowl seen from above (the thin white rings are equal-height contours). The yellow dot is your position ; the pink arrow is pointing steepest uphill; the blue arrow is the actual step pointing downhill toward the star (the valley). It shows exactly why we subtract the gradient.

Figure — AdaGrad and RMSprop

Why the topic needs it: is the raw material. AdaGrad/RMSprop never change the direction points — they only rescale how big a step to take. See Stochastic Gradient Descent for where these gradients come from (from mini-batches, which makes them noisy — a reason we later want to average their sizes).


5. The learning rate — how big a step

Picture it: is your stride length. Too big → you leap over the valley and bounce around. Too small → you inch along and never arrive. See Learning Rate Schedules for changing over time as an alternative to what AdaGrad does automatically.

Why the topic needs it: AdaGrad and RMSprop take this single global and secretly turn it into a different effective stride for every slider. That is their entire job.


6. Squaring and the square root — turning slopes into "sizes"

The rules square the gradient and later take a square root. Why both?

Figure 3 (below) compares three curves as the gradient runs left-to-right: blue keeps its sign, pink gives size only, yellow gives size and punishes big slopes (it shoots up fast). The two yellow dots mark — proof that squaring throws the sign away.

Figure — AdaGrad and RMSprop

Why the topic needs it: the accumulators and (next) are built from ; the update divides by of them. Averaging is a mean-square measure of gradient magnitude. (Careful: the true statistical variance is ; our is only the raw mean of the squares, which equals the variance only when the average gradient is zero. The parent note scales by this raw second moment, not by the variance.) This contrasts with Momentum, which averages the plain gradient (the first moment).


7. The accumulator — remembering all past slope-sizes

Picture it: a bucket per slider. Every step you pour in the current squared slope. The bucket only fills — it never empties.

Why the topic needs it (and its fatal flaw): dividing by shrinks the step for sliders that have seen big/frequent slopes. But because the bucket only grows, and the step : AdaGrad eventually freezes. That flaw is the reason RMSprop exists.


8. The EWMA — remembering only recent slope-sizes

Picture it: the same bucket, but with a small hole in the bottom. Each step you pour in a little new water and some old water leaks out. The level stops rising and holds steady at the recent average. The full mechanics live in Exponentially Weighted Moving Averages.

Figure 4 (below) runs both accumulators on a constant slope . The pink line is AdaGrad's sum : it climbs forever (), so its step dies. The blue line is RMSprop's EWMA : it settles onto the yellow dashed line at and stays there — a bounded memory that keeps the step alive.

Figure — AdaGrad and RMSprop

Why the topic needs it: replacing (a sum) with (a bounded average) is the single change from AdaGrad to RMSprop. Because a bounded average never blows up, the step never dies.


9. The tiny number — a safety cushion

Picture it: a rubber bumper stopping the denominator from ever touching .


10. Putting the symbols together

Everything the parent note writes is now just these pieces assembled:

Combine RMSprop's per-slider stride with Momentum's averaged direction and you get the Adam Optimizer. Per-slider scaling also tames wildly different gradient magnitudes — the subject of Vanishing and Exploding Gradients.


Prerequisite map

How to read this diagram: each box is one idea from this page; an arrow means "you need before makes sense" (X feeds into Y). Start at the top boxes with no incoming arrows and follow the arrows downward — that is a valid order to learn these in. The two bottom-most boxes are AdaGrad and RMSprop, which everything else builds toward.

Parameter theta a knob

Update rule new = old minus step

Subscripts i and t which knob when

Loss L how wrong

Gradient g direction of steepest rise

Learning rate eta stride length

Square g removes sign weights big slopes

Accumulator G sum of squares

EWMA E of g squared decay rho

AdaGrad divides eta by root G

RMSprop divides eta by root of average

Epsilon safety cushion

Per parameter adaptive step size


Equipment checklist

I can explain what a parameter is in plain words
An adjustable number (a slider) inside the network; training picks its value.
I know what the two subscripts in mean
= time-step (which update), = coordinate (which parameter). Same slider, next moment when advances.
I can say what the loss is and picture it
A single "how wrong" number; picture it as the height of a landscape we want to minimise.
I know what the gradient is
The list of slopes of measured at the current parameters — an arrow pointing steepest uphill; we step opposite to go down, hence the minus sign.
I can read the sign of
Positive → decrease ; negative → increase ; zero → flat, no move.
I know what the learning rate controls
The overall step size (stride length); too big overshoots, too small crawls.
I know why we square the gradient
To drop the sign and punish large slopes more; later restores the original scale.
I can write the AdaGrad accumulator with its base case
and — a bucket that only fills.
I know why AdaGrad eventually freezes
only grows, so and the effective step .
I can write the RMSprop EWMA with its base case
and — a bounded, leaky average.
I know the difference between and
= memory length of the squared-gradient average; = overall step size.
I know why is there
To prevent division by zero when the accumulator is tiny.
I know why is the raw second moment, not the variance
Variance is ; our is just the mean of the squares, equal to variance only when the mean gradient is zero.