SECTION 01 / 4

Gradient Descent Revisited — Slow Plateaus and Contour Maps

4 min read
On this page 6 headings
BUILD INTUITION WITH NUMBERS

Watch a gradient step reduce a loss

Use the one-parameter bowl L(w) = ½w², starting at w = 2, with learning rate 0.25.

  1. Compute the current loss and gradient.

    L(2)=2,dLdw=w=2L(2)=2,\qquad\frac{dL}{dw}=w=2
  2. Move opposite to the gradient.

    wnew=2−0.25(2)=1.5w_{new}=2-0.25(2)=1.5
  3. Evaluate the new point.

    L(1.5)=12(1.5)2=1.125L(1.5)=\frac12(1.5)^2=1.125

What changed? The gradient points uphill; subtracting a suitable step moves downhill. A lower gradient near the minimum also makes steps smaller.

Quick check: At w = 0, what update does this rule make?

No change: the gradient is zero.

Swipe long formulas, tables or code sideways to see the rest.

Start here Week 2 gave us gradient descent. This week asks: is it fast? The answer: not always. On flat regions of the error surface it crawls. Before we fix that with better optimisers, we learn a simple tool to see what an optimiser is doing — the contour map.

1. Quick recap (from Week 2)

  • Sigmoid neuron f(x)=11+e−(wx+b)f(x) = \frac{1}{1 + e^{-(wx + b)}}, data (0.5, 0.2) and (2.5, 0.9).
  • Loss L(w,b)=(1/N)∑(yi−f(xi))2L(w, b) = (1/N) \sum (y_{i} - f(x_{i}))^{2}. Guessing (w, b) by hand works for 2 parameters but not for millions.
  • From the Taylor series: the loss falls fastest when we move opposite to the gradient.
  • Update rule:wt+1=wt−η∇wt,bt+1=bt−η∇bt. w_{t+1} = w_t - \eta \nabla w_t, b_{t+1} = b_t - \eta \nabla b_t.
  • For the sigmoid neuron: ∇w=∑(f(xi)−yi)f(xi)(1−f(xi))xi,∇b=∑(f(xi)−yi)f(xi)(1−f(xi))\nabla w = \sum (f(x_{i}) - y_{i}) f(x_{i})(1 - f(x_{i})) x_{i}, \nabla b = \sum (f(x_{i}) - y_{i}) f(x_{i})(1 - f(x_{i})).

Full derivations are on the Week 2 page Gradient Descent.

2. Steep slopes and gentle slopes

The gradient is the slope Δy/Δx of the loss curve.

  • Where the curve is steep, the gradient is large.
  • Where the curve is gentle, the gradient is small.

Our update is η∇w\eta \nabla w. So:

  • On steep parts → big steps.
  • On gentle parts → tiny steps.
Step size follows the slope: fast on steep ground, very slow on flat ground.
Step size follows the slope: fast on steep ground, very slow on flat ground.
Open image ↗
A ball on a curve takes big steps on the steep part and tiny steps on the flat part

Lecture example — starting points Run gradient descent for tmax=150t_{\mathrm{max}} = 150 steps from (w,b)=(−2,2)(w, b) = (-2, 2), and again from (−3, 2). Whatever the starting point, once the path reaches a gentle region, progress slows down a lot. Starting from (−4, −4) is even worse — the loss there is almost flat.

Everyday example Rolling a marble on a nearly flat table: it barely moves, even though the floor (the minimum) is somewhere ahead.

3. Contours: seeing the surface from the top

3D plots are hard to read. A contour map is a 2D way to show the same surface.

How it’s made: take horizontal slices of the error surface at equal heights (equal loss values). Look from the top. Each slice becomes a closed line — a contour. Every point on one contour has the same loss.

Lines close together = steep; lines far apart = gentle.
Lines close together = steep; lines far apart = gentle.
Open image ↗
A 3D loss hill is sliced at equal heights and seen from above as a map of contour lines

How to read a contour map:

What you see What it means
Contours close together steep slope in that direction
Contours far apart gentle slope
Innermost small ring the minimum (lowest loss)

This is exactly like height lines on a trekking map of a hill.

Gradient descent on a contour map: the path always crosses contours at right angles (the gradient is perpendicular to the contour line). Where contours are far apart, the dots of the path bunch together — tiny steps.

4. The problem to solve

Plain gradient descent:

  • takes a lot of time to cross regions with a gentle slope,
  • because the gradient there is very small.

Can we do better? Yes — momentum-based gradient descent (next page).

One more thing to keep in mind: every optimiser starts by computing ∇w0\nabla w_{0} at the starting point.

In one line: Gradient descent moves fast on steep slopes and crawls on gentle ones; contour maps show the error surface from the top, where close lines mean steep and far lines mean gentle.

Exam words: gentle slope, steep slope, plateau, contour, contour map, equal-loss line, top view.

Quick check

  1. On a contour map, two neighbouring lines are very close in the w-direction. What does that tell you?
The loss changes quickly in the w-direction — the slope along w is steep.
  1. Why does gradient descent slow down on a plateau?
The step is η×\eta \times gradient, and on a plateau the gradient is close to 0, so the steps are tiny.
  1. All points on one contour line have the same ___.
Loss (error) value.
  1. ∇w=0.001,η=1\nabla w = 0.001, \eta = 1. How far does w move in one step?
0.001 — a very small step.
YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