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:
In words: is the running total of squared gradients () seen so far for this parameter; the update subtracts the learning rate () divided by the square root of that running total (plus a tiny 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 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:
Here is a moving average of squared gradients, weighted by a decay factor (commonly ) 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 , , over three steps, with , . Running sums: , , . Effective step divisors: , , . So the effective learning rate goes , then , then — 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 , : ; ; . Divisors: , , — 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, would shrink back down and the effective rate would rise again — something AdaGrad's ever-growing can never do.
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
- 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?
- With instead of , does RMSProp forget the past faster or slower?
- 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 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)