Visualize how different optimization algorithms navigate complex terrain, escape local minima, and find the global minimum. Run multiple in parallel to observe realistic relative speeds!
A loss surface in three dimensions is the only version you can actually look at. The features that decide which optimiser wins — ravines, plateaus, saddle points — are all visible here.
The folk explanation of training failure is "it got stuck in a local minimum". In high dimensions that is mostly wrong. For a point to be a local minimum, the surface must curve upward in every direction at once — and with millions of parameters that is vanishingly unlikely. Saddle points, where it curves up in some directions and down in others, are enormously more common.
This is a practical difference. A local minimum is a trap. A saddle is not — there is a way down, and an optimiser with momentum carries enough velocity from earlier steps to keep moving across the flat region until it finds one.
Picture two weights on the horizontal axes and the loss on the vertical one. Training is a ball rolling downhill on that surface, and the optimiser decides how the ball moves.
Real networks have millions of weights, so the surface is millions of dimensions rather than two. The picture is still useful, because the features that make optimisation hard are visible in three dimensions:
Plain SGD takes a step directly downhill, scaled by the learning rate. In a ravine that means oscillating across the narrow direction while barely advancing along the valley floor.
Momentum accumulates velocity, so the oscillations partly cancel and the consistent downhill direction builds speed. It is the difference between a ball on a rough surface and one with mass.
Adam gives every weight its own effective step size, dividing by the square root of its recent squared gradients. Weights on flat directions get larger steps and weights on steep ones get smaller, which reshapes the ravine into something closer to a bowl.
| Optimiser | In a ravine | On a plateau | Near a saddle |
|---|---|---|---|
| SGD | Zigzags slowly | Stalls | Can stall |
| SGD + momentum | Advances along the valley | Coasts through | Coasts through |
| Adam | Advances directly | Amplifies small gradients | Escapes readily |
That plateau row explains a real advantage of adaptive methods: dividing by a small accumulated gradient magnitude increases the step, so Adam keeps moving where SGD would sit still.
The old fear was that gradient descent would get stuck in bad local minima. High-dimensional geometry says otherwise.
For a stationary point to be a local minimum, the curvature must be positive in every direction. With ten million parameters, that requires ten million signs to agree, which is vanishingly unlikely. Almost every point where the gradient vanishes is a saddle — downhill in at least one direction.
That is good news, because saddles are escapable. The stochastic noise from mini-batches is usually enough to push the model off the ridge and onto a descending path, which is one reason mini-batch training generalises better than full-batch.
It also reframes what training is doing: not searching for a unique global minimum, but descending through a landscape of many near-equivalent good solutions, most of which are fine.
Over-reading the picture. This surface has two parameters. A real network has millions, and its loss landscape has properties that genuinely do not exist in 3D. Use this to build intuition about momentum and adaptive step sizes; do not use it to conclude anything about how many minima a real network has.Judging an optimiser from one starting point. Change where the run begins and the ranking often changes with it. A single trajectory is an anecdote.
The shape of the surface, not the cleverness of the algorithm, decides which optimiser looks good.
Two solutions can fit the training data equally well and behave very differently on new data.
A sharp minimum is a narrow crevice: move the weights slightly and the loss rises steeply. Since the test distribution differs slightly from the training one, that sensitivity translates into worse test performance.
A flat minimum is a broad basin: nearby weights are almost as good, so a small mismatch between train and test costs little.
Several observed behaviours follow from this:
You can plot the landscape of an actual network, and the pictures are informative.
Take a trained model's weights, pick two random directions in weight space, and evaluate the loss on a grid of small perturbations along them. Plotting that grid gives a two-dimensional slice through a million-dimensional surface.
What such plots reliably show: networks without skip connections have chaotic, spiky surfaces; networks with them are dramatically smoother. That is a fairly direct visual explanation of why residual connections make deep networks trainable, and it is one of the more satisfying results in the area.
The caveat is that a two-dimensional slice of a million-dimensional surface can be misleading. Treat these plots as intuition, not proof.
A bowl, a ravine, a saddle and a plateau. Each one defeats a different optimiser, and running all four on all four shows why there is no single right answer.
Does the optimiser find the global minimum? No, and it does not need to. High-dimensional landscapes have vast numbers of near-equivalent good solutions.
Why does momentum help? It averages recent gradients, so consistent directions accumulate and oscillations cancel — exactly what a ravine needs.
Are local minima a problem? Rarely. Saddle points and plateaus are the real obstacles in high dimensions.
Should I use a large batch to get a cleaner gradient? A cleaner gradient is not automatically better — the noise helps escape saddles and avoid sharp minima. Scale the learning rate if you do increase the batch.
What is the difference between the learning rate and momentum? The learning rate is how far to step; momentum is how much of the previous direction to keep.
Can I see whether my minimum is flat? Approximately — perturb the weights slightly and measure how much the loss rises. Large increases mean a sharp minimum.
Say the answer out loud before you reveal it — recalling it is what makes it stick, and rereading it is not.
What is meant by “Small batches generalise slightly better” here?
because their gradient noise makes it hard to settle into a narrow crevice.
What is meant by “Very large batches sometimes generalise worse” here?
, and techniques like LARS and longer warm-up exist to counter it.
What is meant by “Weight averaging” here?
(SWA) averages weights from several late-training points, landing nearer the centre of a basin than any individual point.
What is meant by “Sharpness-aware minimisation” here?
(SAM) explicitly penalises sharpness by taking a step towards the worst nearby point before updating.
Visualize how different optimization algorithms navigate complex terrain, escape local minima, and find the global minimum. Run multiple in parallel to observe realistic relative speeds!