Don Stephenson Don Stephenson

The Mechanics of Machine Learning

Translating calculus to silicon — Jacobians, Hessians, and the operational architecture of AI.

Slide 1: The Mechanics of Machine Learning
These eight panels are working notes on a single briefing deck, kept in its original sequence. The through-line: first-order math (Jacobians) and second-order math (Hessians) aren't abstract curiosities — they're the literal control system underneath data ingestion, forward passes, backpropagation, and inference on real hardware.

Beyond the Single Derivative

Standard calculus answers a simple question: if I nudge x, how much does y change? Neural networks need a lot more than that.

Slide 2: Beyond the Single Derivative

Standard Calculus

One input, one output. A single derivative traces one curve — nudge x, read the corresponding change in y.

Machine Learning

Millions of inputs, millions of outputs. Nudging a single parameter sends ripples through billions of connections — a new control system is required to isolate specific cause-and-effect pathways.

The Jacobian: Isolating Sensitivity

A grid of sensitivity factors — how wiggling one input knob affects one output gauge, with every other variable frozen in place.

Slide 3: The Jacobian: Isolating Sensitivity
Think of a mixing board with three faders — Bass, Midrange, Treble — feeding three rooms of a house: Kitchen, Living Room, Patio. The Jacobian is the map of which fader moves which room's volume, and by how much, holding the other two faders still.

Assembling the Jacobian Matrix

Instead of recalculating complex equations from scratch, multiply simultaneous input changes by this matrix to predict every output change instantly.

Slide 4: Assembling the Jacobian Matrix
Input x1 (Bass)Input x2 (Mid)Input x3 (Treble)
Output y1 (Kitchen)∂y1/∂x1∂y1/∂x2∂y1/∂x3
Output y2 (Living Rm)∂y2/∂x1∂y2/∂x2∂y2/∂x3
Output y3 (Patio)∂y3/∂x1∂y3/∂x2∂y3/∂x3
Each row is one output's full sensitivity profile; each column is one input's reach across every output. Together the grid transforms complex, non-linear relationships into simple local linear scaling.

The Hessian: Measuring Acceleration and Curvature

If the Jacobian maps inputs to multiple outputs (velocity), the Hessian maps multiple inputs to a single output (acceleration).

Slide 5: The Hessian: Measuring Acceleration and Curvature
As I step across this landscape, is the ground flattening into a bowl, or warping into a saddle? That question — the shape of the terrain around a point, not just its slope — is exactly what the Hessian answers.

Decoding the Second Derivative

The Hessian isolates two critical dynamics: diminishing returns along a single axis, and how two separate inputs amplify or interfere with each other.

Slide 6: Decoding the Second Derivative

Self-Curvature: Direct Acceleration

Walking along one axis, the path itself gets steeper or flatter — the diagonal entries of the Hessian, measuring how a single input's own effect accelerates.

Cross-Interaction: Knob Coupling

Turning up Treble can make Bass more sensitive to distortion. The off-diagonal entries capture exactly this: how moving one input changes the sensitivity of another.

Synthesis: Navigating the Loss Valley

To minimize error, an ML system must find the valley floor — the Jacobian steers, the Hessian paces.

Slide 7: Synthesis: Navigating the Loss Valley

Gradient / Jacobian

Acts as the compass, directing the descent — which way to step to reduce the loss.

Hessian

Acts as the radar, preventing the system from overshooting the target or stepping off a cliff — how big a step is safe.

In practice. The Hessian's role here is the ideal (Newton's method), not what large models do. For a model with billions of weights the Hessian would have billions-squared entries, so standard training never computes it: SGD and Adam use the gradient alone. Adam's per-weight step sizes come from running averages of squared gradients, a cheap stand-in for curvature. A learning rate kept small enough, often with warm-up and decay, does the pacing that the Hessian would do in theory.

The Derivative Diagnostic

A structural comparison of first- and second-order mechanics in multi-variable environments.

Slide 8: The Derivative Diagnostic
Jacobian MatrixHessian Matrix
First derivativeSecond derivative
Slope / rate of changeCurvature / acceleration
Multiple inputs → multiple outputsMultiple inputs → single output
Steering / velocity vectorShape of the landscape (peaks, valleys)
Mapping motionOptimization (finding minimums)

Where They Are Used

Training, compression, inference and interpretability — the same derivatives, very different roles.

StageJacobianHessian
TrainingEvery step. Backpropagation is the chain rule applied layer by layer: it pushes the error gradient back through each layer's Jacobian as a vector–Jacobian product, never writing the full matrix out. Only approximated, by second-order optimizers such as K-FAC and Shampoo. Mainstream training (SGD, Adam) uses the gradient alone.
Compression—Quantization (GPTQ) and pruning (Optimal Brain Surgeon) use per-layer Hessians to choose which weights can change least harmfully. Done once, when the model is prepared.
InferenceNot used. Answering a prompt runs only the forward pass — no gradients, no stored activations — which is a large part of why serving costs far less than training.Not used.
InterpretabilitySaliency maps, integrated gradients and attribution patching measure which inputs or components drove an output.Influence functions (which training examples shaped a prediction) and studies of loss-landscape sharpness.
See also → Gradient Descent to watch the gradient steer a descent, and Interpretability for the analysis side.