Adaptive Stochastic Variance Reduction for Subsampled Newton Method with Cubic Regularization
Junyu Zhang, Lin Xiao, Shuzhong Zhang
Keywords:
cubic-regularized Newton method, subsampling, stochastic variance reduction, randomized algorithm, iteration complexity, sample complexity.
Introduction
We consider the problem of minimizing the average of a large number of loss functions:
Our goal is to find an approximate local solution that satisfies
For minimizing a general smooth and nonconvex function , Nesterov and Polyak introduced a modified Newton method with cubic regularization (CR). Specifically, each iteration of the CR method consists of the following updates:
Assuming the Hessian to be Lipschitz continuous, it is shown in that the CR method finds an approximate solution satisfying (2) within iterations. This is better than purely gradient-based methods, which need iterations to reach a point satisfying [12, Section 1.2.3]. However, the computational cost per iteration of CR can be much higher than gradient-based methods.
Much recent efforts have been devoted to improving the efficiency of CR by exploiting the finite-sum structure in (1); see, e.g., . An natural approach is to replace and by subsampled approximations:
where are two sets (or multisets for sampling with replacement) of random indices at the th iteration. The cost of computing the Hessians usually dominates that of the gradients. Moreover, the cost of solving the CR subproblem (3) may grow fast when the batch size increases, especially when using iterative methods such as gradient descent or the Lanczos method . Therefore, an important measure of efficiency is the number of second-order oracle calls for , i.e., the Hessian sample complexity.
In this paper, we develop an adaptive subsampling CR method that requires second-order oracle calls in expectation. Assuming that is small enough, we often simply refer to it as . Notice that using the choices in (4) would require Hessian samples. Thus this is a significant improvement especially when is very large. In the rest of this section, we discuss several related work, and then outline our contributions.
It is shown in that the order of convergence rate of the CR method remains the same as long as and in (3) satisfy
with being defined in (3) and being some positive constants. Here for vectors denotes their Euclidean norm, and for matrices denotes their spectral norm. In order to exploit the averaging structure in (1), a subsampled cubic regularization (SCR) method was proposed in where and are calculated as in (5) and (6) (here we omit additional accept/reject steps based on trust-region methods). Matrix concentration inequalities are used in to derive appropriate sample sizes and such that the conditions (7) and (8) hold with high probability. In particular, matrix Bernstein inequality (e.g., ) implies that with probability at least ,
where is a uniform Lipschitz constant of for all . Therefore, if we upper bound the right-hand side above by , then (8) holds with probability at least provided that
A similar condition on is also derived in . The overall gradient and Hessian sample complexities for SCR, with or without replacement, are summarized in Table 1.1 (based on the analysis in ). When , SCR can be much worse than the deterministic CR method.
In order to further reduce the Hessian sample complexity, several recent works combine CR with stochastic variance reduction techniques. Stochastic variance-reduced gradient (SVRG) method was first proposed to reduce gradient sample complexity of randomized first-order algorithms (see for convex optimization and for nonconvex optimization). Two different SVRC (stochastic variance-reduced cubic regularization) methods were proposed in and respectively. Both of them employed the same variance-reduction technique to reduce the Hessian sample complexity. In particular, incorporated additional second-order corrections in gradient variance-reduction, therefore it obtained better gradient sample complexity, but with slightly worse Hessian sample complexity than . See Table 1.1 for a summary of their results. All these methods require calls to solve the cubic regularized sub-problem (3).
Subsampled Newton methods without CR have been studied in, e.g., , but their convergence rates are worse than the ones that are based on CR.
Among the works on CR with stochastic variance reduction, most of them (e.g., ) rely on matrix concentration bounds such as (10) to set the sample sizes and according to at each iteration , The problem is that is the solution to the CR sub-problem in (3), where and need to be obtained from and samples in the first place. While one can assume bounds like (10) hold in the complexity analysis, they do not provide practically implementable variance-reduction schemes.
In contrast, the sample sizes in are set as constants across all iterations, which only depend on and . The disadvantage of this approach is that it can be very conservative. According to concentration bounds such as (10), the sample sizes at the initial stage of the algorithm (when is large) can be set much smaller than the ones required in the later stage (when is very small). Therefore when using a constant sample size, much of the samples in the initial stage can be wasteful.
There is another technicality of using matrix concentration bounds: we need inequalities such as (9) to hold for all iterations with high probability, say with probability at least . Then the probability margin per iteration and should satisfy , where is the number of iterations for CR methods. Therefore, and there is an additional factor in the sampling complexities (see Table 1.1). The results in are for convergence in expectation, nevertheless they still have a factor and unusually large constants in their bounds.
2 Contributions and outline
In this paper, we develop an adaptive sampling scheme for stochastic variance reduction in the subsampled Newton method with cubic regularization. In particular, the gradient sample size and Hessian sample size are chosen adaptively in each iteration to ensure the following conditions hold in expectation (conditioned on ):
where and are some positive constants. The major difference from (7) and (8) is that here is a known quantity conditioned on , before choosing the sample sizes to form the approximations and . Indeed we choose and based on . Such an adaptive scheme is readily implementable in practiceRight before submitting this paper, we discovered a recent note which independently showed that the conditions (7) and (8) are sufficient to retain the same convergence rate of the exact CR method. However it does not provide improved sample complexity over previous work listed in Table 1.1.. Moreover, it does not waste samples in the early stage of the algorithm as constant sample sizes do.
We show that our adaptive subsampled CR method has an expected iteration complexity , which is the number of times the CR subproblem in (3) needs to be solved in order to find a point satisfying (2), which is the same as that of the deterministic CR method. However, the total Hessian sample complexity of our method is , which is much better than of the full CR method, and is indeed better than all previous works listed in Table 1.1.
In addition to the improved Hessian sample complexity, the techniques in our analysis are quite different from those adopted in previous works. In particular, we avoid using any high probability bounds based on matrix or vector concentration inequalities. Instead, our analysis is based on novel bounds on the 3rd and 4th order moments of the average of independent random matrices, which are of independent interest on their own. The type of convergence studied in is also in expectation. However, their analysis still relies on some matrix concentration inequalities, thus their results contain the factor and excessively large constants.
The rest of this paper is organized as follows. In Section 2, we present the adaptive SVRC method and its convergence analysis. We show that it retains the iteration complexity of the exact cubic regularization method, but with only Hessian samples per iteration. In addition, we show that sampling with or without replacement have the same order of sample complexity. In Section 3, we study a non-adaptive SVRC method with fixed sample size at each iteration. We show that if exact gradients are available, then it attains the same total Hessian sample complexity . If both gradient and Hessian need to be subsampled, we examine the SVRC method of using the higher moments bounds developed in this paper and obtain refined analysis.
Adaptive variance reduction for cubic regularization
In this section we first present the adaptive SVRC method, then analyze its convergence rate and Hessian sample complexity.
where and are determined by and the desired tolerance :
Then we compute the subsampled gradient and Hessian as
This construction follows the stochastic variance reduction scheme proposed in , which has been adopted by recent works on subsampled Newton method with cubic regularization .
We make several remarks regarding the subsampling scheme in Algorithm 1. First, compared with the algorithms in , which use large enough sample sizes to ensure (7) and (8) with high probability, Algorithm 1 aims to ensure (11) and (12) in expectation. Moreover, instead of depending on which is not available until after the current iteration, our sample sizes are determined by , which is computed in the previous iteration. Second, compared with the constant sample size used in , our adaptive sampling scheme may use much less samples in the early stages when is relatively large. Our overall Hessian sample complexity is better than either of these two previous approaches.
An alternative approach to avoid the dependence of sample sizes on is to use the full gradient, i.e., let , and use (15) or (6) to compute the Hessian approximation . Then condition (7) holds automatically, and one can replace (8) with
because it can be be shown that for some large enough constant . Since the full gradient can be computed before sampling , this condition can be used to determine sample size . However, it can be shown that one have roughly plus some random noise, thus the mini-batch size required for (16) to hold can be much larger than that for (12).
We make the following assumption regarding the objective function in (1):
Consequently, and are and -Lipschitz continuous respectively.
This assumption is very similar to those adopted in subsampled Newton methods with cubic regularization . The only difference is that here we use the Frobenius norm, instead of the spectral norm, for the Hessian smoothness assumption. The advantage of using the Frobenius norm is that it works well with matrix inner product, which allows us to derive simple bounds on the 3rd and 4th order moments for the average of random matrices. On the other hand, the Lipschitz constant is always larger than the one corresponding to the spectral norm, up to a factor of in the worst case. However, when the Hessians are of low-rank or ill-conditioned, which is often the case in practice, the Lipschitz constants for different norms are very close.
Before presenting the main results, we first provide a few supporting lemmas. The first one gives a simple bound on the 4th order moment of the average of i.i.d. random matrices with zero mean. Its proof is given in Appendix A.
Based on the above lemma, we can bound the 2nd and 4th order variances of the gradient and Hessian approximations. The following lemma is proved in Appendix B.
Let the variance reduced gradient and Hessian be constructed according to (14) and (15). Then they satisfy the following equalities and inequalities
As a result, we have the following corollary, whose proof is given in Appendix C.
Let , , and the mini-batch index sets and be generated according to Algorithm 1. Then we have
Now we are ready to present the descent property of Algorithm 1.
Suppose the sequence is generated by Algorithm 1. Then the following descent property holds
As a remark, as long as , the variance term associated with in current step can be dominated by the descent associated with in the previous step. At the first step of each stage, the variance term is 0, hence we define for a unified expression.
Consider the cubic regularization subproblem in Algorithm 1:
Then by the Lipschitz continuous condition of the objective function, we have
where the second line is due to (21) and the fifth line is due to (22). By the following variant of Young’s inequality
Since and at the beginning of each stage, we have
By substituting the variance bounds in Corollary 2.4 into (24), we get
Let , and be generated by Algorithm 1. Then the following relations hold
Finally we are ready to present the main result on iteration complexity.
Choose the parameter and let be given by either output option in Algorithm 1 after running for stages, then
where . As a result,
If we choose and such that Km={\mathcal{O}}\bigl{(}\epsilon^{-3/2}\bigr{)}, then within {\mathcal{O}}\bigl{(}\epsilon^{-3/2}\bigr{)} iterations, Algorithm 1 would reach a point such that
In other words, the approximate optimality conditions in (2) are satisfied in expectation.
First, taking expectation over the whole history of random samples for (20) and (25) and summing them up for yield
Under the assumption , we have . Further summing over the stages , we obtain
For option 1 in the output rule, due to the concavity of function, Jensen’s inequality gives
which is precisely (26). For option 2, since and are randomly chosen,
Therefore, for both options, inequality (26) holds.
Next, we derive guarantees for approximating the first and second-order stationary conditions. According to Lemma 2.6,
where the first inequality is due to Hölder’s inequality, the second inequality is due to Jensen’s inequality, the third inequality is due to (26) and the last inequality is due to the fact that for all and . Finally, substituting the above inequality into (30) yields the desired result in (27).
In order to bound the minimum eigenvalue of the Hessian, we have from Lemma 2.6,
Similar to the arguments used for proving the first-order bound,
Combining the inequality above with (31) gives the desired bound in (28). ∎
2 Bounding the Hessian sample complexity
Due to the adaptive mini-batch size rule, the total Hessian sample complexity is not given explicitly. In this subsection, we provide a bound on the complexity of Hessian sampling.
Let the total number of Hessian samples in Algorithm 1 be . If we set the length of each stage and number of stages to be
then the expectation of taken to reach a second-order -solution will be
According to (13), it suffices to use the following sample size for approximating the Hessian,
where the first inequality is due to the triangle inequality and the second one is due to the Cauchy-Schwarz inequality. Summing up for all and , we get
where we used as specified in (32). Taking expectation on both sides gives
where the second inequality is due to Jensen’s inequality and the third inequality is due to (29).
where we used and the constant is defined as
Note that the above bound holds only when is small enough so that (32) makes sense. In order to cover the case when is large, we can write
Through similar arguments, one can bound the total gradient sample complexity by
3 Analysis of sampling without replacement
In this section, we show that sampling without replacement will not change the sample complexity of Algorithm 1. Different Hessian sample complexity bounds for sampling with and without replacement are derived in (see Table 1.1), and both of them are worse than the complexity obtained in this paper. Again, we start from the variance estimation of the subsampled gradient and Hessian.
The proof of this lemma is given in Appendix E. As a result of this lemma, we have the following corollary. The proof is similar to that of Lemma 2.3, which we omit for simplicity.
Let and be constructed by (14) and (15) respectively, with the mini-batches and be sampled without replacement. Then
Thus by Corollary 2.11, the following inequality holds approximately
We can derive the desired mini-batch sizes for Hessian and gradient smapling by requiring
For the Hessian sample complexity, if we want to have a sublinear sample size with , then we should expect holds during the iterations. This requires
Consider Algorithm 1, where we sample and without replacement and set the length of each epoch and number of epochs to be and respectively. Then the totoal number of Hessian samples and total number of gradient samples required to reach a second-order -solution is
Analysis of non-adaptive SVRC Schemes
In this section, we consider variants of the SVRC methods that use fixed gradient and Hessian sample sizes across all iterations. In the first variant, we use the full gradients but subsampled Hessians. In this case, we show that the total Hessian sample complexity is still . The second variant uses both approximate gradients and approximate Hessians, and adds a correction term to the gradient approximation based on the second-order information. This variant is proposed in , where an sample complexity is proved for both the gradient and Hessian approximations. We obtain the same order of sample complexity using the higher moment bounds developed in this paper (instead of using concentration inequalities), which avoid the factor and excessively large constant in the results of .
Algorithm 2 describes the SVRC method using full gradient in each iteration, i.e., . One remark regarding output option 1 is that the best choice of , depending on the parameters and , is given in Lemma 3.3. However, one does not need to know the value exactly, and any choice of will not affect our complexity result.
Similar to the derivation of (23), we have the following result,
Note that the expectation is not taken over since it is a predetermined constant, which we denote as from now on. Let us define a Lyapunov function
where the coefficients are constructed recursively by setting and
Here are some constant to be determined later. Next, we prove a monotone decreasing property of this Lyapunov function over one epoch of Algorithm 2.
First, we note the following simple fact, which is proved in Appendix F.
For any , the following inequality holds:
Now, using the definition of in (37) and expression of (38), we see that the above inequality leads to the following descent property of the Lyapunov function.
Let the sequence be generated by Algorithm 2, then for all and ,
Next, we prove that when the parameters are properly choosen, then .
Suppose we set the batch size , where is a constant. If we set , , and , then
By (38) and the values of , , and , we have
Adding to both sides of the above equality, we obtain
where we used and by choosing we have and . In addition,
Therefore if , then we have . ∎
Suppose in Algorithm 2 we set , , , and is defined in (42). Let be given by either of the two output options in the algorithm, then
and the expected total Hessian samples required to reach a second-order -solution is .
Then Lemma 3.2 and Lemma 3.3 immediately give
Using similar arguments for the output option 1 and 2 in the proof of Theorem 2.7, the first bound (43) follows.
From (43), by Jensen’s inequality, one simply gets
Then following the proof of Lemma 2.6 in Appendix D, more specifically (53), we have
Similarly, using (53), one can bound the minimum eigenvalue of the Hessian as
Finally, by setting , and , the total number of Hessian samples is
2 The case of using subsampled gradient
In this subsection, we analyze a non-adaptive SVRC scheme proposed in , which is shown in Algorithm 3. Similar to Algorithm 2, one need not knwon the best value of given in Lemma 3.7, any choice of will be acceptable. In this scheme, the approximate gradients and Hessians are constructed as follows:
The following lemma is proved in Appendix G.
Let be constructed by (44) and , then the following inequalities hold:
By the above lemma and a discussion similar to that of (23) and (36), we have
where the last inequality is due to Lemmas 2.3 and 3.5 and Jensen’s inequality. In the rest of the analysis, we use the Lyapunov function defined in (37) but with a new set of parameters by setting and
Again the constants and will be determined later. We present the following results without proof due to the similarity to their counterparts in previous subsection.
Suppose the sequence is generated by Algorithm 3, then we have
Define \gamma=\displaystyle\min_{1\leq t\leq m}\textstyle\left\{\frac{\sigma}{4}-\frac{5\rho}{6}-c_{t+1}\bigl{(}1+\theta_{1}^{6}+2\theta_{2}^{3}\bigr{)}\right\}. Then for ,
If we set , , , , and , then we have as long as and
Let be chosen by either of the two output options in the algorithm, then
and the total Hessian and gradient sample complexity for finding a second-order -solution is {\mathcal{O}}\bigl{(}N^{4/5}\epsilon^{-3/2}\bigr{)}.
Discussion
We considered the problem of minimizing the average of a large number of smooth and possibly nonconvex functions, , using subsampled Newton method with cubic regularization. We presented an adaptive variance reduction method that requires Hessian samples for finding an approximate solution satisfying and . This result holds for both sampling with and without replacement. Our analysis do not rely on high probability bounds from matrix concentration inequalities, instead, we use bounds on 3rd and 4th moments of the average of random matrices.
We have focused on the Hessian sample complexity by assuming that the solution to the cubic regularization (CR) subproblem (3) is available at each iteration. Nesterov and Polyak showed that the CR subproblem is equivalent to a convex one-dimensional optimization problem, but this approach requires eigenvalue decomposion of the approximate Hessian , which can be very costly for large-dimensional problems. Several recent works propose to solve the CR subproblem using iterative algorithms such as gradient descent or Lanczos method , and approximate trust-region solver can also be used. However, the overall complexity of the combined methods may still be high.
An efficient approximate solver for the CR subproblem has been developed in , which leads to a total computational complexity of for minimizing the finite average problem (1). This complexity is measured in terms of the total number of Hessian-vector products, i.e., multiplications by the component Hessians . Similar results have also been obtained by . For many mahcine learning problems, including generalized linear models and training neural networks, such Hessian-vector products can be computed in time . We notice that the CR subproblem solved in includes all component Hessians. Thus it is possible to further reduce the overall computational complexity by combining the efficient CR solver developed in and the lower Hessian sample complexity obtained in this paper.
Acknowledgments
We thank Zeyuan Allen-Zhu for helpful discussions on the complexities of several first and second-order methods for nonconvex optimization and the approximate cubic regularization solver in .
Appendix A Proof of Lemma 2.2
Appendix B Proof of Lemma 2.3
where is a uniform sample from . Note that
Similarly, one can get the variance bounds for the gradient estimate. This part of the proof is omitted for simplicity. ∎
Appendix C Proof of Corollary 2.4
By Lemma 2.3 and the mini-batch size rule in Algorithm 1,
Due to the concavity of the square root function , we can apply Jensen’s inequality to obtain
Again, with the concavity of the function , applying Jensen’s inequality yields
Following a similar line of arguments, one can get the bounds for the gradient variances. We omit the details for simplicity. ∎
Appendix D Proof of Lemma 2.6
By the Lipschitz continuity of and the fact ,
In addition, the optimality condition (21) implies
Taking expectation on both sides of the above inequality and applying Corollary 2.4 yield
For the secnod inequality, the optimality condition (22) implies
Therefore, according to the Lipschitz continuity of ,
Taking expectation on both sides and applying the Corollary 2.4 results in
which is the second desired inequality. ∎
Appendix E Proof of Lemma 2.10
Equation (34) is a standard result for variance analysis of sampling without replacement scheme. Hence we omit the proof of this equation. To prove (35), we start with the expansions in (51) and calculate the terms for sampling without replacement. First, the following three terms do not change:
where in the last equality we used result for . In similar ways, one can find the expressions for and :
Summing these terms up gives the desired equation (35). ∎
Appendix F Proof of Lemma 3.1
We expand and then use Young’s inequality,
Appendix G Proof of Lemma 3.5
where the last inequality is due to the Lipschitz continuity of . ∎