A Review of Descent-Based Optimisation Algorithms

A Review of Descent-Based Optimisation Algorithms

1 Introduction #

Let f:Rn→Rf : \mathbb{R}^n \rightarrow \mathbb{R} denote a smooth function, then the aim of a general optimisation (minimisation) problem is to find min⁡θf(θ)\min _{\theta} f (\theta) and the corresponding point(s) at which this minimum is attained θ∗:=argmin⁡θf(θ)\theta^{\ast} := \operatorname{argmin}_{\theta} f (\theta). If the function is simple enough, we solve ∇f=0\nabla f = 0 directly. However, if this is hard to solve, one widely used option is to take an iterative approach, i.e. find a sequence of points (θk)k∈N(\theta _{k})_{k \in \mathbb{N}} such that θk→θ∗\theta _{k} \rightarrow \theta^{\ast} (and hence f(θk)→f(θ∗)f (\theta _{k}) \rightarrow f (\theta^{\ast})) as k→∞k \rightarrow \infty.

A general iterative approach can be classified as follows: find a sequence (θk)k,(αk)k,(dk)k(\theta _{k})_{k}, (\boldsymbol{\alpha}_{k})_{k}, (\boldsymbol{d}_{k})_{k} such that

θk+1=θk+αkdk \begin{aligned} \theta _{k + 1} &= \theta _{k} + \boldsymbol{\alpha}_{k} \boldsymbol{d}_{k} \end{aligned}

where dk∈Rn\boldsymbol{d}_{k} \in \mathbb{R}^n represents the direction that one needs to take to get to the next point, and αk∈Rn×n\boldsymbol{\alpha}_{k} \in \mathbb{R}^{n \times n} represents the scale (also known as learning-rate), i.e. the size of the step one needs to take in the direction dk\boldsymbol{d}_{k} to reach the next point, where the next point θk+1\theta _{k + 1} is (ideally) closer to the optimal solution θ∗\theta^{\ast}.

Given this classification, we are left with two free parameters, scale and direction. The question we ask ourselves now is, how should we choose these? The history of descent-based optimisation can be understood as a series of increasingly refined answers to this question. In this article, we outline the history of descent-based algorithms and their approaches, see [1] for an additional summary.

2 Gradient Descent #

We start with simple gradient descent (GD), also known as batch gradient descent (BGD) in machine learning literature, which was initially introduced by Cauchy in [2].

Let (θk)k(\theta _{k})_{k} denote some sequence of parameters that we wish to define such that θk→θ∗\theta _{k} \rightarrow \theta^{\ast} as k→∞k \rightarrow \infty. If we assume that θk+1=θk+h\theta _{k + 1} = \theta _{k} + h for h∈Rnh \in \mathbb{R}^n with ∥h∥\| h \| small, then by the multivariate Taylor expansion, we have that

f(θk+1)=f(θk+h)=f(θk)+hT∇f(θk)+O(∥h∥2). f (\theta _{k + 1}) = f (\theta _{k} + h) = f (\theta _{k}) + h^T \nabla f (\theta _{k}) +\mathcal{O} (\| h \|^2) .

A natural choice of hh would be such that hT∇f(θk)<0h^T \nabla f (\theta _{k}) < 0, i.e. iterative steps make ff smaller (assuming that the first order expansion well approximates ff). By Cauchy-Schwarz

hT∇f(θk)⩾−∥h∥∥∇f(θk)∥ \begin{aligned} h^T \nabla f (\theta _{k}) & \geqslant & - \| h \| \| \nabla f (\theta _{k}) \| \end{aligned}

with equality holding when

h:=−η∇f(θk)∥∇f(θk)∥ \begin{aligned} h & := & - \eta \frac{\nabla f (\theta _{k})}{\| \nabla f (\theta _{k}) \|} \end{aligned}

for some η>0\eta > 0, also called the learning rate. That is, the optimal direction for the greatest reduction in ff is the direction of steepest descent. Summarising, we get the following evolution equation

θk+1=θk−αk∇f(θk)αk=η∥∇f(θk)∥ \begin{aligned} \theta _{k + 1} &= \theta _{k} - \alpha _{k} \nabla f (\theta _{k}) \\ \alpha _{k} &= \frac{\eta}{\| \nabla f (\theta _{k}) \|} \end{aligned}

for some free parameter η>0\eta > 0. As η\eta is free, we may simplify this entirely, and consider instead αk\alpha _{k} the free parameter, and write

θk+1=θk−α∇f(θk) \begin{aligned} \theta _{k + 1} &= \theta _{k} - \alpha \nabla f (\theta _{k}) \end{aligned}

for some predefined learning rate α\alpha.

Algorithm 1 (Gradient Descent)

Require: α\alpha: Step size

Require: f(θ)f (\theta): Objective function with parameters θ\theta

Require: θ0\theta _{0}: Initial parameter vector

t←0t \leftarrow 0 (Initialise time-step)

while θt\theta _{t} not converged do

t←t+1t \leftarrow t + 1

gt←∇θf(θt−1)g_{t} \leftarrow \nabla _{\theta} f (\theta _{t - 1}) (Get gradients with respect to objective)

θt←θt−1−α⋅gt\theta _{t} \leftarrow \theta _{t - 1} - \alpha \cdot g_{t} (Update parameters)

end while

return θt\theta _{t} (Resulting parameters)

Example 1 (Machine Learning).

In supervised learning, we are often given a dataset of NN samples (xi,yi)(x_{i}, y_{i}). In such a scenario, we choose a model hθ(x)h_{\theta} (x) parametrised by some θ∈Rn\theta \in \mathbb{R}^n and a loss function ℓ(hθ(x),y)\ell (h_{\theta} (x), y) that measures the prediction error made by the model. The empirical risk is the average loss over the training data

f(θ):=1N∑i=1Nℓ(hθ(xi),yi), \begin{aligned} f (\theta) & := & \frac{1}{N} \sum_{i = 1}^N \ell (h_{\theta} (x_{i}), y_{i}), \end{aligned}

and the goal is to find θ∗\theta^{\ast} that minimises this average loss. A simple batch gradient descent algorithm could then be written as

θk+1=θk−αk1N∑i=1N∇ℓ(hθk(xi),yi). \begin{aligned} \theta _{k + 1} &= \theta _{k} - \alpha _{k} \frac{1}{N} \sum_{i = 1}^N \nabla \ell (h_{\theta _{k}} (x_{i}), y_{i}) . \end{aligned}

For large NN, this would require NN gradient computations, which can be quite slow. Thankfully, there are remedies to this, which we discuss later under stochastic gradient descent and mini-batch gradient descent.

Pathologies #

Sensitive to Learning Rate. The learning rate needs to be chosen carefully so as to ensure convergence, even for a convex function. If chosen too large, convergence does not occur, and if too small, convergence is slow.

