I don’t know of any user of iterative algorithms who has not complained one day about their convergence speed. Whether the data are too big, the processors not fast or numerous enough, waiting for an algorithm to converge unfortunately remains a core practical component of computer science and applied mathematics. This was already a concern long before computers were invented (and most of the techniques I will describe date back to the early 19th century): imagine you are doing all the operations (multiplications, additions, divisions) by hand, wouldn’t you want some cheap way to accelerate your algorithm (and here literally reduce your pain)?
Acceleration is a key concept in numerical analysis and can be carried through in two main ways. The first way is to modify some steps of the algorithm (such as Nesterov acceleration for gradient descent, or Chebyshev / Jacobi acceleration for linear recursions). This requires a good knowledge of the inner structure of the underlying algorithm. A second way is to totally ignore the specifics of the algorithm, and see the acceleration problem as trying to find good “combinations” of the observed iterates that converge faster.
In this blog post, I thus consider a sequence of iterates (xk)k≥0 in Rd obtained from an iterative algorithm xk+1=T(xk), which will typically be an optimization algorithm. The main question I will address is: Can we do better than outputting the last iterate?
This has a long history in numerical analysis, where many techniques have been developed for uni-dimensional sequences. Acceleration techniques vary according to the type of convergence of the original sequence (quadratic, linear, sublinear), the amount of knowledge about the asymptotic behavior, and the possibility of extensions to high-dimensional and noisy problems.
Acceleration techniques are often based on an explicit or implicit modelling of the sequence xk, either through a model of the function T:Rd→Rd (the iteration of the algorithm) or through an asymptotic expansion of xk. In this post, I will focus on linearly convergent sequences, that is, sequences xk converging to some x∗ at an exponential rate. As we will see, this will done through modelling xk as an autoregressive process.
I will first start from the simplest scheme, the Aitken’s Δ2 process from 1926 [1], then look at higher order generalizations still in one dimension, and finally to the general vector case. We will then apply all that to gradient descent.
Aitken’s Δ2 process
This is the simplest of all techniques and the source of all others in this post. We try to model xk∈R as first-order auto-regressive sequence, that is, xk+1=axk+b, for a,b∈R. The method works by (a) estimating a and b from a sequence of few consecutive (here three) iterates, and (b) extrapolating by computing the limit xacc of the estimated model. Given that we fit the model to consecutive iterates (xk,xk+1,xk+2), the model (a,b) will also depend on k, as well as its limit xacc. In order to avoid having too many k’s in my notations, I will drop the dependence in k of the model parameters.
In this situation, the model recursion has a limit when a=1, and the limit is xacc=1−ab. In order to fit the two parameters, we need two equations, which can be obtained by considering two consecutive evaluations of the recursions (which require three iterates). That is, we consider the linear system in (a,b):
{axk+baxk+1+b=xk+1=xk+2
which can be solved in a variety of ways. All of them are equivalent, but naturally lead to different extensions.
Solving by elimination. We can eliminate b by subtracting the two equations, leading to
which we denote xk(1), to highlight its dependence on k. Note that to compute xk(1), we need access to the three iterates (xk,xk+1,xk+2), and thus, when comparing the original sequence to the extrapolated one, we will compare xk and xk−2(1).
Asymptotic auto-regressive model. A key feature of the acceleration techniques that I describe in this post is that although they implicitly or explicitly model sequence with auto-regressive processes, the models do not need to be correct, that is, they also work if the autoregressive recursion is true only asymptotically, for example xk–x∗xk+1−x∗ converging to a constant a∈[−1,1). Then we also get some acceleration, which can be quantified (see the end of the post for details), and for which we present a classical example below.
This formula can be proved by expanding the derivative x↦1+x21 of x↦arctanx as a power series and then integrating it. We can check that
xk–x∗xk+1−x∗=–1+k1+o(k1),
and as detailed at the end of the post, we should expect the error to go from 1/k to 1/k3. Below, we show the first 10 iterates of the two sequences, with the correct significant digits in bold.
We see that the extrapolated sequence converges much faster. This is confirmed in the convergence plot below:
Δ2 method on the Leibniz series. Notice the improvement from O(1/k) to O(1/k3).
Higher-order one-dimensional extensions
The Aitken’s Δ2 process relies on fitting a first-order auto-regressive model, or on assuming that xk+1–x∗–a(xk–x∗)→0 asymptotically. This can be extended to m-th order constant recursions. This corresponds to modelling xk as the sum of m exponentials.
which has m+1 parameters. We thus need m+1 equations, that is we consider the recursion for k,k+1,…,k+m, which requires the knowledge of the 2m+1 iterates xk,xk+1,…,xk+2m. This leads to the m+1 equations:
for j∈{0,…,m}. This is a system with m+1 unknowns and m+1 equations, from which we could get all aj’s and b, and then the model limit as the extrapolated sequence xk(m)=1–a0–a1–⋯–am−1b.
This linear system can be solved in a variety of ways. At the end of the blog post, I show how it can be solved using determinants of Hankel-like matrices, often referred to as the Shanks transformation, which then leads to an iterative algorithm dating back from Wynn [2], which is called the ε-algorithm. In order to smooth our way to the vector case extension, I will present it in a slightly non-standard way. See [3] for detailed surveys on acceleration and extrapolation, and their rich history.
Instead of learning the model parameters to estimate xk+m from the past iterates, we focus directly on the prediction of the limit xacc by looking for real numbers c0,…,cm such that for all k,
i=0∑mci(xk+i–xacc)=0,
with the arbitrary normalization ∑i=0mci=1. The ci’s can be obtained from the ai’s and b as (c0,c1,…,cm−1,cm)∝(a0,a1,…,am−1,−1). We then have
xacc=i=0∑mcixk+i.
Again, the parameters ci’s depend on k, but we omit this dependence.
In order to estimate the m+1 parameters c0,…,cm, we subtract two versions of the equality for k and k+1, leading to
i=0∑mci(xk+1+i–xk+i)=0.
Defining the matrix U∈Rm×(m+1) by
Uji=xk+1+i+j–xk+i+j,
for i∈{0,…,m} and j∈{0,…,m−1}, we have
Uc=0.
Together with the constraint 1m+1⊤c=1, this leads to the correct number of equations to estimate c, from 2m+1 iterates xk,…,xk+2m. The extrapolated iterate xk(m) is then
xk(m)=xacc=i=0∑mcixk+i.
Note that the extrapolation is exact when the sequence is exactly following a m-th order recursion. See an example of application on the Leibniz formula below.
Higher-order acceleration through the Shanks transformation for the Leibniz formula. Acceleration is possible only up to machine precision.
Extension to vectors
We now consider accelerating vector sequences xk∈Rd. There are multiple approaches to extend acceleration from real numbers to vectors, as presented in [4, 5]. The simplest way is to apply high-order extrapolation to all coordinates separately; this depends however a lot on the chosen basis, requires too many linear systems to solve, and performs worse (see examples below for gradient descent). An alternative is to consider a specific notion of inversion for vectors called Samelson inversion, which then leads to the so-called vectorε-algorithm [[10](http://Acceleration techniques for iterated vector and matrix problems)]. We now present a vector extension which exists under many names: the Eddy-Mesina method [6,7], reduced rank extrapolation [4, 11, 12], or Anderson acceleration [8].
We want to model the sequence xk∈Rd as
xk+1=Axk+b,
where A∈Rd×d and b∈Rd. By a simple variable / equation counting arguments, there are d2+d parameters, and we thus need d+1 equations in Rd, and thus d+2 consecutive iterates, to estimate A and b.
In order to use only m+2 iterates, with m much less than d, we will focus directly on the extrapolation equation
xacc=c0xk+c1xk+1+⋯+cmxk+m,
with the constraint that c0+c1+⋯+cm=1. Therefore, we will not try to explicitly fit the model parameters A and b.
A sufficient condition for good extrapolation weights is that the extrapolated version is close for two consecutive k’s, that is
Note that while the weights c0,…,cm sum to one, they may be negative, that is, the extrapolated sequence is not always a convex combination (hence the name extrapolation). Moreover, note that unless m is large enough, the optimal Uc is in general not equal to zero (it is when modelling real sequences, see below).
For m=1, the solution is particularly simple, as we need to minimize
The acute reader can check that when d=1, we recover Aitken’s formula. See an example in two dimensions below.
Anderson acceleration in two dimensions. The sequence is following an auto-regressive process with a symmetric A with eigenvalues in (−1,1). Anderson acceleration cancels the oscillation due to the eigenvalue with largest magnitude.
Recovering one-dimensional sequence acceleration. Given a real sequence yk∈R, we can define the vector xk in Rm as
xk=ykyk+1⋮yk+m−1.
One can then check that the matrix U defined for this vector sequence is exactly the same as the matrix U defined earlier for the real valued sequence. The optimal ∥Uc∥ is then equal to zero (which is not the case in general).
When is it exact? The derivation I followed is only intuitive, and as for the other acceleration mechanisms, a natural question is: when is it exact? We will consider linear recursions.
Analysis for linear recursions. Assuming that xk+1=Axk+b is exact for all k≥0, then xk–x∗=Ak(x0–x∗), and thus, following [13],
The method will be exact when one can find a degree m polynomial so that Pm(A)(xk–x∗)=0, and a sufficient condition is that Pm(A)=0, which is only possible if A had only m distinct eigenvalues. This is exactly minimal polynomial extrapolation [9]. Another situation is when m=d (like for the special case of real sequences above).
Otherwise, the method will be inexact, but the method can find a good polynomial Pm, and the error is less than the infimum of ∥Pm(A)(xk–x∗)∥ over all polynomial of degree m such that Pm(1)=1. Assuming that the matrix A is symmetric and with all eigenvalues between −ρ and ρ (which will be the case for the gradient method below), then the error is less than the infimum of supσ∈[−ρ,ρ]∣Pm(σ)∣, which is attained for the Chebyshev polynomial (see a previous post). The improvement in terms of convergence is similar to Chebyshev acceleration, but (a) without the need to know ρ in advance (the method is totally adaptive), and (b) with a provable robustness when the iterates deviate from following an autoregressive process (see [13] for details).
Going beyond linear recursions. As presented, Anderson acceleration does not lead to stable acceleration (see the experiment below for gradient descent). The main reason is that when iterates deviate from an autoregressive process, or when the recursion is naturally noisy, the estimation of the parameters c is unstable, in particular because the matrix U⊤U which has to be inverted is severely ill-conditioned [14]. In a joint work with Damien Scieur and Alexandre d’Aspremont, we considered regularizing the estimation of c by penalizing its ℓ2-norm. We thus minimize ∥Uc∥22+λ∥c∥22 such that c⊤1m+1=1, whose solution is
This simple modification leads to theoretical guarantees for non-linear recursions, and I will refer to it as regularized non-linear acceleration (RNA, see [13] for details; the “non-linearity” comes from the non-linear dependence of c on the iterates).
Application to gradient descent
We can apply RNA to the recursion,
xk+1=xk–γ∇f(xk),
where f:Rd→Rd is a differentiable function, and γ a step-size. In the plot below, we consider accelerating gradient descent with m-th order RNA, with m=8. We compare this acceleration with applying RNA to each variable separately (“RNA-univ.”), and to the unregularized version (“Anderson”). We can see the benefits of our simple extrapolation steps, and in particular the instability of unregularized acceleration.
Gradient descent on a regularized logistic regression problem, with 1000 observations in dimension 100. We compare regular gradient descent, to plain Anderson acceleration (with no regularization), RNA [13] applied to each variable separately, and RNA. All accelerations are with order m=8.
In order to obtain stronger benefits from non-linear acceleration, several extensions are considered in [13]; in particular line search to find the good regularization parameter λ is quite useful. Another interesting extension is the online version of the algorithm [16, section 2.5], where the extrapolated sequence is used directly within the acceleration procedure, and not as a separate sequence with no interaction with the original gradient method: this corresponds to using RNA to accelerate iterates coming from RNA!
Moreover, while the simplest theoretical guarantees come for deterministic convex optimization problems and gradient descent, RNA can be extended to stochastic algorithms [15] and to non-convex optimization problems such as the ones encountered in deep learning [16].
Conclusion
In this post, I described acceleration techniques that combine iterates of an existing algorithm, without the need to understand finely the inner structure of the original algorithm. They come at little extra-cost and can provide strong benefits.
This month’s post was dedicated to algorithms which converge linearly, that is, the iterates are asymptotically equivalent to sums of exponentials. Next month, I will consider situations where the convergence is sublinear, where Richardson extrapolation excels.
Acknowledgements. This post is based on joint work with Damien Scieur and Alexandre d’Aspremont, and in particular on their presentation slides. I would also like to thank them for proofreading this blog post and making good clarifying suggestions.
References
[1] Alexander Aitken, On Bernoulli’s numerical solution of algebraic equations, Proceedings of the Royal Society of Edinburgh, 46:289–305, 1926.
[2] Peter Wynn. On a device for computing the em(Sn) transformation. Mathematical Tables and Other Aids to Computation, 91-96, 1956.
[3] Claude Brezinski. Accélération de la convergence en analyse numérique. Lecture notes in mathematics, Springer (584), 1977.
[4] David A. Smith, William F. Ford, Avram Sidi. Extrapolation methods for vector sequences. SIAM review, 29(2):199-233, 1987
[5] Allan J. Macleod. Acceleration of vector sequences by multi‐dimensional Δ2 methods. Communications in Applied Numerical Methods, 2(4):385-392, 1986.
[6] Marián Mešina. Convergence acceleration for the iterative solution of the equations X= AX+ f. Computer Methods in Applied Mechanics and Engineering, 10(2), 1977.
[7] Robert P. Eddy. Extrapolating to the limit of a vector sequence. Information linkage between applied mathematics and industry, 387-396, 1979.
[8] Homer F. Walker, Peng Ni. Anderson acceleration for fixed-point iterations. SIAM Journal on Numerical Analysis, 49(4):1715-1735, 2011.
[9] Sidi, Avram, William F. Ford, and David A. Smith. Acceleration of convergence of vector sequences. SIAM Journal on Numerical Analysis 23(1):178-196, 1986.
[10] Peter Wynn. Acceleration techniques for iterated vector and matrix problems. Mathematics of Computation, 16(79), 301-322, 1962.
[11] Stan Cabay, L. W. Jackson. A polynomial extrapolation method for finding limits and antilimits of vector sequences. SIAM Journal on Numerical Analysis, 13(5), 734-752, 1976.
[12] Stig Skelboe. Computation of the periodic steady-state response of nonlinear networks by extrapolation methods. IEEE Transactions on Circuits and Systems, 27(3), 161-175, 1980.
[13] Damien Scieur, Alexandre d’Aspremont, Francis Bach. Regularized Nonlinear Acceleration. Mathematical Programming, 2018.
[14] Evgenij E. Tyrtyshnikov. How bad are Hankel matrices? Numerische Mathematik, 67(2):261-269, 1994.
[15] Damien Scieur, Alexandre d’Aspremont, Francis Bach. Nonlinear Acceleration of Stochastic Algorithms. Advances in Neural Information Processing Systems (NIPS), 2017.
[16] Damien Scieur, Edouard Oyallon, Alexandre d’Aspremont, Francis Bach. Nonlinear Acceleration of Deep Neural Networks. Technical report, arXiv-1805.09639, 2018.
[17] Claude Brezinski and Michela Redivo-Zaglia, Extrapolation Methods: Theory and Practice, Elsevier, 2013.
Asymptotic analysis for Aitken’s Δ2 process
In one dimension, we do not need the auto-regressive model to be exact, and an asymptotic analysis is possible. The asymptotic condition corresponds to xk–x∗xk+1−x∗ converging to a constant a∈[−1,1). More precisely if
xk–x∗xk+1−x∗=a+εk+1,
with εk tending to zero, then we can estimate a through the Aitkens Δ2 method [1] as,
with the constraint c0+c1=1, that is, c0=1−a−a and c1=1−a1. We can then write x∗=c0xk+c1xk+1, and we have the linear system in (c0,c1,x∗):
The formula extends to order m (see below) and is often called the Shanks transformation; it is cumbersome and not easy to use. However, the coefficients can be computed recursively (which is to be expected for a Hankel matrix, but rather tricky to derive), through Wynn’s ε-algorithm. See [3] for a survey on acceleration and extrapolation.
Higher-order recursion. We consider the model, for m≥1,
c0(xk–x∗)+c1(xk+1–x∗)+⋯+cm(xk+m–x∗)=0,
with the normalization c0+c1+⋯+cm=1. We can then extract x∗ as
x∗=c0xk+c1xk+1+⋯+cmxk+m.
In order to provide the extra m equations, we take first order differences and get