A map of the loss surface
A loss that depends on two weights: f(w₁, w₂) = w₁² / 4 + w₂². Seen from above, the contour lines are nested ellipses and the darkest region is the bottom.
A point on the map
P = (3, 1.50). The loss at this point is 4.50.
The slope along w₁
If w₂ is held still and only w₁ changes, the slope is ∂f/∂w₁ = w₁ / 2 = 1.50. That is a partial derivative.
The slope along w₂
Now w₁ is held still: ∂f/∂w₂ = 2 · w₂ = 3. The ellipses are closer together in this direction, so the slope is steeper.
The gradient
Writing the two partial derivatives side by side gives the gradient: ∇f = (1.50, 3). The red arrow points where the loss rises fastest. The arrows are drawn at a quarter of the gradient's length.
The gradient is perpendicular to the line
At every point the gradient is perpendicular to the contour line through it. Walking along the line does not change the loss; walking along the gradient raises it fastest.
A step the other way
Gradient descent steps against the gradient: P′ = (2.55, 0.60), and the loss drops from 4.50 to 1.99.