Locally Optimal. Iterates can get stuck in local optima if the function is not convex, and therefore the approach is not necessarily the best to choose when seeking globally optimal solutions. A simple way to address this is to employ noisy learning rates, i.e. set θk+1=θk−α∇f(θk)+εk\theta _{k + 1} = \theta _{k} - \alpha \nabla f (\theta _{k}) + \varepsilon _{k} for some random noise εk\varepsilon _{k}.

Inefficient. The approach can be computationally inefficient for large nn or for machine learning problems with large training data, i.e. large NN.

3 Stochastic Gradient Descent #

Gradient descent as described above requires the exact gradient ∇f\nabla f at every step. In many settings this is either too expensive or impossible: the function ff may be an expectation over a large (or infinite) population, or it may be a sum over a dataset so large that evaluating every term at each iteration is impractical. A natural question arises: what happens if we replace the true gradient with a noisy estimate g=∇f+εg = \nabla f + \varepsilon, where ε\varepsilon is some zero-mean noise: can the algorithm still converge?

3.1 Robbins-Monro Conditions #

Fortunately, the answer is yes, provided the learning rate decays appropriately. The seminal work of Robbins and Monro, [3], establishes that the iteration

θk+1=θk−αkg(θk) \begin{aligned} \theta _{k + 1} &= \theta _{k} - \alpha _{k} g (\theta _{k}) \end{aligned}

where gg is an unbiased estimator of ∇f\nabla f, i.e. E[g(θ)]=∇f(θ)\mathbb{E} [g (\theta)] = \nabla f (\theta), converges to θ∗\theta^{\ast} in probability provided the step sizes, αk>0\alpha _{k} > 0, satisfy the following two conditions:

  1. ∑k=1∞αk=∞\sum_{k = 1}^{\infty} \alpha _{k} = \infty. The total distance the algorithm can travel must be unbounded.
  2. ∑k=1∞αk2<∞\sum_{k = 1}^{\infty} \alpha _{k}^2 < \infty. The steps must eventually shrink fast enough to damp out the noise.

These are referred to as the Robbins-Monro conditions. Together, the conditions create a tension: the step sizes must shrink but not too quickly. The canonical choice αk=c/k\alpha _{k} = c / k for some constant c>0c > 0 satisfies both, and is the most commonly used schedule in the stochastic approximation literature.

The Robbins-Monro result reveals that gradient descent is inherently robust to noise: convergence is preserved as long as the noise is unbiased and the learning rate decays appropriately. This observation opens the door to intentionally introducing noise, trading exactness for computational efficiency. This is precisely the idea behind stochastic gradient descent as it is used in modern machine learning: we do not merely tolerate noise in the gradient, we engineer it by subsampling the data.

3.2 Modern Interpretation #

We now make the connection to machine learning concrete. Recall Example 1, where the objective is the empirical risk f(θ)=1N∑i=1Nℓ(hθ(xi),yi)f (\theta) = \frac{1}{N} \sum_{i = 1}^N \ell (h_{\theta} (x_{i}), y_{i}). Batch gradient descent computes the full sum at every step, costing O(N)\mathcal{O} (N) per iteration. SGD applies the Robbins-Monro framework by replacing the true gradient with a single-sample estimate: draw σ∼Uniform⁡{1,…,N}\sigma \sim \operatorname{Uniform} \lbrace 1, \ldots, N \rbrace and set g(θ)=∇ℓ(hθ(xσ),yσ)g (\theta) = \nabla \ell (h_{\theta} (x_{\sigma}), y_{\sigma}), giving the evolution equation

θk+1=θk−αk∇ℓ(hθk(xσ(k)),yσ(k)). \begin{aligned} \theta _{k + 1} &= \theta _{k} - \alpha _{k} \nabla \ell (h_{\theta _{k}} (x_{\sigma (k)}), y_{\sigma (k)}) . \end{aligned}

Indeed, we have that gg is an unbiased estimator of ∇f\nabla f, as

E[g(θ)∣((xi,yi))i=1N]=1N∑j=1N∇ℓ(hθ(xj),yj)=∇f(θ). \mathbb{E} [g (\theta) | ((x_{i}, y_{i}))_{i = 1}^N] = \frac{1}{N} \sum_{j = 1}^N \nabla \ell (h_{\theta} (x_{j}), y_{j}) = \nabla f (\theta) .

Now, instead of requiring one to compute the gradient for NN samples, one is only required to compute the gradient for a single sample. This adds noise to the descent process towards the minimum, visually seen as a jitter in the optimisation path, but with this increase in noise, we get a much more computationally efficient algorithm.

Algorithm 2 (Stochastic Gradient Descent)

Require: α0\alpha _{0}: Initial step size

Require: f(θ)=1N∑i=1Nfi(θ)f (\theta) = \frac{1}{N} \sum_{i = 1}^N f_{i} (\theta): Stochastic objective function with parameters θ\theta

Require: θ0\theta _{0}: Initial parameter vector

t←0t \leftarrow 0 (Initialise time-step)

while θt\theta _{t} not converged do

t←t+1t \leftarrow t + 1

αt←φ(αt−1,…,α0)\alpha _{t} \leftarrow \varphi (\alpha _{t - 1}, \ldots, \alpha _{0}) (Decay step size according to Robbins-Monro conditions)

it∼U{1,…,N}i_{t} \sim U \lbrace 1, \ldots, N \rbrace (Sample a data point uniformly at random)

gt←∇θfit(θt−1)g_{t} \leftarrow \nabla _{\theta} f_{i_{t}} (\theta _{t - 1}) (Get gradients with respect to stochastic objective at time tt)

θt←θt−1−αt⋅gt\theta _{t} \leftarrow \theta _{t - 1} - \alpha _{t} \cdot g_{t} (Update parameters)

end while

return θt\theta _{t} (Resulting parameters)

3.3 Mini Batch Optimisation #

Mini-batch optimisation is a middle ground between batch gradient descent and stochastic gradient descent. While batch gradient descent requires the calculation of all NN gradients, and stochastic gradient descent requires only one, mini-batch gradient descent computes the gradient over a random subset of size bb. The resulting estimator gt=1b∑i∈Bt∇fi(θ)g_{t} = \frac{1}{b} \sum_{i \in \mathcal{B}_{t}} \nabla f_{i} (\theta) is still unbiased, but its variance is reduced by a factor of bb relative to single-sample SGD, since Var⁡(gt)≈1bVar⁡(∇fi)\operatorname{Var} (g_{t}) \approx \frac{1}{b} \operatorname{Var} (\nabla f_{i}) (approximately, for b≪Nb \ll N). This smooths the convergence to the (local) optimum while keeping the per-step cost at O(b)\mathcal{O} (b) rather than O(N)\mathcal{O} (N). In practice, bb is often chosen as a power of 2 to exploit GPU parallelism.

Algorithm 3 (Mini-Batch Gradient Descent)

Require: α0\alpha _{0}: Initial step size

Require: f(θ)=1N∑i=1Nfi(θ)f (\theta) = \frac{1}{N} \sum_{i = 1}^N f_{i} (\theta): Stochastic objective function with parameters θ\theta

