The gradient points uphill as steeply as possible. To find a low point, you have been setting $\nabla f = \mathbf{0}$ and solving, as with critical points. That works for small textbook functions. For a function of a thousand variables, or a million, nobody can solve that system. There is a humbler plan: stand somewhere, feel which way is down, take a step, and repeat.
Key idea
Why it works
One variable first
Worked example: The step size decides everything
- $f'(x) = 2x$, so $x_{k+1} = x_{k} - 2\eta x_{k} = (1 - 2\eta)x_{k}$. Every step multiplies by $r = 1 - 2\eta$.
- $\eta = 0.1$: $r = 0.8$. The points $2, 1.6, 1.28, \ldots$ slide down toward $0$.
- $\eta = 0.5$: $r = 0$. One step lands exactly on the minimum.
- $\eta = 0.9$: $r = -0.8$. The points $2, -1.6, 1.28, \ldots$ jump across the minimum each time, but still close in.
- $\eta = 1.1$: $r = -1.2$. The points $2, -2.4, 2.88, \ldots$ land farther out every time: the run blows up.
Answer: It converges for $0 < \eta < 1$, fastest at $\eta = 0.5$, and blows up for $\eta > 1$.
Two variables
Worked example: Steps on a bowl
- $\nabla f = \langle 2x, 6y \rangle$, which is $\langle 4, 6 \rangle$ at $(2, 1)$.
- $(2, 1) - 0.1\langle 4, 6 \rangle = (1.6, 0.4)$, and $f$ drops from $7$ to $2.56 + 0.48 = 3.04$.
- At $(1.6, 0.4)$: $\nabla f = \langle 3.2, 2.4 \rangle$, so the next point is $(1.28, 0.16)$, where $f = 1.6384 + 0.0768 = 1.7152$.
- Each step multiplies $x$ by $1 - 2\eta = 0.8$ and $y$ by $1 - 6\eta = 0.4$: the steep direction shrinks faster.
Answer: $(1.6, 0.4)$, then $(1.28, 0.16)$
Those factors also set a speed limit. In the $y$-direction the factor $1 - 6\eta$ has size less than $1$ only when $\eta < \frac{1}{3}$; in the $x$-direction the limit is $\eta < 1$. The steepest direction sets the limit for the whole run. In a long, narrow valley that limit is small, so progress along the gentle floor of the valley is slow, and the path zigzags across it.
Worked example: Not always the lowest point
- $f'(x) = 4x^{3} - 8x + 1$, whose zeros are near $x \approx -1.47$, $0.13$ and $1.35$: two valleys with a hill between them.
- From $x_{0} = 1$: $f'(1) = -3 < 0$, so the steps go right and settle near $x \approx 1.35$, where $f \approx -2.62$.
- From $x_{0} = -1$: $f'(-1) = 5 > 0$, so the steps go left and settle near $x \approx -1.47$, where $f \approx -5.44$.
- Both are local minima. Gradient descent stops at the bottom of whichever valley it starts in, and only the second one is the lowest point.
Answer: It finds the valley it starts in, which may not hold the lowest point.
Common mistake
Common mistake