2.2 Unconstrained Methods
Line search, steepest descent, momentum, and SGD.
These notes walk through the lecture slides. The original deck is unchanged; use (slides) on the course hub if you want that PDF.
The figures follow Deisenroth, Faisal, and Ong, Mathematics for Machine Learning.
1. Line search
Draw , predict , score the mismatch with , take the gradient, and step against it.

Almost every method in this note is
- Pick a direction .
- Pick a step (learning rate) that lowers in .
- Take the step.
A direction is a descent direction when . Steepest descent (gradient descent) uses .

2. Why steepest descent zigzags
Steepest descent can be slow. The step length matters, and the asymptotic rate is worse than Newton-type methods. On a long thin valley the problem is poorly conditioned: points into the walls, almost orthogonal to the short path to the min. Exact line search still hops.

See it on a quadratic. Let
with symmetric positive definite. Diagonalize . In coordinates , minimizing is the same as minimizing . In two dimensions the contours are ellipses
The axis ratio is the condition number of (largest over smallest eigenvalue). Large condition number: a long thin valley, tiny progress.

3. Momentum
Remember the last step and refuse to turn on a dime (Rumelhart et al., 1986):
with . A heavy ball in a valley: oscillations damp, progress along the floor improves. Noisy gradients benefit because the memory averages them. Stochastic approximations of are the usual case, not a special case.
4. SGD and mini-batches
If , batch gradient descent uses the full sum. That is expensive when is large and there is no closed form for .
SGD uses one term (or a random subset) as a noisy stand-in for . With a decaying step size, SGD converges almost surely to a local min under mild assumptions.
Mini-batch gradient descent sits in between: a random subset, not one row and not all . Still an unbiased estimate of the true gradient. Cheaper than batch, less noisy than one-row SGD.

Why accept an approximate gradient?
| Mini-batch | What you buy | What you pay |
|---|---|---|
| Large | Accurate , stable steps, fast matrix kernels | Each step is expensive; easy to sit in a sharp hole |
| Small | Cheap steps; noise can leave a bad local min; often enough for generalization | Higher variance in the updates |
Memory and wall-clock are the practical reasons. Mini-batch size is a sample size for an empirical mean.
5. Practice
-
What does a large condition number do to steepest descent?
-
Write the descent test in words. Why does pass it whenever you are not already at a critical point?
-
Name one reason to prefer a small mini-batch over a large one, and one reason for the opposite.