Require: θ0\theta _{0}: Initial parameter vector

t←0t \leftarrow 0 (Initialise time-step)

while θt\theta _{t} not converged do

t←t+1t \leftarrow t + 1

αt←φ(αt−1,…,α0)\alpha _{t} \leftarrow \varphi (\alpha _{t - 1}, \ldots, \alpha _{0}) (Decay step size)

Bt←\mathcal{B}_{t} \leftarrow sample bb indices from {1,…,N}\lbrace 1, \ldots, N \rbrace without replacement

gt←1b∑i∈Bt∇θfi(θt−1)g_{t} \leftarrow \frac{1}{b} \sum_{i \in \mathcal{B}_{t}} \nabla _{\theta} f_{i} (\theta _{t - 1}) (Compute mini-batch gradient estimate)

θt←θt−1−αt⋅gt\theta _{t} \leftarrow \theta _{t - 1} - \alpha _{t} \cdot g_{t} (Update parameters)

end while

return θt\theta _{t} (Resulting parameters)

Pathologies #

Oscillation. Suppose that our objective ff has a narrow valley containing the optimum. Then, the gradient points mostly across the valley (towards the steep walls) and only weakly along it (towards the minimum). As a result, SGD will oscillate back and forth across the valley while making slow progress along it.

Gradient Noise. In the stochastic setting gkg_{k} fluctuates around ∇f(θk)\nabla f (\theta _{k}). These fluctuations cause the trajectory to jitter, particularly near the optimum.

Both pathologies share a common structure: the harmful components of the gradient (oscillations, noise) tend to change sign frequently, while the useful components (the persistent descent direction) are consistent across iterations. This suggests a natural fix: average the gradients over time. Components that are consistent will reinforce; components that oscillate or fluctuate will cancel.

4 Momentum and Adaptive Learning Rates #

Returning to our general framework, SGD with a fixed or decaying scalar learning rate sets αk=αkI\boldsymbol{\alpha}_{k} = \alpha _{k} I and dk=−gk\boldsymbol{d}_{k} = - g_{k}: it treats every coordinate identically and uses only the current gradient to choose its direction. The pathologies identified above suggest two independent avenues for improvement

  1. improve the direction dk\boldsymbol{d}_{k} by averaging gradients over time,
  2. improve the scale αk\boldsymbol{\alpha}_{k} by adapting the learning rate to each coordinate individually.

We address these in turn.

4.1 Directional Improvements - Momentum #

The method of momentum, introduced by Polyak in [4] and surveyed in [5], is designed to accelerate learning in the face of the two pathologies described above: high-curvature oscillations and stochastic noise. The core idea is to replace the raw gradient gkg_{k} with a running average of past gradients, which we call the velocity mkm_{k}.

4.1.1 Exponential Moving Average #

One of the simplest forms of temporal averaging is the exponential moving average (EMA). Define the velocity mkm_{k} recursively as

mk=βmk−1+(1−β)gk m_{k} = \beta m_{k - 1} + (1 - \beta) g_{k}

with m0=0m_{0} = 0 and β∈[0,1)\beta \in [0, 1), where β\beta controls how much history to retain. Expanding the recursion gives the weighted sum of all past gradients

mk=(1−β)∑j=1kβk−jgj. \begin{aligned} m_{k} &= (1 - \beta) \sum_{j = 1}^k \beta^{k - j} g_{j} . \end{aligned}

The weights (1−β)βk−j(1 - \beta) \beta^{k - j} decay exponentially into the past: recent gradients contribute most, and the effective window of history is approximately 1/(1−β)1 / (1 - \beta) steps (e.g. β=0.9\beta = 0.9 averages roughly the last 10 gradients).

4.1.2 Polyak’s Heavy Ball Method #

The classical momentum formulation due to Polyak, see [4], uses a slightly different convention that absorbs the (1−β)(1 - \beta) factor into the learning rate:

mk=βmk−1+gk,θk+1=θk−αmk. \begin{aligned} m_{k} &= \beta m_{k - 1} + g_{k}, \\ \theta _{k + 1} &= \theta _{k} - \alpha m_{k} . \end{aligned}

Substituting the first line into the second reveals the structure

θk+1=θk−αgk⏟classical SGD structure−αβmk−1⏟momentum correction. \begin{aligned} \theta _{k + 1} &= \underbrace{\theta _{k} - \alpha g_{k}}_{\text{classical SGD structure}} - \underbrace{\alpha \beta m_{k - 1}}_{\text{momentum correction}} . \end{aligned}
Figure 1.Polyak’s heavy ball method. The update \theta _{k + 1} = \theta _{k} - \alpha m_{k} decomposes as a parallelogram: the sum of the gradient step - \alpha g_{k} (red), evaluated at \theta _{k}, and the momentum correction - \alpha \beta m_{k - 1} (orange).
Figure 1.Polyak’s heavy ball method. The update θk+1=θk−αmk\theta _{k + 1} = \theta _{k} - \alpha m_{k} decomposes as a parallelogram: the sum of the gradient step −αgk- \alpha g_{k} (red), evaluated at θk\theta _{k}, and the momentum correction −αβmk−1- \alpha \beta m_{k - 1} (orange).

Under this convention, the velocity expands as mk=∑j=1kβk−jgjm_{k} = \sum_{j = 1}^k \beta^{k - j} g_{j}, which differs from the normalised EMA only by the factor (1−β)(1 - \beta). Since α\alpha is a free parameter, the two formulations yield identical trajectories after rescaling.

In practice, Polyak’s convention is more common because the learning rate α\alpha decouples from β\beta: the expansion θk+1=θk−αgk−αβmk−1\theta _{k + 1} = \theta _{k} - \alpha g_{k} - \alpha \beta m_{k - 1} shows that α\alpha directly controls the per-gradient step size, and setting β=0\beta = 0 recovers vanilla SGD with step size α\alpha. By contrast, the normalised EMA gives an effective per-gradient step of α(1−β)\alpha (1 - \beta), so changing β\beta implicitly changes the learning rate too.

Algorithm 4 (SGD with Momentum (Polyak))

Require: α\alpha: Step size

Require: β∈[0,1)\beta \in [0, 1): Momentum coefficient (typically 0.9)

Require: f(θ)=1N∑i=1Nfi(θ)f (\theta) = \frac{1}{N} \sum_{i = 1}^N f_{i} (\theta): Stochastic objective function with parameters θ\theta

Require: θ0\theta _{0}: Initial parameter vector

m0←0m_{0} \leftarrow 0 (Initialise velocity)

t←0t \leftarrow 0 (Initialise time-step)

while θt\theta _{t} not converged do

t←t+1t \leftarrow t + 1

it∼U{1,…,N}i_{t} \sim U \lbrace 1, \ldots, N \rbrace (Sample data point)

gt←∇θfit(θt−1)g_{t} \leftarrow \nabla _{\theta} f_{i_{t}} (\theta _{t - 1}) (Compute stochastic gradient)

