Exercises — AdaGrad and RMSprop
Work each problem on paper first, then open the solution. Problems climb from "just recall the rule" to "design a new optimizer." Every number here is machine-checked.
This page is a workout for the parent note. If any symbol feels unfamiliar, re-read the parent first. Quick key, so you never hit an undefined symbol:
Throughout, one AdaGrad step is and one RMSprop step is
Two figures accompany the analysis problems. Figure 1 (below) plots the effective learning rate over time — the coral curve is AdaGrad, the mint curve is RMSprop; you will reproduce it in Exercises 3.1 and 3.2.

Figure 2 (below) shows RMSprop's automatic braking when a gradient spike arrives; you will compute its numbers in Exercise 4.1.

Level 1 — Recognition
Exercise 1.1
Which quantity does AdaGrad accumulate: the sum of gradients, the sum of squared gradients, or the sum of absolute gradients? State the recurrence.
Recall Solution
AdaGrad accumulates the sum of squared gradients: Squaring makes every term positive (so the accumulator can only grow) and weights large gradients more heavily than small ones. The later restores the original gradient's units.
Exercise 1.2
In RMSprop with , what fraction of the new accumulator comes from the current squared gradient, and what fraction from history?
Recall Solution
The recurrence is . With :
- Fraction from history: (i.e. ).
- Fraction from the current squared gradient: (i.e. ).
Exercise 1.3
True or false: in AdaGrad the effective learning rate can increase from one step to the next. Justify.
Recall Solution
False. and , so never shrinks. Since has in the denominator, it can only stay the same (if ) or decrease. It never increases. This monotone decrease is exactly AdaGrad's eventual death.
Level 2 — Application
Exercise 2.1
AdaGrad, , . A coordinate sees gradients . Compute , , and the size of both update steps.
Recall Solution
Step 1: . Step size . Step 2: . Step size . Notice the raw gradient grew (3 → 4) but the step shrank (0.5 → 0.4): the growing accumulator wins.
Exercise 2.2
RMSprop, , starting . Gradients . Compute and .
Recall Solution
. . It is climbing toward the true mean-square but slowly — the average lags because it only takes of each new value. (This lag near is what Adam's bias correction fixes.)
Exercise 2.3
AdaGrad, , . Two coordinates: A has constant ; B has constant . After step 1, what is each effective learning rate?
Recall Solution
A: , effective rate . B: , effective rate . B's tiny gradient earns a larger effective rate — the equalizing behaviour that helps rare/sparse features move. (Related: Stochastic Gradient Descent would give both the same .)
Level 3 — Analysis
Exercise 3.1
For AdaGrad with a constant gradient and , show the effective learning rate at step is , and confirm it .
Recall Solution
With constant : . Then As , , so . This is AdaGrad's death: after steps the rate is of its step-1 value. See the coral curve in Figure 1.
Exercise 3.2
For RMSprop with constant , find the steady-state value of and the steady-state effective rate. Compare to 3.1.
Recall Solution
At steady state stops changing, call it : The effective rate settles to — a constant, independent of . Contrast 3.1 where AdaGrad's rate . RMSprop stays alive because it averages (bounded) rather than sums (unbounded). This is the mint curve in Figure 1.
Exercise 3.3
Expand the RMSprop recurrence (starting ) to show . What does this tell you about how far back RMSprop "remembers"?
Recall Solution
Write as shorthand for (same quantity, fixed coordinate). Unroll one step at a time: A gradient from steps ago carries weight . With , weight halves roughly every steps — so RMSprop's memory is only a handful of steps deep. Old bumps are geometrically forgotten. This is the whole story of Exponentially Weighted Moving Averages.
Level 4 — Synthesis
Exercise 4.1
An RMSprop coordinate is at steady state (so effective rate ). Suddenly a spike hits: for one step, then back to . With , , compute right after the spike and the effective rate then. Interpret.
Recall Solution
Right after the spike: . Effective rate . The rate dropped to about of normal — RMSprop automatically brakes when it hits a steep, spiky direction, then recovers as the average decays back toward . This built-in damping helps against exploding gradients. See Figure 2.
Exercise 4.2
Adam RMSprop momentum bias correction. Adam's second-moment estimate is — identical in form to RMSprop's with . Given constant , starting , the bias-corrected estimate is . Show that for all (perfect from step 1), whereas raw is too small early.
Recall Solution
From 3.3, So (biased low early — e.g. at it is only ). Bias correction divides by exactly that factor: That is why bias correction exists: RMSprop's raw average underestimates magnitude at the start (see 2.2); Adam corrects it exactly.
Level 5 — Mastery
Exercise 5.1
Design decision. You are training a language model whose embedding rows for rare words receive gradients only occasionally (mostly zero, sometimes large). Would you prefer AdaGrad or RMSprop for those embeddings, and why? Reason with the accumulators.
Recall Solution
For sparse features, AdaGrad shines. Because only sums when a gradient arrives, a rare word's accumulator stays small, so its effective rate stays large — it takes big steps exactly when it finally gets signal. AdaGrad's "death" needs many nonzero gradients to accumulate, which rare words never provide, so death is not a real problem here. RMSprop's decay would forget a rare word's rare gradients between visits, and its warm-up lag (Ex 2.2) hurts. Verdict: AdaGrad (or a hybrid like Adam) for sparse embeddings; RMSprop for dense layers trained for many steps where AdaGrad would die.
Exercise 5.2
Prove a general bound: for AdaGrad with , after steps the effective rate for coordinate satisfies (assuming ). Interpret it as "AdaGrad can never step larger than its very first step allows."
Recall Solution
Since (adding non-negative terms only increases the sum), we have . Taking reciprocals (both sides positive) flips the inequality: So coordinate 's effective rate is capped by its step-1 value and only decreases from there. The first gradient permanently sets the ceiling — a reason people sometimes warm up AdaGrad with a small initial accumulator, or reach for schedules instead.
Exercise 5.3
Synthesis with numbers. Compare AdaGrad vs RMSprop total distance travelled by one coordinate over 3 steps with constant , , , , and (for RMSprop) . Which moves farther, and does the gap widen with more steps?
Recall Solution
AdaGrad (): steps are . Total . RMSprop: . Steps . Total . RMSprop travels much farther because its accumulator () is far smaller than AdaGrad's (). And by Ex 3.1 vs 3.2, AdaGrad's steps keep shrinking like while RMSprop's settle near — so the gap widens without bound as steps continue. This is the whole reason RMSprop replaced AdaGrad for long training runs.
Recall Self-test summary (cover the right side)
Each line below is written as prompt ::: answer — read the prompt, say your answer aloud, then check it against the text after the :::.
AdaGrad accumulator ::: sum of squared grads, , grows forever
RMSprop accumulator ::: EWMA, , stays bounded
AdaGrad effective rate, constant :::
RMSprop steady effective rate, constant ::: , constant
Why bias correction (Adam) ::: raw EWMA is biased low early; divide by
Connections
- AdaGrad and RMSprop — parent note (theory these exercises drill)
- Stochastic Gradient Descent — the one-rate baseline in Ex 2.3
- Momentum — the first-moment half of Adam
- Adam Optimizer — Ex 4.2 builds it from RMSprop
- Exponentially Weighted Moving Averages — the engine behind Ex 3.3
- Learning Rate Schedules — alternative referenced in Ex 5.2
- Vanishing and Exploding Gradients — the braking in Ex 4.1