Communication Efficient Distributed Optimization using an Approximate Newton-type Method
Ohad Shamir, Nathan Srebro, Tong Zhang
Introduction
We are particularly interested in a stochastic optimization (learning) setting, where the ultimate goal is to minimize some stochastic (population) objective (e.g. expected loss or generalization error)
and each of the machines has access to i.i.d. samples from the source distribution , for a total of independent samples evenly and randomly distributed among the machines. Each machine can construct a local empirical (sample) estimate of :
and the overall empirical objective is then:
We can then use the empirical risk minimizer (ERM)
as an approximate minimizer of . Since our interest lies mostly with this stochastic optimization setting, we will denote even when the optimization objective is not an empirical approximation to a stochastic objective.
A straight-forward single-iteration approach is for each machine to optimize its own local objective, obtaining
This approach, which we refer to as “one-shot parameter averaging”, was recently considered in Zinkevich et al. (2010) and further analyzed by Zhang et al. (2013). The latter also proposed a bias-corrected improvement which perturbs each using the optimum on a bootstrap sample. This approach gives only an approximate minimizer of with some finite suboptimality, rather then allowing us converge to (i.e. to obtain solutions with any desired suboptimality ). Although approximate solutions are often sufficient for stochastic optimization, we prove in Section 2 that the one-shot solution can be much worse in terms of minimizing the population objective , compared to the actual empirical minimizer . It does not seem possible to address this suboptimality by more clever averaging, and instead additional rounds of communications appear necessary.
Gradient Descent
One possible multi-round approach to distributed optimization is a distributed implementation of gradient descent: at each iteration each machine calculates at the current iterate , and then these are averaged to obtain the overall gradient , and a gradient step is taken. As the iterates are then standard gradient descent iterates, the number of iterations, and so also number of communication rounds, is linear in the conditioning of the problem – or, if accelerated gradient descent is used, proportional to the square root of the condition number: If is -smooth and -strongly convex, then
iterations are needed to attain an -suboptimal solution. The polynomial dependence on the condition number may be disappointing, as in many problems the parameter of strong convexity might be very small. E.g., when strong convexity arises from regularization, as in many stochastic optimization problems, decreases with the overall sample size , and is typically at most (Sridharan et al. 2008; Shalev-Shwartz et al. 2009; and see also Section 4.3 below). The number of iterations / communication rounds needed for distributed accelerated gradient descent then scales as , i.e. increases polynomially with the sample size.
Instead of gradient descent, one may also consider more sophisticated methods which utilize gradient information, such as quasi-Newton methods. For example, a distributed implementation using L-BFGS has been proposed in Agarwal et al. (2011). However, no guarantee better then (8) can be ensured for gradient-based methods Nemirovsky and Yudin (1983), and we thus may still get a polynomial dependence on the sample size.
ADMM and other approaches
Another popular approach is distributed alternating direction method of multipliers (ADMM, e.g. Boyd et al. 2011), where the machines alternate between computing shared dual variables in a distributed manner, and solving augmented Lagrangian problems with respect to their local data. However, the convergence of ADMM can be slow. Although recent works proved a linear convergence rate under favorable assumptions Deng and Yin (2012); Hong and Luo (2012), we are not aware of any analysis where the number of iterations / communication rounds doesn’t scale strongly with the condition number, and hence the sample size, for learning applications. A similar dependence occurs with other recently-proposed algorithms for distributed optimization (e.g. Yang, 2013; Mahajan et al., 2013; Dekel et al., 2012; Cotter et al., 2011; Duchi et al., 2012). We also mention that our framework is orthogonal to much recent work on distributed coordinate descent methods (e.g. Recht et al., 2011; Richtárik and Takác, 2013), which assume the data is split feature-wise rather than instance-wise.
Our Method
The method we propose can be viewed as an approximate Newton-like method, where at each iteration, instead of a gradient step, we take a step appropriate for the geometry of the problem, as estimated on each machine separately. In particular, for quadratic objectives, the method can be seen as taking approximate Newton steps, where each machine implicitly uses its local Hessian (although no Hessians are explicitly computed!). Unlike ADMM, our method can take advantage of the fact that for machine learning applications, the sub-problems are usually similar: . We refer to our method as DANE—Distributed Approximate NEwton.
Notation and Definitions
For vectors, is always the Euclidean norm, and for matrices is the spectral norm. We use to indicate that the eigenvalues of are bounded between and . We say that a twice differentiableAll our results hold also for weaker definitions of smoothness and strong convexity which do not require twice differentiability. function is -strongly convex or -smooth, iff for all , its Hessian is bounded from below by (i.e. ), or above by (i.e. ) respectively.
Stochastic Optimization and One-shot Parameter Averaging
In a stochastic optimization setting, where the true objective is the population objective , there is a limit to the accuracy with which we can minimize given only samples, even using the exact empirical minimizer . It is thus reasonable to compare the suboptimality of when using the exact to what can be attained using distributed optimization with limited communication.
where is the population minimizer and the expectation is with respect to the random sample of size . One might then ask whether a suboptimality of can be also be achieved using a few, perhaps only one, round of communication. This is different from seeking a distributed optimization method that achieves any arbitrarily small empirical suboptimality, and thus converges to , but might be sufficient in terms of stochastic optimization.
For one-shot parameter averaging, Zhang et al. (2013, Corollary 2) recently showed that for -strongly convex objectives, and when moments of the first, second and third derivatives of are bounded by , , and respectivelyThe exact conditions in Zhang et al. (2013) refer to various high order moments, but are in any case satisfied when , and is -Lipschitz in the spectral norm. For learning problems, all derivatives of the objective can be bounded in terms of a bound on the data and bounds on the derivative of a scalar loss function, and are less of a concern to us., then
Zhang et al. (2013) argued that the dependence on the sample size above is essentially optimal: the dominant term (as , and in particular when ) scales as , which is the same as for the empirical minimizer (as in eq. 10), and so one-shot parameter averaging achieves the same population suboptimality rate, using only a single round of communication, as the best rate we can hope for using unlimited communication, or if all samples were on the same machine. Moreover, the terms can be replaced by a term using an appropriate bias-correction procedure.
However, this view ignores the dependence on the other parameters, and in particular the strong convexity parameter , which is much worse in (12) relative to (10). The strong convexity parameter often arises from an explicit regularization, and decays as the sample size increases. E.g., in regularized loss minimization and SVM-type problems (Sridharan et al., 2008), as well as more generally for stochastic convex optimization (Shalev-Shwartz et al., 2009), the regularization parameter, and hence the strong convexity parameter, decreases as . In practice, is often chosen even smaller, possibly as small as . Unfortunately, substituting in (12) results in a useless bound, where even the first term does not decrease with the sample size.
Of course, this strong dependence on might be an artifact of the analysis of Zhang et al.. However, in Theorem 1 below, we show that even in a simple one-dimensional example, when , the population sub-optimality of the one-shot estimator (using machines and a total of samples), can be no better then the population sub-optimality using just samples, and much worse than what can be attained using samples. In other words, one-shot averaging does not give any benefit over using only the data on a single machine, and ignoring all other data points.
For any number of machines , if we run one-shot parameter averaging to compute , it holds for some universal constants that
The intuition behind the construction of Theorem 1 is that when is small, the deviation of each machine output from is large, and its expectation is biased away from . The exact bias amount is highly problem-dependent, and cannot be eliminated by any fixed averaging scheme. Since bias is not reduced by averaging, the optimization error does not scale down with the number of machines . The full construction and proof appear in appendix A. In the appendix we also show that the bias correction proposed by Zhang et al. to reduce the lower-order terms in equation (11) does not remedy this problem.
Distributed Approximate Newton-type Method
We now describe a new iterative method for distributed optimization. The method performs two distributed averaging computations per iteration, and outputs a predictor which, under suitable parameter choices, converges to the optimum . The method, which we refer to as DANE (Distributed Approximate NEwton-type Method) is described in Figure 1.
DANE maintains an agreed-upon iterate , which is synchronized among all machines at the end of each iteration. In each iteration, we first compute the gradient at the current iterate, by averaging the local gradients . Each machine then performs a separate local optimization, based on its own local objective and the computed global gradient , to obtain a local iterate . These local iterates are averaged to obtain the centralized iterate .
The crux of the method is the local optimization performed on each machine at each iteration:
To understand this local optimization, recall the definition of the Bregman divergence corresponding to a strongly convex function :
Now, for each local objective , consider the regularized local objective, defined as
and its corresponding Bregman divergence:
It is not difficult to check that the local optimization problem (13) can be written as
where we also added the terms which do not depend on and do not affect the optimization. The first two terms in (14) are thus a linear approximation of the overall objective about the current iterate , and do not depend on the machine . What varies from machine to machine is the potential function used to localize the linear approximation. The update (14) is in-fact a mirror descent update (Nemirovski and Yudin, 1978; Beck and Teboulle, 2003) using the potential function , and step size .
At the other extreme, consider the case where and all local objectives are equal, i.e. . Substituting the definition of the Bregman divergence into (14), or simply investigating (13), we can see that . That is, DANE converges in a single iteration to the overall empirical optimum. This is an ideal Newton-type iteration, where the potential function is perfectly aligned with the objective.
Of course, if for all machines , we would not need to perform distributed optimization in the first place. Nevertheless, as , we can hope that are similar enough to each other, such that (14) approximates such an ideal Newton-type iteration, gets us very close to the optimum, and very few such iterations are sufficient.
In particular, consider the case where , and hence also are quadratic. In this case, the Bregman divergence takes the form:
and the update (14) can be solved in closed form:
Contrast this with the true Newton update:
The difference here is that in (16) we approximate the inverse of the average of the local Hessians with the average of the inverse of the Hessians (plus a possible regularizer). Again we see that the DANE update (16) approximates the true Newton update (17), which can be performed in a distributed fashion without communicating the Hessians.
For a quadratic objective, a single Newton update is enough to find the exact optimum. In Section 4 we rigorously analyze the effects of the distributed approximation, and quantify the number of DANE iterations (and thus rounds of communication) required.
For a general convex, but non-quadratic, objective, the standard Newton approach is to use a quadratic approximation to the ideal Bregman divergence . This leads to the familiar quadratic Newton update in terms of the Hessian. DANE uses a different sort of approximation to : we use a non-quadratic approximation, based on the entire objective and not just a local quadratic approximation, but approximate the potential on each node separately. In the stochastic setting, this approximation becomes better and better, and thus the required number of iterations decrease, as .
Since it is notoriously difficult to provide good global analysis for Newton-type methods, we will investigate the global convergence behavior of DANE carefully in the next Section but only for quadratic objective functions. This analysis can also be viewed as indicative for non-quadratic objectives, as locally they can be approximated by quadratics and so should enjoy the same behavior, at least asymptotically. For non-quadratics, we provide a rigorous convergence guarantee when the stepsize is sufficiently small or the regularization parameter is sufficiently large (in Section 5). However, this analysis does not show a benefit over distributed gradient descent for non-quadratics. We partially bridge this gap by showing that even in the non-quadratic case, the convergence rate improves as the local problems become more similar.
DANE for Quadratic Objectives
In this Section, we analyze the performance of DANE on quadratic objectives. We begin in Section 4.1 with an analysis of DANE for arbitrary quadratic objectives , without stochastic assumptions, deriving a guarantee in terms of the approximation error of the true Hessian. Then in Section 4.2 we consider the stochastic setting where the instantaneous objective is quadratic in , utilizing a bound on the approximation error of the Hessian to obtain a performance guarantee for DANE in terms of the smoothness and strong convexity of . In Section 4.3 we also consider the behavior for stochastic optimization problems, where is set as a function of the sample size .
We begin by considering the case where each local objective is quadratic, i.e. has a fixed Hessian. The overall objective is then of course also quadratic.
After iterations of DANE on quadratic objectives with Hessians , we have:
If and for all , , then setting and , we have:
In the next Section, we consider the stochastic setting, where we can obtain bounds for that improve with the sample size, and plug these into Lemma 1 and Theorem 2 to obtain a performance guarantee for DANE.
2 Stochastic Quadratic Problems
We now turn to a stochastic quadratic setting, where as in (3), and the instantaneous losses are smooth and strongly convex quadratics. That is, for all , is quadratic in and .
We first use a matrix concentration bound to establish that all Hessians are close to each other, and hence also to their average:
If for all , then with probability at least over the samples, , where and .
The proof appears in appendix D. Combining Lemma 2, Lemma 1 and Theorem 2, we can conclude:
In the stochastic setting, and when the instantaneous losses are quadratic with , then after
iterations of DANE, we have, with probability at least , that .
The proof appears in Appendix E. From the theorem, we see that if the condition number is fixed, then as the number of required iterations decreases. In fact, for any target sub-optimality , as long as the sample size is at least logarithmically large, namely , we can obtain the desired accuracy after a constant or even a single DANE iteration! This is a mild requirement on the sample size, since generally increases at least linearly with .
We next turn to discuss the more challenging case where the condition number decays with the sample size.
3 Analysis for Regularized Objectives
Confronted with such non-strongly-convex objectives, a standard approach is to perform empirical minimization on a regularized objective (Shalev-Shwartz et al., 2009). That is, to define the regularized instantaneous objective
and minimize the corresponding empirical objective . The instantaneous objective of the modified stochastic optimization problem is now -strongly convex. If are -Lipschitz in , then we have (Shalev-Shwartz et al., 2009):
where and . The optimal choice of in the above is , where is a bound on the predictors we would like to compete with, and with this we get the optimal rate:
It is thus instructive to consider the behavior of DANE when . Plugging this choice of into Theorem 3, we get that the number of DANE iterations behaves as:
That is, unlike distributed gradient descent, or any other relevant method we are aware of, the number of required iterations / communication rounds does not increase with the sample size, and only scales linearly with the number of machines.
Convergence Analysis for Non-Quadratic Objectives
As discussed above, it is notoriously difficult to obtain generic global analysis of Newton-type methods. Our main theoretical result in this paper is the analysis for quadratic objectives, which we believe is also instructive for non-quadratics. Nevertheless, we complement this with a convergence analysis for generic objectives.
We therefore return to considering generic convex objectives . We also do not make any stochastic assumptions. We only assume that each is -smooth and strongly convex, and that the combined objective is -smooth and -strongly convex.
Assume that for all , and . Let
If , then the DANE iterates satisfy
The proof appears in Appendix F. The theorem establishes that with any and small enough step-size , DANE converges to . If each is strongly convex, we can also take and sufficiently small and ensure convergence to . However, the optimal setting of and above is to take and set , in which case , and we recover distributed gradient descent, with the familiar gradient descent guarantee.
We again emphasize that the analysis above is weak and does not take into account the relationship between the local objectives . We believe that the quadratic analysis of Section 4 better captures the true behavior of DANE. Moreover, we can partially bridge this gap by the following result, which shows that a variant of DANE enjoys a linear convergence rate which improves as the local objectives become more similar to (the proof is in Appendix G):
Assume that in the DANE procedure, we replace step by , and define . If there exists such that , we have , then
If is small and , then we expect and . In this case, , leading to fast convergence.
Experiments
In this section, we present preliminary experimental results on our proposed method. In terms of tuning , we discovered that simply picking (which makes DANE closest to a Newton-type iteration, as discussed in Section 3) often results in the fastest convergence. However, in unfavorable situations (such as when the data size per machine is very small), this can also lead to non-convergence. In those cases, convergence can be recovered by slightly increasing to a small positive number. In the experiments, we considered . These are considerably smaller than what our theory indicates, and we leave the question of the best parameter choice to future research.
Finally, we examine the convergence on these datasets in terms of the average loss on the test set. In figure 4, we present the results for machines on the three datasets, using DANE (with ) and ADMM. We also present for comparison the objective value obtained using one-shot parameter averaging (OSA), using bias correction as proposed in Zhang et al. (2013). The figure highlights the practical importance of multi-round communication algorithms: while DANE and ADMM converge to the value achieved by the regularized loss minimizer, the single-round OSA algorithm may return a significantly suboptimal result.
Ohad Shamir and Nathan Srebro are supported by the Intel ICRI-CI Institute. Ohad Shamir is further supported by an Israel Science Foundation grant 425/13 and an FP7 Marie Curie CIG grant.
References
Appendix A Lower Bounds for One-shot Parameter Averaging
Before providing the proof details, let us first describe the high-level intuition of our construction. Roughly speaking, one-shot averaging works well when the bias of the predictor returned by each machine (as a random vector in Euclidean space, based on the sampled training data) is much smaller than the variance. Since each such predictor is based on independent data, averaging such predictors reduces the variance by a factor of , leading to good guarantees. However, averaging has no effect on the bias, so this method is ineffectual when the bias dominates the variance. The construction below shows that when the strong convexity parameter is small, this can indeed happen.
More specifically, when the strong convexity parameter is smaller than , the magnitude of the deviations of the (random) predictor returned by each machine does not decay with the sample size . Moreover, its distribution is highly dependent on the data distribution and the shape of , and is biased in general. Below we use one such construction, which we found to be convenient for precise analytic calculations, but the intuition applies much more broadly.
Specifically, let , and define the loss function as
Taking the derivative, equating to zero and slightly manipulating the result, we get that
We now turn to analyze . First, we have by definition
Therefore, we have for all . More precisely, considering (23) and the fact that its left hand size is monotonic in , it’s easy to verify that for any , we have , and , so using (24),
Since for all , this expression is at most . Plugging this back into (22), and using the assumption , we get that
Since is the standard Gaussian distribution, it can be numerically checked that this is at most
Now, we show that this expected value of is far away from . is not hard to calculate: It satisfies
and it can be calculated numerically that . Moreover, we assume , so and thus it can be verified that
Note that this is always a positive quantity. As a result, using Jensen’s inequality, we get
Moreover, by -strong convexity of , we have that
(see Equation (10)). Combining the four inequalities above gives us the theorem statement.
A.2 Bias Correction Also Fails
In Zhang et al. (2013), which analyzes one-shot parameter averaging, the authors noticed that the analysis fails for small values of , and proposed a modification of the simple averaging scheme, designed to reduce bias issues. Specifically, given a parameter , each machine subsamples examples without replacement from its dataset, and computes the optimum with respect to this subsample. Then, it computes the optimum over the entire dataset, and returns the weighted combination . Unfortunately, the analysis still results in lower-order terms with bad dependence on , and it’s not difficult to extend our construction from Theorem 1 to show that this bias-corrected version of the algorithm still fails (at least, if is chosen in a fixed manner).
Appendix B Proof of Theorem 2
For any , the optimal solution is always given by:
where for the last equality we rearranged (25) to calculate . Bounding and iterating (26) leads to the desired result.
Appendix C Proof of Lemma 1
where is the smallest eigenvalue of .
This equals one minus the smallest element on the diagonal of the diagonal matrix , which is . ∎
Let be a positive definite matrix with minimal eigenvalue which is larger than some , and matrices of the same size, such that and . Then
Note that . Therefore, we can use the identity
which holds for any such that . Using this with and plugging back, we get
Averaging over and using the assumption , we get
Multiplying both sides by , we get
By the triangle inequality and convexity of the norm, this implies
Now, we use Lemma 4 with and (noting that ), and get the bound
Now, let us assume the even stronger condition that (which we shall justify at the end of the proof), then we can upper bound the right hand side in the equation above by
Differentiating with respect to , we get an optimal point at
If this is non-positive, it means that , and moreover, that , so (27) equals . Otherwise, we pick , and (27) becomes
Combining the two cases, we get the result stated in the Lemma. Finally, it remains to justify why . By the way we picked , it’s enough to prove that
This is true since for all positive .
Appendix D Proof of Lemma 2
is the average of the Hessians of i.i.d. quadratic functions, all with eigenvalues at most , and each is the average of the Hessians of i.i.d. quadratic functions, all with eigenvalues at most . By a matrix Hoeffding’s inequality (Tropp, 2012), we have that for each , with probability over the samples received by machine ,
By a union bound, we get that with probability ,
Combining these, we get that with probability ,
Appendix E Proof of Theorem 3
Plugging 2 into Lemma 1, and noting that the strong convexity of the instantaneous losses implies is strongly convexIn fact, it is enough to require that is -strongly convex, and it is not necessary to require strong convexity of for each individual . However, requiring that the population objective is -strongly convex might not be sufficient if , e.g. when ., we obtain
By smoothness of , we have , and therefore Theorem 2 implies that
This means that to get optimization error , the number of iterations required is
Considering (28), if the first case holds, then the denominator in (29) is at least and we get that the number of iterations required is . If the second case in (28) holds, we have
which implies that the iteration bound (29) is at most
Appendix F Proof of Theorem 4
Under the conditions of Theorem 4, the following inequalities hold:
The smoothness of implies that its conjugate is strongly convex. Let and , then and . We have
Since , . From , we obtain
We are now ready to prove the Theorem. At iteration , we have the following first order equation:
where . In the above derivations, the first inequality uses the smoothness of ; the second inequality uses the strong convexity of ; the third inequality uses (30); the second and the last equalities use (32).
where the first inequality is Jensen’s and the third inequality is due to (31). As a result, we get
The desired bound follows by recursively applying the above inequality.
Appendix G Proof of Theorem 5
where in the last inequality, we have used the assumption that . This implies that
where the first inequality is due to (33), the second inequality comes from the inequality , and the third inequality uses the assumption that . We thus obtain