Lukas' Notes

machine-learning optimisation calculus

Definition

Gradient Descent

Gradient descent is a first-order gradient-based optimisation algorithm for minimising a differentiable objective . Starting from an initial parameter vector , it repeatedly moves in the negative gradient direction:

where is the learning rate. Since points in the direction of steepest local increase, the vector points in the direction of steepest local decrease. In machine learning, is usually a loss function over model parameters.

Principle

The update is forced by the first-order local model of the objective. Near , differentiability gives

To make this approximation smaller, choose with negative inner product against the gradient. The steepest such direction under the Euclidean norm is the negative gradient direction. The learning rate then decides how far to trust that local information.

A useful equivalent view is that gradient descent chooses the step that minimises a linear approximation of plus a quadratic penalty for moving too far:

Thus the algorithm is local: it trusts the current slope, but only within a radius controlled by .

Algorithm

Gradient descent

Given a differentiable objective , an initial point , and learning rates :

  1. compute the gradient ;
  2. take the step ;
  3. stop when the gradient, parameter change, or objective decrease is sufficiently small.

For empirical risk minimisation, full gradient descent computes the gradient using the whole training set at every step. stochastic gradient descent replaces this with a noisy gradient estimate from one example or a mini-batch.

Step size

The learning rate is the main control parameter.

  • If is too small, descent is stable but slow.
  • If is too large, the method can overshoot, oscillate, or diverge.
  • If decreases over time, early steps can move quickly while later steps refine the solution.

For an -smooth objective, the standard descent bound is

So any fixed guarantees a decrease whenever . The formula expresses the basic trade-off: the step should be large enough to use the slope, but not so large that the local linear picture becomes false.

Guarantees and limitations

For a convex function, every local minimum is global, so gradient descent can converge to a global minimiser under suitable smoothness and step-size assumptions. For a non-convex objective, the same update may converge to a local minimum, a saddle point, or a flat region.

Gradient descent also depends on scaling. If different coordinates of have very different curvature, the method may zig-zag through narrow valleys. Adaptive methods and second-order methods modify the step geometry; plain gradient descent uses the same Euclidean geometry in every coordinate.