ContentsThe library

The Mathematics of Gradient Descent

Dividing by the Size of Your Own Gradients

Last timeWhy a Noisy Gradient Still Works

Adaptive methods give every parameter its own step size using quantities already in hand. Here is what that buys, what it cannot fix, and why the correction term exists.

The conditioning lesson identified the exact fix and then said it was

unavailable: rescale each direction by its curvature, and the ellipse becomes a

circle. The matrix that would do it has n2n^2 entries and needs inverting.

Adaptive methods take the part of that fix which is affordable. Restrict the

rescaling to the diagonal, so it is one number per parameter rather than a

matrix, and estimate those numbers from the gradients that the run is producing

anyway. Nothing is measured that was not already there, and the memory cost is

two extra numbers per parameter.

The denominator

Keep a running average of the square of each coordinate's gradient, and divide

that coordinate's step by its square root:

vt=β2vt−1+(1−β2)gt2,θt+1=θt−α gtvt+ϵv_t = \beta_2 v_{t-1} + (1 - \beta_2) g_t^2, \qquad \theta_{t+1} = \theta_t - \frac{\alpha \, g_t}{\sqrt{v_t} + \epsilon}

The square is taken coordinate by coordinate, so vv is a vector the same shape

as the parameters, and each parameter is divided by its own history. A

coordinate whose gradients are routinely large gets a small step; a coordinate

whose gradients are routinely tiny gets a large one.

That is the connection back to conditioning. In the stretched bowl of the

earlier lesson the sharp direction has large gradients and the flat direction

has small ones, so this division pushes both toward the same effective rate. It

is preconditioning with the typical gradient magnitude standing in for the

curvature, which is a rough substitute but a free one.

The invariance is worth checking directly. Multiply the loss by a thousand.

Every gradient becomes a thousand times larger, vv becomes a million times

larger, v\sqrt{v} becomes a thousand times larger, and the ratio is exactly

what it was. Plain gradient descent would have needed its learning rate divided

by a thousand. This is the property that makes adaptive methods forgiving, and

it is also why their learning rate is not comparable to the learning rate of

plain descent: here α\alpha is close to the actual distance moved per step,

because the fraction it multiplies is of size roughly one.

The lesson stops here

7 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01Why the Steepest Direction Is the Negative Gradient
  2. 02Why the Gradient Is Computed Backwardsopening only
  3. 03The Largest Step a Curvature Will Tolerateopening only
  4. 04One Ratio Decides How Long Training Takesopening only
  5. 05What Momentum Multiplies Your Step Size Byopening only
  6. 06The Gradient You Use Is Always the Wrong Oneopening only
  7. 07Dividing by the Size of Your Own Gradientsyou are here
  8. 08The Variance That Keeps a Deep Network Aliveopening only

Read alongside