Gradient Descent Visualizer

Release SGD, momentum, RMSProp and Adam from the same point on the same loss surface and watch them take four different routes down. Adjust the learning rate and the beta terms and see the paths redraw.

Please verify you are human to use the visualiser.

Momentum, Adaptive Steps and the Shape of the Surface

The Gradient Step

Plain gradient descent moves against the gradient by a fixed learning rate. The direction is locally the steepest, which is not the same as pointing at the minimum.

Momentum

A velocity term lets consistent directions build up and alternating ones cancel. That damps the zig-zag across a ravine and speeds up travel along it.

Adaptive Step Size

RMSProp and Adam divide by a running size of the gradient, so the step is roughly the learning rate whatever the slope. That helps at saddles and costs speed on steep ground.

Surface Geometry

Ravines, saddles and barriers each defeat a different method. Switching surfaces changes which optimiser wins, which is why no single one is the default answer.

Reading the Paths

The five surfaces are chosen so that the ranking changes between them. On the bowl every method arrives and only the route differs. On the ravine momentum and the adaptive methods finish while SGD is still zig-zagging. On Rosenbrock momentum wins and Adam comes last at the same learning rate, because Adam discards the gradient magnitude that momentum is exploiting. On the double well momentum and RMSProp carry enough speed to cross the barrier into the global minimum while SGD and Adam settle into the local one.

The last of those is worth sitting with. None of these methods is searching for a global minimum. They follow the slope under their feet, and whether they land in the better basin comes down to momentum, the learning rate and where they started. A real training run also carries mini-batch noise, which acts a little like extra momentum and shakes the path out of the shallowest minima.

For the implementations, our tutorial on SGD, momentum and Adam from first principles builds all four in NumPy and checks them against PyTorch. The learning rate usually matters more than which of the four you pick, and it is covered in learning rate scheduling and hyperparameter optimisation. Every path here follows one objective; when two share a trunk their gradients can point in opposite directions, which is measured in multi-task learning and conflicting gradients. For where the gradients come from in the first place, see backpropagation from first principles and why first-order methods win, which explains what the curvature these paths are navigating would cost to compute exactly.

Optimiser choice rarely decides whether a project works. What decides it is whether the objective being minimised is the one the business actually cares about, and whether there is enough labelled data to fit it. Setting those up before the training budget is spent is our AI pilot design work.

Related Tools

Stay in the loop

Get notified when new tutorials and deep-dives are published. No spam, unsubscribe anytime.

Gradient Descent Visualiser FAQ

Common questions about SGD, momentum, RMSProp, Adam and learning rates