Gradient descent with constant learning rate for a quadratic function of multiple variables

From Calculus

Setup

This page includes a detailed analysis of gradient descent with constant learning rate for a quadratic function of multiple variables. It builds on the analysis at the page gradient descent with constant learning rate for a quadratic function of one variable.

Function

The function we are interested is a function of the form:

where is a symmetric positive-definite matrix with entries and is the column vector with entries . For part of this page, we will generalize somewhat to the case that is a symmetric positive-semidefinite matrix.

Note that we impose the condition of symmetry because we could replace the matrix with the symmetric matrix without changing the functional form. The positive-definite or positive-semidefinite condition is to guarantee that the function has the right sort of convexity. In the positive-definite case, we are guaranteed that there is a unique point of local minimum that is also the point of absolute minimum. The positive-semidefinite case is somewhat more complicated: we could either have no minimum, or we could have an affine space worth of points at which the function has a local and absolute minimum.

Learning algorithm

Suppose is a positive real number. The gradient descent with constant learning rate is an iterative algorithm that aims to find a (the) point of local minimum for . The algorithm starts with a guess and updates according to the rule:

Convergence properties based on the learning rate

We will carry out our analysis of eigenvalues in terms of the Hessian matrix . If we were instead dealing with the eigenvalues of , we would have to double them to get the eigenvalues of . Since the bounds on the learning rate are described as reciprocals of the eigenvalues, we would therefore obtain additional factors of 2 in the denominators, or equivalently, we would remove the factor of 2 from the numerators.

Note that in the case , we have and in the notation below.

Summary for a symmetric positive-definite matrix

Since is a symmetric matrix, its singular values and eigenvalues coincide. Explicitly, we will denote by the largest eigenvalue (and hence also the largest singular value) and by the smallest eigenvalue (and hence also the smallest singular value). The condition number of the matrix is the quotient:

The minimum possible value of is 1, and this occurs when is a scalar matrix. In general, the larger the value of , the worse the performance of gradient descent with constant learning rate. The following are true:

Value of Conclusion about the convergence of gradient descent with constant learning rate (assume that we do not start at the point of local minimum) Convergence rate
It does not converge
It converges if we start at a point that is in an appropriate affine subspace, but does not converge for most starting points.
It converges Linear convergence, and the worst-case convergence rate is

Detailed analysis after transforming the problem to a setting where the coordinates are simple

Suppose the eigenvalues of are:

Via a coordinate change of the domain using an orthogonal matrix, we can transform into a diagonal matrix with positive real entries. These entries are halves of the eigenvalues of . Via a translation, we can get rid of the linear term, and finally, we can translate the function value by a constant (this does not affect the point of local minimum, though it affects the minimum value). We can therefore obtain the following simplified functional form:

The unique local and absolute minimum is at the zero vector.

Note that even though we know that our matrix can be transformed this way, we do not in general know how to bring it in this form -- if we did, we could directly solve the problem without using gradient descent (this is an alternate solution method). However, even though we may not know the explicit diagonalized form of the function, the fact that it does have such a form gives us information about how the gradient descent process converges.

Starting with a point:

we obtain that the gradient vector at the point is:

Therefore, after one step of coordinate descent, the new coordinates are:

In other words, what we see is that the gradient descent proceeds independently in each coordinate in the way that we would have gradient descent with constant learning rate for a quadratic function of one variable. In the special case that a particular coordinate is already zero, it stays zero.

In order to guarantee convergence to the point of local minimum (the zero vector) we need to make sure that the learning rate satisfies the condition of being less than for each where the initial value of is nonzero. Moreover, for the direction, the convergence rate is , and if that value is 1 or more (that happens if ) then we do not obtain convergence to 0 in that coordinate.

Worst-case convergence rate across all coordinates as a function of learning rate

The worst-case convergence rate (assuming all coordinates zero for our starting point) is therefore obtained as follows. Consider the expression:

This is taking the maximum of the convergence rates in all coordinates.

If this quantity is 1 or more, then the worst-case situation is no convergence in at least one coordinate. If the quantity is less than 1, then it equals the worst-case convergence rate (or, the convergence rate in the slowest coordinate).

Let us look more closely at this expression. Consider the continuous function:

It can be verified that this is convex in as well as . Therefore, for a given , the maximum is attained at the extreme values of , i.e.:

We further need to cap this value at 1, i.e., if the maximum value above is greater than 1, then we do not have convergence in the worst case. We therefore obtain the following piecewise functional form for the worst-case convergence rate:

Optimization of learning rate to get the best upper bound on the worst-case convergence rate on the domain side

Unless there is no choice of learning rate that guarantees immediate or even finite-step convergence. Different learning rates work better from different starting points. If we only know and , then the value of that makes the worst-case convergence as fast as possible is:

This can be computed by minimizing over the expression , described using a piecewise description above.

The corresponding upper bound on convergence rate is (note that smaller upper bounds indicate faster convergence):

In terms of the condition number , this upper bound on convergence rate can be expressed as:

Note that this checks out in the case : in this case, is a scalar matrix, so all the eigenvalues are equal, and we can choose and converge in one step. The case is a special case of .

Optimization of learning rate to get the best upper bound on the worst-case convergence on the function value side

Fill this in later