mt←β⋅mt−1+gtm_{t} \leftarrow \beta \cdot m_{t - 1} + g_{t} (Update velocity)

θt←θt−1−α⋅mt\theta _{t} \leftarrow \theta _{t - 1} - \alpha \cdot m_{t} (Update parameters)

end while

return θt\theta _{t} (Resulting parameters)

4.1.3 Nesterov Accelerated Gradient #

Nesterov proposed a subtle but important variant, see [6]. Standard momentum computes the gradient at the current position θk\theta _{k} and then adds the momentum correction. Nesterov reverses the order: first apply the momentum to get a lookahead point, then compute the gradient there

θ~k=θk−αβmk−1mk=βmk−1+∇f(θ~k)θk+1=θk−αmk=θk−α∇f(θ~k)−αβmk−1 \begin{aligned} \tilde{\theta}_{k} &= \theta _{k} - \alpha \beta m_{k - 1} \\ m_{k} &= \beta m_{k - 1} + \nabla f (\tilde{\theta}_{k}) \\ \theta _{k + 1} &= \theta _{k} - \alpha m_{k} \\ &= \theta _{k} - \alpha \nabla f (\tilde{\theta}_{k}) - \alpha \beta m_{k - 1} \end{aligned}

The intuition is corrective: since momentum will carry us to approximately θ~k\tilde{\theta}_{k} anyway, we should evaluate the gradient where we are about to be, not where we currently are. If the momentum is overshooting (e.g. past a minimum), the gradient at the lookahead point already points back, providing an earlier course correction. For smooth convex functions (with an appropriate momentum schedule), this achieves the optimal convergence rate among first-order methods: O(1/k2)\mathcal{O} (1 / k^2) versus O(1/k)\mathcal{O} (1 / k) for standard gradient descent.

Figure 2.Nesterov’s accelerated gradient. Unlike Polyak’s method, the gradient is not evaluated at \theta _{k}, but instead at the lookahead \tilde{\theta}_{k} = \theta _{k} - \alpha \beta m_{k - 1} (purple), obtained by first applying the momentum correction. The dashed grey arrow shows where - \nabla f (\theta _{k}) would point if we evaluated at the current position instead.
Figure 2.Nesterov’s accelerated gradient. Unlike Polyak’s method, the gradient is not evaluated at θk\theta _{k}, but instead at the lookahead θ~k=θk−αβmk−1\tilde{\theta}_{k} = \theta _{k} - \alpha \beta m_{k - 1} (purple), obtained by first applying the momentum correction. The dashed grey arrow shows where −∇f(θk)- \nabla f (\theta _{k}) would point if we evaluated at the current position instead.

4.2 Scaling Improvements #

Having improved the direction with momentum, we now turn to the scale αk\boldsymbol{\alpha}_{k}. A single scalar learning rate treats every parameter identically, yet different parameters may live in very different landscapes. Some directions curve steeply and need small steps, while others are nearly flat and need large ones.

One could try to fix this with second-order information. Newton’s method replaces the scalar αI\alpha I with the inverse Hessian H−1H^{- 1}, so that the step θk+1=θk−H−1∇f\theta _{k + 1} = \theta _{k} - H^{- 1} \nabla f scales each gradient component by the inverse curvature along that direction. However, computing and inverting the n×nn \times n Hessian costs O(n3)\mathcal{O} (n^3), which is prohibitive in modern applications. The adaptive methods below take a different, cheaper approach: they use only first-order information to give each coordinate its own step size. The form of this scaling is not chosen by analogy with Newton, but emerges from a regret analysis in online optimisation.

Regret and Per-Coordinate Step Sizes #

SGD already has the structure of an online algorithm, that is, at each step tt, we observe the stochastic gradient gt=∇fit(θt)g_{t} = \nabla f_{i_{t}} (\theta _{t}) and must commit to θt+1\theta _{t + 1} before seeing any future gradients. Because gtg_{t} is stochastic, we cannot guarantee a loss reduction at every step. What can we guarantee instead?

A natural measure is regret, which is the total excess loss accumulated along our trajectory relative to the single best fixed point in hindsight

RT:=∑t=1Tft(θt)−min⁡θ∑t=1Tft(θ). R_{T} := \sum_{t = 1}^T f_{t} (\theta _{t}) - \min _{\theta} \sum_{t = 1}^T f_{t} (\theta) .

An algorithm is considered good if RTR_{T} grows sub-linearly in TT, meaning the average per-step penalty RT/T→0R_{T} / T \rightarrow 0. Standard online gradient descent, with a scalar step size αt=α/t\alpha _{t} = \alpha / \sqrt{t}, achieves (for convex ftf_{t} with bounded gradients and domain) RT=O(T)R_{T} =\mathcal{O} \left( \sqrt{T} \right), but it treats every coordinate identically.

To allow per-coordinate step sizes, we generalise the update to θt+1=θt−Xgt\theta _{t + 1} = \theta _{t} - X g_{t}, where X=diag⁡(α1,…,αn)X =\operatorname{diag} (\alpha _{1}, \ldots, \alpha _{n}) is a fixed positive-definite diagonal matrix (we will make it data-dependent momentarily).

For fixed XX, a standard regret analysis gives the bound RT⩽12∑i=1nDi2αi+12∑i=1nαiGT,i, R_{T} \leqslant \frac{1}{2} \sum_{i = 1}^n \frac{D_{i}^2}{\alpha _{i}} + \frac{1}{2} \sum_{i = 1}^n \alpha _{i} G_{T, i},

where Di=max⁡t∣θt,i−θi∗∣D_{i} = \max _{t} | \theta _{t, i} - \theta _{i}^{\ast} | is the maximum distance of coordinate ii from the optimum and GT,i=∑t=1Tgt,i2G_{T, i} = \sum_{t = 1}^T g_{t, i}^2 is the accumulated squared gradient.

Proof.

Let each ftf_{t} be convex. Fix coordinate ii and write δt,i=θt,i−θi∗\delta _{t, i} = \theta _{t, i} - \theta _{i}^{\ast}.

Step 1 (Convexity). Since ftf_{t} is convex, ft(θt)−ft(θ∗)⩽gt⊤(θt−θ∗)=∑igt,iδt,if_{t} (\theta _{t}) - f_{t} (\theta^{\ast}) \leqslant g_{t}^{\top} (\theta _{t} - \theta^{\ast}) = \sum_{i} g_{t, i} \delta _{t, i}. It suffices to bound each ∑tgt,iδt,i\sum_{t} g_{t, i} \delta _{t, i}.

Step 2 (One-step identity). From the update rule, δt+1,i=δt,i−αigt,i\delta _{t + 1, i} = \delta _{t, i} - \alpha _{i} g_{t, i}. Squaring both sides and rearranging,

gt,iδt,i=δt,i2−δt+1,i22αi+αigt,i22. g_{t, i} \delta _{t, i} = \frac{\delta _{t, i}^2 - \delta _{t + 1, i}^2}{2 \alpha _{i}} + \frac{\alpha _{i} g_{t, i}^2}{2} .

