AdaGrad
AdaGrad (Adaptive Gradient algorithm) is a first-order stochastic optimization method that scales each coordinate's learning rate inversely by the square root of the accumulated sum of squared past gradients. Key result: it achieves regret for convex problems while automatically adapting per-feature step sizes, excelling on sparse data. Applies to convex and non-convex stochastic optimization, prominently in machine learning. Introduced by John Duchi, Elad Hazan, and Yoram Singer in 2011.
Treat the cumulative magnitude of each coordinate's gradient history as a measure of how "well-explored" that coordinate is. Coordinates whose gradients have been large and frequent have been learned about a lot, so their step should be damped; coordinates seen rarely deserve aggressive updates. The mechanism is a diagonal preconditioner built purely from accumulated squared gradients — turning a single scalar learning rate into a data-driven, per-parameter, time-varying vector of learning rates.
Formal Statement
Let be the (sub)differentiable loss at step , and a (sub)gradient. AdaGrad maintains an accumulator and updates parameters as follows. The diagonal accumulator:
Derivation hint: full-matrix AdaGrad uses the outer-product sum; the practical diagonal version keeps only the diagonal entries, the per-coordinate sum of squared gradients. The per-coordinate update (diagonal form):
Derivation hint: divide the global step by the square root of the accumulated squared gradient for coordinate ; prevents division by zero. In compact vector notation, with (elementwise):
Derivation hint: is the Hadamard product and is elementwise; this is exactly [2] stacked across coordinates. Symbols: parameters, master learning rate, (sub)gradient, accumulator (= ), numerical stabilizer, elementwise product.
The original general form preconditions by the full matrix:
Derivation hint: this arises from choosing the proximal/Mahalanobis norm that minimizes the regret bound; the diagonal version is its scalable approximation. This costs storage and per step (matrix inverse-square-root), so it is rarely used directly for large .
Let be a closed convex feasible set with diameter , and let each be convex with bounded subgradients. Diagonal AdaGrad (with projection onto ) satisfies, against any fixed :
Derivation hint: substitute the AdaGrad proximal metric into the standard online-mirror-descent regret inequality, then use the telescoping bound . In the worst case , giving , but when gradients are sparse the data-dependent right side of [5] is dramatically smaller.
Why It Holds / Derivation
Step 1 (Proximal step in a time-varying norm). Define the Mahalanobis norm with . The AdaGrad update [3] is the proximal step
Step 2 (Convexity gives a linear bound). By convexity of ,
Step 3 (Per-step descent inequality). Standard analysis of the proximal step yields, for each ,
Step 4 (Telescoping the metric-difference terms). Summing over , the difference of distance terms telescopes; because is increasing in (entries grow), the residual is controlled by .
Step 5 (Bounding the gradient terms). The key adaptive lemma states, for any nonnegative sequence,
Thus .
Step 6 (Combine and optimize ). Adding the two pieces and choosing balances them, producing the bound [5].
∎Though all three are computer scientists/applied mathematicians rather than physicists, they are the architects of AdaGrad. Duchi (Stanford) specializes in stochastic optimization and statistical learning; Hazan (Princeton) is a foundational figure in online convex optimization and regret minimization; Singer (then at Google) contributed expertise in large-scale machine learning. Their 2011 JMLR paper "Adaptive Subgradient Methods for Online Learning and Stochastic Optimization" unified online learning regret theory with practical deep-learning optimization, and the adaptive lemma (Step 5 above) is the technical heart of the entire adaptive-method family that includes RMSProp, AdaDelta, and Adam.
Building Intuition
Imagine descending a long, narrow valley whose floor is shaped differently along each axis: one direction is steep and bumpy, another is a shallow, gentle slope explored only rarely. Plain SGD uses the same step size in all directions, so it either overshoots the steep axis or crawls along the shallow one. AdaGrad keeps a "budget meter" per axis recording how much gradient signal has already arrived there. Axes that have received a lot of strong gradient feedback get their step size throttled (we already know a lot about them), while axes touched only occasionally retain large, aggressive steps. The square root is crucial: it makes the per-coordinate effective rate decay like for a coordinate that fires every step — the canonical optimal SGD schedule — but stay near for a coordinate that fires rarely. Geometrically, rescales space so the loss looks locally isotropic, mimicking a Newton-style preconditioner using only first-order data.
Worked Examples
Given: One parameter, , , and constant gradient at every step. Compute starting from .
Steps:
- : , step . .
- : , step . .
- : , step . .
Notice the step shrinks even though the gradient is constant — the hallmark decay.
Given: , , two coordinates. Coordinate 1 (dense) gets gradient at every step. Coordinate 2 (sparse) gets gradient at and gradient at . Compute the magnitude of each coordinate's update at .
Steps:
- Coord 1 at : , update .
- Coord 2 at : , update .
Despite coordinate 2's gradient being three times larger, its first update is not over-damped because its accumulator only just turned on. The dense coordinate is already throttled to .
Common Misconceptions
AdaGrad does not have a single learning rate that you tune to convergence speed alone. The master rate sets the scale, but the effective per-coordinate rate is , which monotonically decreases. A frequent mistake is to expect AdaGrad to keep making progress late in training; because never decreases, the effective rate eventually becomes negligibly small and learning stalls. This is the defining flaw that RMSProp fixes by using an exponential moving average instead of a cumulative sum.
is not just a numerical guard — it caps the maximum effective learning rate. Early on, when is tiny, the term would explode without . Setting too small can cause enormous first steps; too large effectively reduces AdaGrad to vanilla SGD with rate .
AdaGrad can fail to converge on simple non-stationary or non-convex problems specifically because of accumulator monotonicity. Consider an online problem where the optimal direction reverses after many steps (a shifting target). By the time the shift occurs, has grown large, so the effective learning rate is far too small to track the new optimum — AdaGrad freezes near the stale solution. Plain SGD with a constant rate, by contrast, keeps adapting. This concrete failure motivated AdaDelta (2012) and RMSProp, which forget old gradient information geometrically.
Connections
AdaGrad sits at the intersection of Online Convex Optimization and Stochastic Gradient Descent. Its regret analysis is a specialization of Online Mirror Descent with a time-varying, data-adaptive Bregman divergence. The full-matrix form [4] is a first-order approximation to Newton's Method in Optimization, replacing the Hessian with the empirical Fisher-like matrix , linking it to Natural Gradient Descent and the Fisher Information Matrix. Its decay flaw is repaired by exponential averaging in RMSProp and AdaDelta, and combined with momentum it becomes Adam (optimizer). The per-coordinate preconditioner also relates to diagonal Preconditioning (numerical analysis).
Real-World Applications
Historical Development
Subtleties & Limits
The cleanest theoretical guarantees for AdaGrad are in the convex regret setting; its behavior in modern non-convex deep learning is far less understood. Open and active questions include: (1) tight non-convex convergence rates for diagonal AdaGrad and whether they match SGD's stationarity bound without restrictive assumptions; (2) the generalization gap — adaptive methods like AdaGrad/Adam sometimes generalize worse than tuned SGD despite faster training (Wilson et al., 2017), and the precise mechanism remains debated; (3) when, theoretically, the full-matrix preconditioner [4] is worth its cost, and whether low-rank or Kronecker-factored approximations (Shampoo, K-FAC) recover most of its benefit; (4) principled, automatic schedules for and that remove the remaining hyperparameters. The monotonic decay of is not merely an engineering nuisance but a fundamental tension between provable regret and adaptivity to non-stationary objectives.
See Also
Stochastic Gradient Descent · RMSProp · Adam (optimizer) · AdaDelta · Online Mirror Descent · Online Convex Optimization · FTRL-Proximal · Natural Gradient Descent · Newton's Method in Optimization · Preconditioning (numerical analysis)