Conjugate Gradient Algorithm
Chooses successive search directions that do not undo each other's progress.
The idea
On a quadratic bowl in n dimensions, steepest descent zig-zags. Conjugate gradient picks each new direction so that it is "conjugate" (A-orthogonal) to the previous ones, so it never spoils earlier progress and reaches the exact minimum in at most n steps. Non-linear variants apply the idea to neural-network loss.
dₖ₊₁ = −gₖ₊₁ + βₖ dₖ
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- current weights
- minimum
- last update
Start somewhere on the bowl. Rings are lines of equal loss; the minimum is at the centre.
- step:
- 0
- loss:
- 3.4617
Loss landscape seen from above: a long narrow valley. Final loss 0.
Step by step
- 1Start with the steepest-descent direction.
- 2Line-search for the best step along it.
- 3Compute the new gradient.
- 4Form a new direction from the new gradient plus a fraction β of the old direction.
- 5Repeat.
Where it is used
Large linear systems and some batch training problems.
Watch out for
Needs a good line search; less suited to noisy mini-batch gradients.