Step 3 (Telescope). Summing from t=1t = 1 to TT, the first term telescopes directly:

∑t=1Tgt,iδt,i=δ1,i2−δT+1,i22αi+αi2∑t=1Tgt,i2⩽Di22αi+αiGT,i2. \sum_{t = 1}^T g_{t, i} \delta _{t, i} = \frac{\delta _{1, i}^2 - \delta _{T + 1, i}^2}{2 \alpha _{i}} + \frac{\alpha _{i}}{2} \sum_{t = 1}^T g_{t, i}^2 \leqslant \frac{D_{i}^2}{2 \alpha _{i}} + \frac{\alpha _{i} G_{T, i}}{2} .

Summing over coordinates gives the stated bound.

The two terms are in direct tension: the first penalises small step sizes (slow progress towards θ∗\theta^{\ast}), the second penalises large step sizes (overshooting). The optimal αi\alpha _{i} sits at the balance point, and crucially this balance is different for every coordinate.

Writing the bound in matrix form makes the minimisation transparent. With G=diag⁡(GT,1,…,GT,n)G =\operatorname{diag} (G_{T, 1}, \ldots, G_{T, n}) and D2=diag⁡(D12,…,Dn2)D^2 =\operatorname{diag} (D_{1}^2, \ldots, D_{n}^2), the upper bound reads

RT⩽12tr⁡(X−1D2+XG). R_{T} \leqslant \frac{1}{2} \operatorname{tr} (X^{- 1} D^2 + X G) .

We minimise over all positive-definite XX (not just diagonal, the result happens to be diagonal when GG and D2D^2 are). Differentiating and setting to zero, −X−2D2+G=0- X^{- 2} D^2 + G = 0, giving the optimal choice of XX, X∗=DG−1/2X^{\ast} = D G^{- 1 / 2}. In the diagonal case this is αi∗=Di/GT,i\alpha _{i}^{\ast} = D_{i} / \sqrt{G_{T, i}}, i.e. the optimal step size for coordinate ii is inversely proportional to the root accumulated gradient energy, for the non-diagonal case, see [7].

Of course GT,iG_{T, i} is unknown at time t<Tt < T, but we can substitute the running estimate Gt,i=∑τ=1tgτ,i2G_{t, i} = \sum_{\tau = 1}^t g_{\tau, i}^2 at each step, giving αt,i=ci/Gt,i\alpha _{t, i} = c_{i} / \sqrt{G_{t, i}} with cic_{i} a constant. This is monotonically decreasing and tied to the per-coordinate gradient energy. Directions with large or frequent gradients shrink their step size quickly, while directions with rare or small gradients preserve a large effective step size.

Substituting this time-varying step size into the (now time-varying) regret bound and optimising cic_{i} yields RT⩽O(∑i=1nDi∑t=1Tgt,i2). R_{T} \leqslant \mathcal{O} \left( \sum_{i = 1}^n D_{i} \sqrt{\sum_{t = 1}^T g_{t, i}^2} \right) .

Proof.

We verify that αt,i=ci/Gt,i\alpha _{t, i} = c_{i} / \sqrt{G_{t, i}}, with Gt,i=∑τ=1tgτ,i2G_{t, i} = \sum_{\tau = 1}^t g_{\tau, i}^2, minimises the per-coordinate regret bound and derive the optimal constant cic_{i}. For coordinate ii, the bound contributes

RT,i⩽Di22αT,i+12∑t=1Tαt,igt,i2. R_{T, i} \leqslant \frac{D_{i}^2}{2 \alpha _{T, i}} + \frac{1}{2} \sum_{t = 1}^T \alpha _{t, i} g_{t, i}^2 .

Substituting αt,i=ci/Gt,i\alpha _{t, i} = c_{i} / \sqrt{G_{t, i}}, the first term becomes Di2GT,i/(2ci)D_{i}^2 \sqrt{G_{T, i}} / (2 c_{i}). For the second term, write Gt,i=Gt−1,i+gt,i2G_{t, i} = G_{t - 1, i} + g_{t, i}^2 and observe

gt,i2Gt,i=Gt,i−Gt−1,iGt,i⩽2(Gt,i−Gt−1,i), \frac{g_{t, i}^2}{\sqrt{G_{t, i}}} = \frac{G_{t, i} - G_{t - 1, i}}{\sqrt{G_{t, i}}} \leqslant 2 \left( \sqrt{G_{t, i}} - \sqrt{G_{t - 1, i}} \right),

where the inequality uses Gt+Gt−1⩽2Gt\sqrt{G_{t}} + \sqrt{G_{t - 1}} \leqslant 2 \sqrt{G_{t}}. Summing telescopes:

∑t=1Tgt,i2Gt,i⩽2GT,i. \sum_{t = 1}^T \frac{g_{t, i}^2}{\sqrt{G_{t, i}}} \leqslant 2 \sqrt{G_{T, i}} .

So the second term is bounded by ciGT,ic_{i} \sqrt{G_{T, i}}. Combining,

RT,i⩽GT,i(Di22ci</p><ul><li>ci). R_{T, i} \leqslant \sqrt{G_{T, i}} \left( \frac{D_{i}^2}{2 c_{i}}</p><ul><li>c_{i} \right) .

Minimising over ci>0c_{i} > 0 gives ci=Di/2c_{i} = D_{i} / \sqrt{2}, and the per-coordinate contribution is 2DiGT,i\sqrt{2} D_{i} \sqrt{G_{T, i}}. Summing over coordinates,

RT⩽2∑i=1nDi∑t=1Tgt,i2=O(∑i=1nDi∑t=1Tgt,i2). R_{T} \leqslant \sqrt{2} \sum_{i = 1}^n D_{i} \sqrt{\sum_{t = 1}^T g_{t, i}^2} =\mathcal{O} \left( \sum_{i = 1}^n D_{i} \sqrt{\sum_{t = 1}^T g_{t, i}^2} \right) .

4.2.1 AdaGrad #

AdaGrad (Adaptive Gradient), see [8], implements exactly the step size derived above, absorbing the coordinate-specific constant into a global learning rate α\alpha. It maintains the running sum vt,i=∑τ=1tgτ,i2v_{t, i} = \sum_{\tau = 1}^t g_{\tau, i}^2 and divides the learning rate for each coordinate by vt,i\sqrt{v_{t, i}}, plus a small constant ε\varepsilon (typically 10−810^{- 8}) to avoid division by zero. Parameters that receive many large gradients accumulate a large denominator and take smaller steps, while parameters associated with rare features keep a small denominator and take larger steps.

Algorithm 5 (AdaGrad)

Require: α\alpha: Step size

Require: ε\varepsilon: Small constant for numerical stability (typically 10−810^{- 8})

Require: f(θ)=1N∑i=1Nfi(θ)f (\theta) = \frac{1}{N} \sum_{i = 1}^N f_{i} (\theta): Stochastic objective function with parameters θ\theta

Require: θ0\theta _{0}: Initial parameter vector

