Ben Recht spoke about optimization a few days ago at the Simons Institute. His talk was a highly entertaining tour de force through about a semester of convex optimization. You should go watch it. It’s easy to spend a semester of convex optimization on various guises of Gradient Descent alone. Simply pick one of the following variants and work through the specifics of the analysis: conjugate, accelerated, projected, conditional, mirrored, stochastic, coordinate, online. This is to name a few. You may also choose various pairs of attributes such as “accelerated coordinate” descent. Many triples are also valid such as “online stochastic mirror” descent. An expert unlike me would know exactly which triples are admissible. You get extra credit when you use “subgradient” instead of “gradient”. This is really only the beginning of Optimization and it might already seem confusing.
Thankfully, Ben kept things simple. There are indeed simple common patterns underlying many (if not all) variants of Gradient Descent. Ben did a fantastic job focusing on the basic template without getting bogged down in the details. He also made a high-level point that I strongly agree with. Much research in optimization focuses on convergence rates. That is, how many update steps do we need to minimize the function up to an epsilon error? Often fairly subtle differences in convergence rates are what motivates one particular variant of Gradient Descent over another. But there are properties of the algorithm that can affect the running time more powerfully than the exact convergence rate. A prime example is robustness. Basic Gradient Descent is robust to noise in several important ways. Accelerated Gradient Descent is much more brittle. Showing that it is even polynomial time (and under what assumptions) is a rather non-trivial exercise depending on the machine model. I’ve been saying for a while now that small improvements in running time don’t trump major losses in robustness. The situation in optimization is an important place where the trade-off between robustness and efficiency deserves attention. Generally speaking, the question “which algorithm is better” is rarely answered by looking at a single proxy such as “convergence rate”.
With that said, let me discuss Gradient Descent first. Then I will try to motivate why it makes sense to expect an accelerated method and how one might have discovered it. My exposition is not particularly close to Ben’s lecture. In particular, mistakes are mine. So, you should still go and watch that lecture. If you already know Gradient Descent, you can skip/skim the first section.
The Basic Gradient Descent Method
The goal is to minimize a convex function without any constraints. We’ll assume that is twice differentiable and strongly convex. This means that we can squeeze a parabola between the tangent plane at given by the gradient and the function itself. Formally, for some and all
At the same time, we don’t want the function to be “too convex”. So, we’ll require the condition:
This is a Lipschitz condition in disguise as it is equivalent to:
Let’s be a bit more concrete and consider from here on the important example of a convex function where is an positive definite matrix and is a vector. We have It’s an exercise to check that the above conditions boil down to the spectral condition: Clearly this problem has a unique minimizer given by In other words, if we can minimize this function, we’ll know how to solve linear systems.
Now, all that Gradient Descent does is to compute the sequence of points
for some choice of the step parameter Our hope is that for some positive ,
If this happens in every step, Gradient Descent converges exponentially fast towards the optimum. This is soberly called linear convergence in Optimization. Note that since the function is strongly convex, this also guarantees convergence of the objective value.
Choosing the right step size is an important task. If we choose it to small, our progress will be unnecessarily slow. If we choose it too large, we will overshoot. A calculation shows that if we put we get Remember that is condition number of the matrix. More generally, you could define the condition number of in this way. We have shown that
So the potential function (or Lyapunov function) drops by a factor of roughly in every step. This is the convergence rate of Gradient Descent.
Deriving the Accelerated Method through Chebyshev magic
What Nesterov showed in 1983 is that we can improve the convergence rate of Gradient Descent without using anything more than gradient information at various points of the domain. This is usually when people say something confusing about physics. It’s probably helpful to others, but physics metaphors are not my thing. Let me try a different approach. Let’s think about why what we were doing above wasn’t optimal. Consider the simple example Recall, the function is minimized at and the gradient satisfies Let’s start Gradient Descent at We can then check that
where and Why does this converge to ? The reason is that what Gradient Descent is computing is a degree polynomial approximation of the inverse function. To see this, recall that for all scalars
Since the eigenvalues of lie within this scalar function extends to the matrix case. Moreover, the approximation error when truncating the series at degree is In the matrix case this translates to error This is exactly the convergence rate of Gradient Descent that we determined earlier.
Why did we go through this exercise? The reason is that now we see that to improve on Gradient Descent it suffices to find a better low-degree approximation to the scalar function What we’ll be able to show is that we can save a square root in the degree while achieving the same error! Anybody familiar with polynomial approximation should have one guess when hearing “quadratic savings in the degree”:
Let’s be clear. Our goal is to find a degree polynomial which minimizes the residual
Put differently we are looking for a polynomial of the form What we want is that the polynomial is as small as possible on the location of the eigenvalues of which lie in the interval At the same time, the polynomial must satisfy This is exactly the property that Chebyshev polynomials achieve with the least possible degree! Quantitatively, we have the following lemma that I learned from Rocco Servedio. As Rocco said in that context:
There’s only one bullet in the gun. It’s called the Chebyshev polynomial.
Lemma. There is a polynomial of degree such that and for all
The lemma implies that we get a quadratic savings in degree. Since we can build from gradient information alone, we now know how to improve the convergence rate of Gradient Descent. It gets better. The Chebyshev polynomials satisfy a simple recursive definition that defines the -th degree polynomial in terms of the previous two polynomials. This means that accelerated gradient descent only needs the previous two gradients with suitable coefficients:
Figuring out the best possible coefficients leads to the above convergence rate. What’s amazing is that this trick works for any convex function satisfying our assumptions and not just the special case we dealt with here! In fact, this is what Nesterov showed. I should say that the interpretation in terms of polynomial approximations is lost (as far as I know).The polynomial approximation method I described was known much earlier in the context of eigenvalue computations. This is another fascinating connection I’ll describe in the next section.
Let me add that it can be shown that this convergence rate is optimal for any first-order (gradient only method) by taking to be the Laplacian of a path of length . This is true even in our special case. It’s optimal though in a weak sense: There is a function and a starting point such that the method needs this many steps. I would be interesting to understand how robust this lower bound is.
The Connection to Eigenvalue Methods
Our discussion above was essentially about eigenvalue location. What does polynomial approximation have to do with eigenvalues? Recall, that the most basic way of computing the top eigenvalue of a matrix is the Power Method. The Power Method corresponds to a very basic polynomial, namely This polynomial has the effect that it maps to and moves every number closer to at the rate Hence, if the top eigenvalue is and the second eigenvalue is then we need about iterations to approximately find Using exactly the same Chebyshev idea, we can improve this to iterations! This method is often called Lanczos method. So, we have the precise correspondence:
The Power Method is to Lanczos as Basic Gradient Descent is to Accelerated Gradient Descent!
I find this quite amazing. In a future post I will return to the Power Method in greater detail in the context of noise-tolerant eigenvalue computation.
Why don’t we teach Gradient Descent in theory classes?
I’m embarrassed to admit that the first time I saw Gradient Descent in full generality was in grad school. I had seen the Perceptron algorithm in my last year as an undergraduate. At the time, I was unaware that like so many algorithms it is just a special case of Gradient Descent. Looking at the typical undergraduate curriculum, it seems like we spend a whole lot of time iterating through dozens of combinatorial algorithms for various problems. So much so that we often don’t get around to teaching something as fundamental as Gradient Descent. It wouldn’t take more than two lectures to teach the contents of this blog post (or one lecture if you’re Ben Recht). Knowing Gradient Descent seems quite powerful. It’s not only simple and elegant. It’s also the algorithmic paradigm behind many algorithms in machine learning, optimization and numerical computation. Teaching it to undergraduates seems like a must. I just now realize that I haven’t been an undergraduate in a while. Time flies. So perhaps this is already happening.
- Trefethen-Bau, “Numerical Linear Algebra”. My favorite book on the topic of classical numerical methods by far.
- Ben Recht’s lecture notes here and here, his Simons talk.
- Sebastien Bubeck’s course notes are great!
- For lack of a better reference, the lemma I stated above appears as Claim 5.4 in this paper that I may have co-authored.