Skip to content

Calculus for ML

Gradients: The Compass of Steepest Ascent

8 min+75 XPStep 1/11

From one slope to a million

A real model has thousands to trillions of knobs, each with its own derivative. Collect every slope into a vector and you get the gradient: one arrow whose entries are 'how the loss responds to each weight.'

Its geometry is the gift: the gradient points in the direction of steepest uphill. Not a hint about which knob matters — the single direction in weight-space where loss climbs fastest.

Which means −gradient is steepest downhill: the fastest way to shrink the loss from exactly where you stand. All that calculus, and the answer is one arrow.

analogy

The gradient is a compass needle on a foggy mountain — it can't see the valley, but it unfailingly points up the steepest local slope. Reaching the valley floor means stepping opposite the needle, over and over.