v0←0v_{0} \leftarrow 0 (Initialise second moment estimate)

t←0t \leftarrow 0 (Initialise time-step)

while θt\theta _{t} not converged do

t←t+1t \leftarrow t + 1

gt←∇θft(θt−1)g_{t} \leftarrow \nabla _{\theta} f_{t} (\theta _{t - 1}) (Get gradients with respect to stochastic objective at time tt)

vt←vt−1+gt2v_{t} \leftarrow v_{t - 1} + g_{t}^2 (Accumulate squared gradients)

θt←θt−1−α⋅gt/(vt+ε)\theta _{t} \leftarrow \theta _{t - 1} - \alpha \cdot g_{t} / \left( \sqrt{v_{t}} + \varepsilon \right) (Update parameters)

end while

return θt\theta _{t} (Resulting parameters)

The regret bound explains why AdaGrad excels with sparse data: if most gradient entries are zero for a given coordinate, that coordinate’s vt,iv_{t, i} stays small, so it retains a large effective step size and makes rapid progress on the rare occasions it does receive a gradient. However, the accumulator can only grow, so the effective learning rate α/vt\alpha / \sqrt{v_{t}} is non-increasing. For convex problems this is desirable, but in deep learning, the learning rate often shrinks to the point that training effectively stalls long before a good minimum is found, which is where the next variant, RMSProp, comes in.

4.2.2 RMSProp #

AdaGrad’s regret guarantee relies on the accumulator vt=∑τgτ2v_{t} = \sum_{\tau} g_{\tau}^2 growing monotonically, ensuring the step size shrinks over time. This is well-suited to the convex, online setting for which it was designed, but in the non-convex landscapes of deep learning, the gradient distribution changes as the optimiser moves through different regions. Early gradients dominate vtv_{t}, leaving the step size permanently small even when the landscape has changed. RMSProp (Root Mean Square Propagation), introduced by Geoffrey Hinton in a Coursera course in 2012, see [9], fixes this by replacing the full-history sum with an exponential moving average, so that vtv_{t} tracks the recent second moment of the gradient. This makes the scaling adaptive not just across coordinates but also across time: when the gradient landscape changes, outdated information is forgotten and the effective learning rate can recover.

Algorithm 6 (RMSProp)

Require: α\alpha: Step size

Require: ε\varepsilon: Small constant for numerical stability (typically 10−810^{- 8})

Require: β∈[0,1)\beta \in [0, 1): Exponential decay rate for the second moment estimate

Require: f(θ)=1N∑i=1Nfi(θ)f (\theta) = \frac{1}{N} \sum_{i = 1}^N f_{i} (\theta): Stochastic objective function with parameters θ\theta

Require: θ0\theta _{0}: Initial parameter vector

v0←0v_{0} \leftarrow 0 (Initialise second moment estimate)

t←0t \leftarrow 0 (Initialise time-step)

while θt\theta _{t} not converged do

t←t+1t \leftarrow t + 1

gt←∇θft(θt−1)g_{t} \leftarrow \nabla _{\theta} f_{t} (\theta _{t - 1}) (Get gradients with respect to stochastic objective at time tt)

vt←β⋅vt−1+(1−β)gt2v_{t} \leftarrow \beta \cdot v_{t - 1} + (1 - \beta) g_{t}^2 (Update biased second raw moment estimate)

θt←θt−1−α⋅gt/(vt+ε)\theta _{t} \leftarrow \theta _{t - 1} - \alpha \cdot g_{t} / \left( \sqrt{v_{t}} + \varepsilon \right) (Update parameters)

end while

return θt\theta _{t} (Resulting parameters)

4.2.3 AdaDelta #

RMSProp solves AdaGrad’s stale-accumulator problem but still requires a global learning rate α\alpha. AdaDelta, see [10], removes this hyper-parameter entirely by exploiting a dimensional argument.

Assign hypothetical units to the quantities involved: if θ\theta has units [θ][\theta] and the loss ff has units [f][f], then the gradient g=∂f/∂θg = \partial f / \partial \theta has units [f]/[θ][f] / [\theta]. A parameter update Δθ:=θt+1−θt\Delta \theta := \theta _{t + 1} - \theta _{t} must have units [θ][\theta], so any valid step-size multiplying gg must carry units [θ]2/[f][\theta]^2 / [f]. In RMSProp, the update is −αg/(v+ε)- \alpha g / (\sqrt{v} + \varepsilon), and since v\sqrt{v} has units [f]/[θ][f] / [\theta] (it is an RMS gradient), g/vg / \sqrt{v} is dimensionless. That means α\alpha must carry all of [θ][\theta], but α\alpha is just a scalar we tune by hand, with no knowledge of these units.

AdaDelta fixes this by replacing α\alpha with a quantity that has the correct units by construction. Define the second-moment EMA of the gradients as in RMSProp, vt=βvt−1+(1−β)gt2v_{t} = \beta v_{t - 1} + (1 - \beta) g_{t}^2, and additionally track a second-moment EMA of the parameter updates themselves: Δt:=βΔt−1+(1−β)(θt−θt−1)2\Delta _{t} := \beta \Delta _{t - 1} + (1 - \beta) (\theta _{t} - \theta _{t - 1})^2 with Δ0=0\Delta _{0} = 0. Then Δt−1\sqrt{\Delta _{t - 1}} has units [θ][\theta] (it is an RMS parameter change) and vt\sqrt{v_{t}} has units [f]/[θ][f] / [\theta] (an RMS gradient). Their ratio carries units [θ]2/[f][\theta]^2 / [f], exactly what is needed to multiply gg and produce a step with units [θ][\theta].

The update therefore becomes θt+1=θt−Δt−1+εvt+εgt. \theta _{t + 1} = \theta _{t} - \frac{\sqrt{\Delta _{t - 1} + \varepsilon}}{\sqrt{v_{t} + \varepsilon}} g_{t} .

Proof.

We verify the unit balance. Writing [⋅][\cdot] for “units of”:

  • gtg_{t}: units [f]/[θ][f] / [\theta].
  • vt\sqrt{v_{t}}: RMS of gg, hence units [f]/[θ][f] / [\theta].
  • Δt−1\sqrt{\Delta _{t - 1}}: RMS of θt−θt−1\theta _{t} - \theta _{t - 1}, hence units [θ][\theta].

The ratio Δt−1/vt\sqrt{\Delta _{t - 1}} / \sqrt{v_{t}} therefore has units [θ]/([f]/[θ])=[θ]2/[f][\theta] / ([f] / [\theta]) = [\theta]^2 / [f]. Multiplying by gtg_{t} (units [f]/[θ][f] / [\theta]) gives [θ]2/[f]⋅[f]/[θ]=[θ][\theta]^2 / [f] \cdot [f] / [\theta] = [\theta], matching the units of Δθ\Delta \theta.

