Adagrad

Also known as: Adaptive gradient algorithm

On this page 7

Adagrad, short for the adaptive gradient algorithm, is an optimization method used in neural network training that assigns every parameter its own learning rate, scaled down in proportion to the square root of the accumulated squared gradients for that parameter. Parameters that receive large or frequent gradients are updated cautiously, while parameters that are rarely touched keep comparatively large steps.

Introduced in 2011, Adagrad was the first widely adopted per-parameter adaptive optimizer and the direct ancestor of RMSprop, Adam and AdamW. It removed much of the manual tuning that plain stochastic gradient descent demanded, at the cost of a monotonically decaying step size that can stall long training runs.

How the accumulator shapes each step

Adagrad keeps one extra number per parameter, usually called the accumulator or state. At every step it adds the square of the current gradient to that number, then divides the raw gradient by the square root of the accumulated total before applying the update.

Written compactly, the state update is G = G + g^2 and the parameter update is w = w - lr * g / (sqrt(G) + eps), where g is the gradient for one parameter, lr the base learning rate and eps a small constant. The components have distinct roles, summarized below.

SymbolMeaningEffect on the step
gCurrent gradient for one parameterSets direction and raw magnitude
GRunning sum of squared gradientsDivides the step, so it only grows
lrGlobal base learning rateScales every parameter uniformly
epsNumerical stability constantPrevents division by zero early on
Quantities in the Adagrad update

Because the accumulator never decreases, the effective step for each parameter forms a non-increasing sequence. This property gives Adagrad strong theoretical guarantees for convex problems and is simultaneously the source of its main practical weakness.

Hyperparameters and typical values

Adagrad is appealing partly because it exposes very few knobs. Only the base learning rate genuinely requires attention; the remaining settings are usually left at their defaults.

SettingTypical valueWhat it controls
Base learning rate0.01 to 0.1Overall step size before scaling
Epsilon1e-10 to 1e-8Stability when the accumulator is tiny
Initial accumulator0 or 0.1How aggressive the first updates are
Weight decay0 to 1e-4Optional regularization term
Settings and usable ranges

The base learning rate is commonly set an order of magnitude higher than one would choose for plain stochastic gradient descent, because the division by the accumulated norm shrinks steps quickly. A value near 0.01 is the usual starting point.

One practical consequence is memory: Adagrad stores one additional value per parameter, which doubles optimizer memory relative to plain gradient descent but remains half of what Adam requires.

Adagrad compared with later adaptive optimizers

Every modern adaptive method descends from the same idea of normalizing by gradient magnitude. The differences lie in how history is weighted and whether momentum is included.

OptimizerGradient historyMomentumStep size over time
AdagradFull unweighted sumNoneAlways decreasing
RMSpropExponential moving averageOptionalCan recover
AdamMoving averages of both momentsBuilt inCan recover
AdamWSame as AdamBuilt inCan recover
AdafactorFactored second momentOptionalCan recover
Adaptive optimizers side by side

RMSprop was created precisely to fix the decay problem by replacing the sum with a decaying average, so old gradients eventually stop constraining the step. Adam added first-moment momentum on top of that. Consequently Adagrad is rarely the default for deep networks today, yet it is still used where its behavior is exactly what the problem needs.

When Adagrad remains the right choice

Adagrad excels on sparse, high-dimensional problems where most features appear in only a handful of examples. Rare features accumulate little gradient history, so they retain large effective learning rates and are learned properly instead of being drowned out by common features.

SituationRecommended choiceReason
Sparse text or categorical featuresAdagradRare features keep large steps
Convex objective, few epochsAdagradStrong guarantees, little tuning
Deep network, long scheduleAdamWSteps would otherwise vanish
Very large language modelAdafactor or AdamMemory and stability at scale
Simple baseline for comparisonStochastic gradient descentFewer confounding effects
Situations and the recommended optimizer

Linear models over bag-of-words features, embedding layers of recommendation systems and click-prediction models are the classic cases. For such workloads Adagrad frequently matches more elaborate optimizers while needing less tuning effort.

Known limitations and common mistakes

The dominant criticism is premature step decay. Over many thousands of iterations the accumulator grows without bound, the effective learning rate approaches zero, and the model stops improving even though the loss has not converged.

  • Treating the decay as convergence when progress has simply stalled is the most frequent misreading.
  • Copying a learning rate from Adam produces steps that are far too small from the first iteration.
  • Applying a decaying schedule on top compounds the shrinkage and halts learning early.
  • Resuming without the accumulator silently restarts the adaptation and creates a visible loss spike.
  • Expecting momentum behavior is a mistake, since plain Adagrad has none.

A reasonable diagnostic is to log the median effective step size across parameters. When that value has fallen by several orders of magnitude while validation loss is still improving, the optimizer, not the model, has become the bottleneck.

Put simply

Training a model means nudging millions of numbers in the right direction. The size of each nudge matters. Too large and the model overshoots; too small and training crawls.

Adagrad gives each number its own nudge size. It remembers how much each one has been changed already. Numbers that have already moved far get smaller nudges from then on. Numbers that have barely moved keep bigger nudges, so they still get a fair chance to learn.

The drawback follows from the same rule. Since the memory only grows, every nudge keeps shrinking. After a long run the steps become so tiny that training effectively stops. Later methods fixed this by letting the memory fade.

In practice

A team builds a click-prediction model for an online marketplace. The input is extremely sparse: roughly two million categorical features covering search phrases, product identifiers and device types, of which only about forty are active for any single impression.

Plain stochastic gradient descent handles this badly. One shared learning rate is either too small for the rare search phrases that appear a few times a day, or too large for the handful of features present in nearly every example. The engineers switch to Adagrad with a base learning rate of 0.05 and leave the remaining settings at their defaults.

Within one pass over a day of logs, the rare phrases acquire meaningful weights because their accumulators stay small and their effective steps stay large. Offline ranking quality improves measurably, and tuning time drops because only one hyperparameter needed searching. Training is restarted daily on fresh logs, so the shrinking step problem never becomes limiting for this workload, which is exactly the setting where Adagrad still earns its place.