Gradient Descent
How does a step downhill find the bottom of a bowl?
A point on a bowl-shaped surface, moved downhill one step at a time against the gradient. Choose where it starts, how steep the bowl is and how large each step is, and see it settle, overshoot, or run away.
- level curves of f
- path
- Iteration
- 0 of 41
- Point
- (-2.200, 1.600)
- f(x, y)
- 6.260
- |∇f|
- 5.280
η = 0.30 is below 2/max(a, b) = 0.67, and both step factors are positive: every step moves closer to the minimum.
The model
The surface is a quadratic bowl,
whose only minimum is at the origin, and whose gradient is . Gradient descent moves against the gradient by a fixed fraction of its size — the learning rate — at every step:
When it works, and when it does not
For this bowl the two coordinates do not interact, and each step simply multiplies by and by . So the iteration converges exactly when both factors are smaller than one in magnitude, that is, when
If a factor is negative but still smaller than one in size, that coordinate overshoots the bottom and lands on the other side at each step, shrinking all the while: oscillation. If a factor reaches one in magnitude the steps stop shrinking and the point leaves the frame: divergence. A bowl that is much steeper one way than the other () is the awkward case, because the rate that is safe for the steep direction is slow for the shallow one.
Everything above is true of this quadratic. For a general non-convex function gradient descent is only guaranteed, at best, a local minimum, and whether it reaches even that depends on the function and the learning rate.
Connected ideas
Related research
- Solving Consensus Dynamics in Networks Using Mathematical and Computational MethodMathematical connection
Under its assumptions, the consensus iteration x ← x − dt·Lx is gradient descent on the graph-Laplacian energy ½xᵀLx, with the same kind of bound on the step size. The same mathematics read in two places, not the same demonstration.