Adaptive Subgradient Methods (AdaGrad)

Understanding Adaptive Subgradient Methods (AdaGrad)

Adaptive Subgradient Methods, commonly known as AdaGrad, is an algorithm for gradient-based optimization that adapts the learning rate to the parameters, performing smaller updates for parameters associated with frequently occurring features, and larger updates for parameters associated with infrequent features. It is particularly suited for dealing with sparse data.

What is AdaGrad?

AdaGrad is an optimization method that was designed to improve the robustness of the stochastic gradient descent (SGD) method, especially in the context of machine learning problems with large-scale and sparse data. It was introduced by John Duchi, Elad Hazan, and Yoram Singer in 2011. Unlike standard SGD, which maintains a single learning rate for all weight updates, AdaGrad modifies the learning rate for each weight individually, based on the historical gradient information of each weight.

The core idea behind AdaGrad is to give frequently occurring features very small learning rates and infrequent features large learning rates. This adaptive learning rate approach often leads to better performance over the traditional SGD optimizer, particularly in scenarios where data is sparse and the gradient's scale can vary across different dimensions.

How Does AdaGrad Work?

AdaGrad works by accumulating the square of the gradients for each parameter in a diagonal matrix. When updating the parameters, it normalizes the gradient by the square root of this accumulated sum. This has the effect of scaling down the step size for parameters with large gradients, and scaling up the step size for parameters with small or infrequent gradients.

The update rule for AdaGrad can be summarized as follows:

  1. Accumulate the square of the gradients for each parameter.
  2. Compute the adaptive learning rate for each parameter, which is inversely proportional to the square root of the accumulated gradients.
  3. Update the parameters using the normalized gradient.

Mathematically, the AdaGrad update for parameter θ at time step t can be expressed as:

θt+1 = θt - (η / √(Gt + ε)) * ∇θJ(θ)


  • η is the initial learning rate.
  • Gt is a diagonal matrix where each diagonal element i, i is the sum of the squares of the gradients w.r.t. θi up to time step t.
  • ε is a smoothing term to avoid division by zero (usually set to 1e-8).
  • θ

    J(θ) is the gradient of the objective function w.r.t. to the parameter vector θ.

This update rule ensures that parameters with large gradients get a smaller update (since their accumulated gradient will be large), and parameters with small gradients get a larger update. This helps in faster convergence for sparse data and makes AdaGrad robust to the choice of the global learning rate η.

Advantages and Disadvantages of AdaGrad

AdaGrad has several advantages:

  • Robustness: It is less sensitive to the choice of the global learning rate.
  • Suitability for Sparse Data:

    It is well-suited for problems with sparse features, such as natural language processing and image recognition with large vocabularies.

  • Automatic Learning Rate Tuning: It eliminates the need to manually tune the learning rate for each parameter.

However, AdaGrad also has some disadvantages:

  • Accumulation of Squared Gradients: The accumulation can grow very large over time, causing the learning rate to shrink and become infinitesimally small, which effectively stops the parameter from updating.
  • Non-Stationary Problems: It may not perform well on non-stationary problems or on problems that require fine-tuning of parameters.


AdaGrad is a powerful optimization algorithm that has seen significant use in large-scale machine learning problems, particularly those with sparse datasets. Its adaptive learning rate approach allows for a more nuanced update of parameters, which can lead to better convergence properties compared to traditional SGD. However, its susceptibility to diminishing learning rates can be a drawback, and later algorithms like AdaDelta and Adam have been proposed to address this issue. Nonetheless, AdaGrad remains a foundational algorithm in the field of machine learning optimization techniques.

Please sign up or login with your details

Forgot password? Click here to reset