§ Gradients · Interactive Graduate Primer
Tensor by Tensor · expanded

The Hessian

Learn how changing several inputs changes one output. Begin with partial derivatives, then explore gradient descent, backpropagation, and optimizers. The later sections include proofs and deeper mathematical detail.
A first reading path

Start with sections 2–4, then section 7. Return to the directional-derivative proof after you understand a gradient-descent update. An optimizer is a rule for updating the model’s adjustable numbers.

For L(a, b) = a² + 2b², the gradient at (1, 2) is [2, 8]. The first entry measures change along a while b stays fixed. The second measures change along b while a stays fixed. With step size 0.1, subtract [0.2, 0.8] to reach (0.8, 1.2). The loss falls from 9 to 3.52.

Check: why subtract the gradient?

The gradient points toward the steepest local increase under the usual Euclidean length measure. Subtracting it moves toward a local decrease when the step is small enough. A large step can still overshoot and increase the loss.

9. The Hessian and Conditioning

Introduction

Two directions can have different curvature even at the same point. A quadratic loss with Hessian entries 2 and 8 bends four times more strongly in one direction, affecting stability and convergence.

Learning goal

Read a Hessian matrix, classify critical points, measure conditioning, and explain one Newton update.

Before you start

Gradients, second derivatives, matrices, eigenvalues as directional scaling, and quadratic functions.

Lesson plan

  1. Differentiate the gradient to form the matrix of second partial derivatives.
  2. Use eigenvalue signs to classify minima, maxima, and saddle points.
  3. Connect unequal curvature to conditioning, learning-rate limits, and Newton's method.

Picture two curvatures. A bowl can be steep left-to-right and shallow front-to-back. One learning rate then moves too aggressively on one axis and too slowly on the other. The Hessian records this local curvature interaction.

The second-order structure of $L$ is captured by

$$H_{ij}(\theta) = \partial_i\partial_j L(\theta),\qquad L(\theta+\Delta) = L(\theta)+\langle\nabla L,\Delta\rangle+\tfrac{1}{2}\Delta^\top H\,\Delta + o(\|\Delta\|^2).$$

Classifying critical points ($\nabla L=0$)

Spectrum of $H$Local behaviour
All $\lambda_i>0$Strict local minimum
All $\lambda_i<0$Strict local maximum
Mixed signsSaddle point
Some $\lambda_i=0$, rest same signDegenerate

Newton's method

$$\theta_{k+1} = \theta_k - H(\theta_k)^{-1}\,\nabla L(\theta_k).$$

Rescales each direction by its curvature; quadratic convergence near a minimum. Cost $O(n^3)$ motivates quasi-Newton (L-BFGS) and second-order preconditioners (Shampoo, Muon).