Two details deserve comment. First, Δt−1\Delta _{t - 1} (not Δt\Delta _{t}) must appear in the numerator. At step tt the current update θt+1−θt\theta _{t + 1} - \theta _{t} has not yet been computed, so we use the most recent available running average. Second, the dimensional argument does not uniquely determine the numerator: any quantity with units [θ][\theta] would restore the balance (e.g. a fixed scale DD, or ∥θt−θ0∥\| \theta _{t} - \theta _{0} \|). Zeiler’s choice, the RMS of recent parameter changes, is a local and adaptive option that aims to automatically reflect the current step scale without introducing a new hyper-parameter.

The role of ε\varepsilon in the numerator is also worth noting. In the denominator, ε\varepsilon prevents division by zero, as in RMSProp, although with ε\varepsilon now inside the square root for stylistic reasons. In the numerator, it serves a different purpose: since Δ0=0\Delta _{0} = 0, without ε\varepsilon the first update would be exactly zero, Δ1\Delta _{1} would remain zero, and the method would never move. The ε\varepsilon in the numerator bootstraps the algorithm: the initial effective learning rate is approximately ε/v1\sqrt{\varepsilon} / \sqrt{v_{1}}, and once the parameters begin to move, Δt\Delta _{t} grows and takes over.

5 Modern Techniques #

The previous section developed two independent improvements to gradient descent. Momentum smooths the direction by averaging over recent gradients, and adaptive methods such as RMSProp correct the scale by normalising each coordinate based on its recent gradient magnitude. Because these operate on different components of our general framework θk+1=θk+αkdk\theta _{k + 1} = \theta _{k} + \boldsymbol{\alpha}_{k} \boldsymbol{d}_{k}, a natural question is whether they can be combined.

5.1 Adam #

Adam (Adaptive Moment Estimation), see [11], answers this question by maintaining two EMAs simultaneously: one over the gradient itself (the first moment mtm_{t}, the normalised EMA of Section 4.1.1) and one over the squared gradient (the second moment vtv_{t}, as in RMSProp). The first moment sets the direction, and the second provides the per-coordinate normalisation that sets adaptive step sizes.

There is one subtlety. Both EMAs are initialised at zero, so in the first few iterations they are biased towards zero, underestimating the true moments. At step tt, the EMA weights sum to (1−β)∑j=0t−1βj=1−βt(1 - \beta) \sum_{j = 0}^{t - 1} \beta^j = 1 - \beta^t, which is always less than 1, and noticeably so when tt is small. Dividing by this factor recovers an unbiased estimate (assuming the gradient distribution is stationary). The correction is significant early on (for β2=0.999\beta _{2} = 0.999, the raw v1v_{1} underestimates E[g2]\mathbb{E} [g^2] by a factor of 1000) and vanishes as t→∞t \rightarrow \infty.

Algorithm 7 (Adam)

Require: α\alpha: Step size

Require: ε\varepsilon: Small constant for numerical stability (typically 10−810^{- 8})

Require: β1,β2∈[0,1)\beta _{1}, \beta _{2} \in [0, 1): Exponential decay rates for the moment estimates

Require: f(θ)f (\theta): Stochastic objective function with parameters θ\theta

Require: θ0\theta _{0}: Initial parameter vector

m0←0m_{0} \leftarrow 0 (Initialise 1st moment vector)

v0←0v_{0} \leftarrow 0 (Initialise 2nd moment vector)

t←0t \leftarrow 0 (Initialise time-step)

while θt\theta _{t} not converged do

t←t+1t \leftarrow t + 1

gt←∇θft(θt−1)g_{t} \leftarrow \nabla _{\theta} f_{t} (\theta _{t - 1}) (Get gradients with respect to stochastic objective at time tt)

mt←β1⋅mt−1+(1−β1)gtm_{t} \leftarrow \beta _{1} \cdot m_{t - 1} + (1 - \beta _{1}) g_{t} (Update biased first moment estimate)

vt←β2⋅vt−1+(1−β2)gt2v_{t} \leftarrow \beta _{2} \cdot v_{t - 1} + (1 - \beta _{2}) g_{t}^2 (Update biased second raw moment estimate)

m^t←mt/(1−β1t)\hat{m}_{t} \leftarrow m_{t} / (1 - \beta _{1}^t) (Compute bias-corrected first moment estimate)

v^t←vt/(1−β2t)\hat{v}_{t} \leftarrow v_{t} / (1 - \beta _{2}^t) (Compute bias-corrected second raw moment estimate)

θt←θt−1−α⋅m^t/(v^t+ε)\theta _{t} \leftarrow \theta _{t - 1} - \alpha \cdot \hat{m}_{t} / \left( \sqrt{\hat{v}_{t}} + \varepsilon \right) (Update parameters)

end while

return θt\theta _{t} (Resulting parameters)

5.2 AMSGrad #

Adam’s use of an EMA for the second moment, inherited from RMSProp, brings a subtle trade-off. The EMA can forget large past gradients, causing vtv_{t} to decrease over time. When this happens, the effective learning rate α/v^t\alpha / \sqrt{\hat{v}_{t}} increases, potentially destabilising the optimiser in regions where a smaller step would be appropriate. Reddi et al., [12], constructed simple convex counterexamples where this behaviour prevents Adam from converging.

AMSGrad addresses this with a minimal modification: replace the bias-corrected second moment with its running maximum,

v^t=max⁡(v^t−1,vt/(1−β2t)), \hat{v}_{t} = \max (\hat{v}_{t - 1}, v_{t} / (1 - \beta _{2}^t)),

so that the denominator can only grow. This guarantees that the effective learning rate is non-increasing, restoring the convergence property that AdaGrad enjoys by construction. The parameter update is otherwise identical to Adam:

θt=θt−1−α⋅m^t/(v^t+ε). \theta _{t} = \theta _{t - 1} - \alpha \cdot \hat{m}_{t} / \left( \sqrt{\hat{v}_{t}} + \varepsilon \right) .

In practice, the convergence failures that motivate AMSGrad are rare in typical deep learning settings, and Adam with well-chosen hyper-parameters often performs comparably. The fix does, however, illustrate a recurring tension in optimiser design: RMSProp’s EMA was introduced to let the normalisation adapt over time, yet that very adaptivity can violate the monotonic decay of the learning rate that classical convergence proofs require. AMSGrad resolves this by keeping the adaptivity of the EMA estimate while enforcing monotonicity on the effective step size.

5.3 AdamW #

In practice, optimisation is almost always combined with regularisation to prevent overfitting. The most common form is L2L^2 regularisation, which adds a penalty λ2∥θ∥2\frac{\lambda}{2} \| \theta \|^2 to the loss, giving a modified objective f~(θ)=f(θ)+λ2∥θ∥2\tilde{f} (\theta) = f (\theta) + \frac{\lambda}{2} \| \theta \|^2. For SGD, the gradient of the penalty is λθ\lambda \theta, so the update becomes

θt+1=θt−α(gt+λθt)=(1−αλ)θt−αgt. \theta _{t + 1} = \theta _{t} - \alpha (g_{t} + \lambda \theta _{t}) = (1 - \alpha \lambda) \theta _{t} - \alpha g_{t} .

