Skip to content

AdaGrad and RMSProp

How AdaGrad and RMSProp scale each parameter by squared-gradient history, why their memories differ, and how initialisation and epsilon conventions affect updates.

AdaGrad and RMSProp are adaptive gradient descent methods that divide each parameter's current gradient by a scale built from its past squared gradients. AdaGrad retains the entire history; RMSProp discounts older observations. When fitting a financial prediction model, this gives different weights different effective learning rates without specifying a separate rate for every weight.

One learning rate, different denominators

Let gt,ig_{t,i} be the gradient of the training loss function with respect to parameter ii, evaluated before update tt. For the unconstrained, diagonal form of AdaGrad, start with G0,i=0G_{0,i}=0 and use
Gt,i=Gt−1,i+gt,i2,θt,i=θt−1,i−ηgt,iGt,i+ϵ.G_{t,i}=G_{t-1,i}+g_{t,i}^2, \qquad \theta_{t,i}=\theta_{t-1,i}-\eta\frac{g_{t,i}}{\sqrt{G_{t,i}}+\epsilon}.
Here η>0\eta>0 is the base learning rate and ϵ>0\epsilon>0 stabilises division. The accumulator is a sum of squares, not an average. A coordinate with more accumulated squared-gradient activity receives a smaller multiplier on its current gradient. This motivates AdaGrad for sparse features: an infrequently active coordinate need not inherit the smaller multiplier of a frequently active one. That comparison concerns gradient history, not a guarantee that a rare feature is informative. The original AdaGrad paper develops both diagonal and full-matrix methods; the formula here is the simpler diagonal case without constraints or a separate regularisation term.
RMSProp replaces the running total with an exponentially weighted average:
vt,i=ρvt−1,i+(1−ρ)gt,i2,θt,i=θt−1,i−ηgt,ivt,i+ϵ,v_{t,i}=\rho v_{t-1,i}+(1-\rho)g_{t,i}^2, \qquad \theta_{t,i}=\theta_{t-1,i}-\eta\frac{g_{t,i}}{\sqrt{v_{t,i}}+\epsilon},
with v0,i=0v_{0,i}=0 and 0≤ρ<10\leq\rho<1. The variant here is uncentred, without momentum or bias correction. It tracks squared-gradient scale rather than variance: no squared mean is subtracted. Hinton's Lecture 6, crediting Tijmen Tieleman, introduces this moving-average division.
Both formulas place epsilon outside the square root. This matches the documented PyTorch Adagrad update with learning-rate decay and weight decay disabled, and PyTorch RMSprop with centering, momentum and weight decay disabled, checked 1 November 2026. An implementation using v+ϵ\sqrt{v+\epsilon} has a different denominator from v+ϵ\sqrt v+\epsilon. Check the formula and initial accumulator, rather than matching parameter names alone.

Two unchanged gradients, four different moves

Consider a stipulated scalar gradient sequence g1=g2=2g_1=g_2=2, base learning rate η=0.1\eta=0.1 and RMSProp decay ρ=0.9\rho=0.9. Set ϵ=0\epsilon=0 only for this analytic toy: every accumulator used in a divisor is positive. Practical implementations use positive epsilon, including when a coordinate's gradient history is zero.
UpdateAdaGrad accumulatorAdaGrad step magnitudeRMSProp accumulatorRMSProp step magnitude
1440.10000000000.10000000000.40.40.31622776600.3162277660
2880.07071067810.07071067810.760.760.22941573390.2294157339

For example, the second RMSProp average is 0.9(0.4)+0.1(4)=0.760.9(0.4)+0.1(4)=0.76, giving a step magnitude of 0.1(2)/0.760.1(2)/\sqrt{0.76}. Since the gradients are positive, each update subtracts the listed amount from the parameter. These are prescribed observations, not a simulated loss trajectory or a benchmark.

Analytic toy with gradient 2 and learning rate 0.1: AdaGrad accumulators 4 and 8 give steps 0.100000 and 0.070711; uncorrected RMSProp accumulators 0.4 and 0.76 give steps 0.316228 and 0.229416. With the gradient held constant, AdaGrad steps keep shrinking while RMSProp steps approach 0.1.
Analytic toy with gradient 2 and learning rate 0.1: AdaGrad accumulators 4 and 8 give steps 0.100000 and 0.070711; uncorrected RMSProp accumulators 0.4 and 0.76 give steps 0.316228 and 0.229416. With the gradient held constant, AdaGrad steps keep shrinking while RMSProp steps approach 0.1.
Identical incoming gradients produce different steps because the denominators remember different histories. The large early RMSProp steps reflect its zero-initialised average, not evidence of better optimisation.

Holding that nonzero gradient constant gives exact expressions:

Gt=4t,vt=4(1−ρt),∣ΔθtAdaGrad∣=0.1t,∣ΔθtRMSProp∣=0.11−ρt.G_t=4t,\qquad v_t=4(1-\rho^t),\qquad \lvert\Delta\theta_t^{\mathrm{AdaGrad}}\rvert=\frac{0.1}{\sqrt t},\qquad \lvert\Delta\theta_t^{\mathrm{RMSProp}}\rvert=\frac{0.1}{\sqrt{1-\rho^t}}.
AdaGrad's steps shrink indefinitely in this example. RMSProp's approach 0.10.1 from above as its zero-initialised average fills. Its early squared-gradient average is below its long-run value, making the denominator smaller; that initialisation transient explains the larger early moves. No correction factor is applied in this RMSProp variant. Adam adds signed gradient memory and moment corrections and is a separate algorithm.

What forgetting buys—and what it cannot decide

With fixed η\eta, AdaGrad's effective multiplier cannot increase because its accumulator cannot decrease. The multiplier tends to zero if the cumulative squared gradients diverge; monotonic accumulation alone does not establish that limit. A large early gradient remains in its denominator permanently.

RMSProp gives a squared gradient observed kk updates ago a weight proportional to ρk\rho^k. Old large observations can therefore lose influence, allowing the multiplier to increase again. This adapts to changes in gradients during fitting; it does not establish that the method can handle a change in the market's predictive relationships.

Neither method averages signed gradients in the numerator in the forms shown here. That is the separate role of momentum. Neither removes the choice of base learning rate, decay, feature scaling or stopping rule, and neither is universally best. Compare training behaviour and chronological validation on the actual modelling task. The optimisation-choices lesson extends the recurrence comparison to SGD, momentum and Adam; its preview is public and the full lesson requires membership.

Sources

Last updated
  • machine learning
  • optimisation
  • adagrad
  • rmsprop
  • gradient descent
← Back to the glossaryBack to top ↑