Quant Memo
Core

RMSProp and AdaGrad

Instead of using the same learning rate for every parameter, these optimizers shrink the step size for parameters that have been getting large or frequent gradients, and leave it larger for parameters that rarely move.

Prerequisites: Stochastic Gradient Descent, Gradient Descent

Plain gradient descent uses one learning rate for every parameter in the model. But some parameters — say, a weight connected to a rare input feature — only ever get small, infrequent gradient updates, while others get hit with large gradients constantly. A single shared learning rate is a compromise that is too small for the rarely-updated parameters and possibly too large for the frequently-updated ones. Adaptive learning-rate methods give each parameter its own effective step size, shrunk or grown based on that parameter's own gradient history.

The analogy: a thermostat per room, not one for the house

A single thermostat for an entire building has to compromise: too hot in some rooms, too cold in others, because it can't see that the south-facing room gets more sun than the basement. Now imagine every room has its own thermostat that watches its own recent temperature swings and adjusts its own heater accordingly — a room that has been swinging wildly gets gentler, smaller corrections; a room that barely changes gets bigger ones. AdaGrad and RMSProp do exactly this per parameter: each one tracks its own history of gradient sizes and divides its own learning rate by a measure of how large those gradients have typically been.

AdaGrad: divide by the running total, forever

AdaGrad keeps a running sum of the squares of every past gradient for each parameter, then divides that parameter's learning rate by the square root of that sum:

Gt=Gt1+gt2,θt+1=θtηGt+ϵgtG_t = G_{t-1} + g_t^2, \qquad \theta_{t+1} = \theta_t - \frac{\eta}{\sqrt{G_t + \epsilon}}\, g_t

In words: GtG_t is the running total of squared gradients (gtg_t) seen so far for this parameter; the update subtracts the learning rate (η\eta) divided by the square root of that running total (plus a tiny ϵ\epsilon to avoid dividing by zero), times the current gradient. A parameter with a history of large gradients ends up dividing by a large number, so its effective step shrinks; a parameter with small gradient history keeps a nearly-full-size step.

The flaw: because GtG_t only ever grows, the effective learning rate only ever shrinks, monotonically, for the whole run — eventually it can shrink so much that learning effectively stalls, even on parameters that could still use larger updates.

RMSProp: forget the distant past

RMSProp fixes that by replacing the running sum with a running exponential average, so old gradients fade out instead of accumulating forever:

Et=βEt1+(1β)gt2,θt+1=θtηEt+ϵgtE_t = \beta E_{t-1} + (1-\beta) g_t^2, \qquad \theta_{t+1} = \theta_t - \frac{\eta}{\sqrt{E_t + \epsilon}}\, g_t

Here EtE_t is a moving average of squared gradients, weighted by a decay factor β\beta (commonly 0.90.9) that keeps recent gradients dominant and lets older ones decay away. This lets the effective step size grow back up if a parameter's gradients quiet down later in training, instead of being permanently shrunk by early, large gradients.

Worked example 1: AdaGrad's ever-shrinking step

A parameter sees gradients g1=4g_1 = 4, g2=3g_2 = 3, g3=2g_3 = 2 over three steps, with η=1\eta = 1, ϵ0\epsilon \approx 0. Running sums: G1=16G_1 = 16, G2=16+9=25G_2 = 16+9=25, G3=25+4=29G_3 = 25+4=29. Effective step divisors: 16=4\sqrt{16}=4, 25=5\sqrt{25}=5, 295.39\sqrt{29}\approx5.39. So the effective learning rate goes 1/4=0.251/4=0.25, then 1/5=0.21/5=0.2, then 1/5.390.1861/5.39\approx0.186 — steadily shrinking even though the raw gradients themselves are also shrinking, compounding the slowdown.

Worked example 2: RMSProp lets the step recover

Same gradients, RMSProp with β=0.9\beta=0.9, E0=0E_0=0: E1=0.9(0)+0.1(16)=1.6E_1 = 0.9(0)+0.1(16)=1.6; E2=0.9(1.6)+0.1(9)=2.34E_2=0.9(1.6)+0.1(9)=2.34; E3=0.9(2.34)+0.1(4)=2.506E_3=0.9(2.34)+0.1(4)=2.506. Divisors: 1.61.26\sqrt{1.6}\approx1.26, 2.341.53\sqrt{2.34}\approx1.53, 2.5061.58\sqrt{2.506}\approx1.58 — the divisor grows far more slowly than AdaGrad's, since old squared gradients are down-weighted rather than kept in full. If a later gradient were tiny, EtE_t would shrink back down and the effective rate would rise again — something AdaGrad's ever-growing GtG_t can never do.

Gradient descent
parameter →
position -0.623loss -0.141gradient -0.930converging

AdaGrad RMSProp step size
AdaGrad's effective step size only ever falls; RMSProp's can rise again once recent gradients quiet down.

What this means in practice

RMSProp (and its close relative Adam, which adds momentum on top) is the practical default for training deep networks — AdaGrad's monotonic shrinkage makes it a poor fit for long training runs, though it still works well for short, sparse-gradient problems like some linear models on sparse text features, which is what it was originally designed for.

Both methods divide each parameter's learning rate by a measure of that parameter's own gradient history; AdaGrad accumulates that history forever and can stall, while RMSProp uses a decaying average so the effective rate can recover.

Practice

  1. A parameter has been getting tiny gradients for 1,000 steps, then suddenly gets a large one. Which method reacts faster: AdaGrad or RMSProp? Why?
  2. With β=0.99\beta = 0.99 instead of 0.90.9, does RMSProp forget the past faster or slower?
  3. Explain in one sentence why AdaGrad's monotonic shrinkage is actually a reasonable design for sparse features.

It's tempting to think adaptive methods remove the need to tune a learning rate at all, since each parameter gets its "own" rate. In practice the shared multiplier η\eta out front still matters enormously — set it too high and RMSProp or AdaGrad can still diverge, just less easily than plain SGD. Adaptive scaling changes the relative step sizes across parameters; it does not make the overall step size choice optional.

Related concepts

Practice in interviews

Further reading

  • Duchi, Hazan & Singer, Adaptive Subgradient Methods (AdaGrad), JMLR (2011)
  • Tieleman & Hinton, RMSProp, Lecture 6.5, COURSERA Neural Networks for Machine Learning (2012)
ShareTwitterLinkedIn