The factor (1−αλ)(1 - \alpha \lambda) shrinks the parameters towards zero at each step, which is why L2L^2 regularisation is often called weight decay. For SGD, L2L^2 regularisation and weight decay applied directly to the parameters, θt+1=(1−λ′)θt−αgt\theta _{t + 1} = (1 - \lambda') \theta _{t} - \alpha g_{t}, are equivalent with λ′=αλ\lambda' = \alpha \lambda, and practitioners routinely treat them as interchangeable.

However, for adaptive methods this equivalence breaks down. To see why, consider what happens when we apply Adam to the regularised objective f~=f+λ2∥θ∥2\tilde{f} = f + \frac{\lambda}{2} \| \theta \|^2. The gradient fed to Adam is g~t=gt+λθt\tilde{g}_{t} = g_{t} + \lambda \theta _{t}, which enters both the first and second moment estimates:

mt=β1mt−1+(1−β1)(gt+λθt)vt=β2vt−1+(1−β2)(gt+λθt)2. \begin{aligned} m_{t} &= \beta _{1} m_{t - 1} + (1 - \beta _{1}) (g_{t} + \lambda \theta _{t})\\ v_{t} &= \beta _{2} v_{t - 1} + (1 - \beta _{2}) (g_{t} + \lambda \theta _{t})^2 . \end{aligned}

The second-moment estimate vtv_{t} now absorbs λθt\lambda \theta _{t}. After adaptive rescaling, the effective per-coordinate update for coordinate ii is proportional to

m^t,iv^t,i+ε=EMA⁡(gi+λθi)EMA⁡((gi+λθi)2)+ε. \frac{\hat{m}_{t, i}}{\sqrt{\hat{v}_{t, i}} + \varepsilon} = \frac{\operatorname{EMA} (g_{i} + \lambda \theta _{i})}{\sqrt{\operatorname{EMA} ((g_{i} + \lambda \theta _{i})^2)} + \varepsilon} .
The adaptive scaling partially cancels the regularisation.

Proof.

Consider a parameter θi\theta _{i} whose task gradient is consistently small (gt,i≈0g_{t, i} \approx 0) but whose regularisation gradient λθt,i\lambda \theta _{t, i} is large (the parameter has drifted far from zero). With g~t,i≈λθt,i\tilde{g}_{t, i} \approx \lambda \theta _{t, i}, both the numerator and denominator of the adaptive ratio are dominated by the same quantity:

EMA⁡(λθi)EMA⁡(λ2θi2)+ε≈λθiλ∣θi∣+ε≈sign⁡(θi). \frac{\operatorname{EMA} (\lambda \theta _{i})}{\sqrt{\operatorname{EMA} (\lambda^2 \theta _{i}^2)} + \varepsilon} \approx \frac{\lambda \theta _{i}}{\lambda | \theta _{i} | + \varepsilon} \approx \operatorname{sign} (\theta _{i}) .

The magnitude of the penalty gradient has been normalised away – the update is approximately ±α\pm \alpha, regardless of how large λθi\lambda \theta _{i} is. The intended decay, which should pull θi\theta _{i} towards zero in proportion to its magnitude, has been reduced to a constant-sized nudge. Meanwhile, a parameter with large task gradients has a large vt,iv_{t, i} that dilutes the regularisation term even further.

Loshchilov and Hutter, [13], showed that this coupling is a major reason why Adam with L2L^2 regularisation often generalises worse than SGD with momentum on tasks such as image classification.

AdamW fixes this by decoupling the weight decay from the adaptive gradient step. Instead of regularising the loss, the decay is applied directly to the parameters, bypassing the adaptive scaling entirely:

θt=θt−1−α⋅m^t/(v^t+ε)−αλθt−1. \theta _{t} = \theta _{t - 1} - \alpha \cdot \hat{m}_{t} / \left( \sqrt{\hat{v}_{t}} + \varepsilon \right) - \alpha \lambda \theta _{t - 1} .

The first term is the standard Adam step, computed from the unregularised gradient gt=∇f(θt−1)g_{t} = \nabla f (\theta _{t - 1}) (not g~t\tilde{g}_{t}). The second term applies the decay αλθt−1\alpha \lambda \theta _{t - 1} uniformly to every parameter, independent of vtv_{t}. A parameter with a large value is always pulled back proportionally, regardless of its gradient history.

This has two practical benefits. First, the regularisation strength is no longer entangled with the second-moment statistics, so the decay acts as intended. Second, hyper-parameter tuning becomes simpler. In Adam with L2L^2 regularisation, changing α\alpha implicitly changes the effective regularisation (since both interact through vtv_{t}), forcing a joint search. In the form above, α\alpha and λ\lambda still interact through their product αλ\alpha \lambda, but no longer through vtv_{t}; Loshchilov and Hutter go further, writing the decay as ηtλθt−1\eta _{t} \lambda \theta _{t - 1} with a separate schedule multiplier ηt\eta _{t}, so that the optimal λ\lambda becomes largely independent of α\alpha. AdamW has since become the default choice for training large models.

References

  1. Sebastian Ruder (2017). An overview of gradient descent optimization algorithms. doi:10.48550/arXiv.1609.04747 link
  2. Augustin-Louis Cauchy (1897). Méthode générale pour la résolution des systèmes d'équations simultanées. 10 : 399–402. doi:10.1017/CBO9780511702396.063 link
  3. Herbert Robbins and Sutton Monro (1951). A Stochastic Approximation Method. 22 (3) : 400–407. doi:10.1214/aoms/1177729586 link
  4. B. T. Polyak (1964). Some methods of speeding up the convergence of iteration methods. 4 (5) : 1–17. doi:10.1016/0041-5553(64)90137-5 link
  5. Ning Qian (1999). On the momentum term in gradient descent learning algorithms. 12 (1) : 145–151. doi:10.1016/S0893-6080(98)00116-6 link
  6. Y. Nesterov (1983). A method for solving the convex programming problem with convergence rate O(1/k^2). link
  7. Wouter M. Koolen (2017). The Advantage of Full AdaGrad. link
  8. John Duchi , Elad Hazan and Yoram Singer (2011). Adaptive Subgradient Methods for Online Learning and Stochastic Optimization. 12 : 2121–2159. link
  9. Geoffrey Hinton (2012). Neural Networks for Machine Learning.
  10. Matthew D. Zeiler (2012). ADADELTA: An Adaptive Learning Rate Method. doi:10.48550/ARXIV.1212.5701 link
  11. Diederik P. Kingma and Jimmy Ba (2017). Adam: A Method for Stochastic Optimization. doi:10.48550/arXiv.1412.6980 link
  12. Sashank J. Reddi , Satyen Kale and Surinder Kumar (2018). On the Convergence of Adam and Beyond. link
  13. Ilya Loshchilov and Frank Hutter (2019). Decoupled Weight Decay Regularization. doi:10.48550/arXiv.1711.05101 link