Finite-Sum Smooth Optimization with SARAH
Lam M. Nguyen, Marten van Dijk, Dzung T. Phan, Phuong Ha Nguyen, Tsui-Wei Weng, Jayant R. Kalagnanam
Introduction
We are interested in solving the finite-sum smooth minimization problem
where each , , has a Lipschitz continuous gradient. Throughout the paper, we consider the case where has a finite lower bound .
Problems of form (1) cover a wide range of convex and nonconvex problems in machine learning applications including but not limited to logistic regression, neural networks, multi-kernel learning, etc. In many of these applications, the number of component functions is very large, which makes the classical Gradient Descent (GD) method less efficient since it requires to compute a full gradient many times. Instead, a traditional alternative is to employ stochastic gradient descent (SGD) . In recent years, a large number of improved variants of stochastic gradient algorithms called variance reduction methods have emerged, in particular, SAG/SAGA , SDCA , MISO , SVRG/S2GD , SARAH , etc. These methods were first analyzed for strongly convex problems of form (1). Due to recent interest in deep neural networks, nonconvex problems of form (1) have been studied and analyzed by considering a number of different approaches including many variants of variance reduction techniques (see e.g. , etc.)
We study the SARAH algorithm depicted in Algorithm 1, slightly modified. We use upper index to indicate the -th outer loop and lower index to indicate the -th iteration in the inner loop. The key update rule is
The computed is used to update
We will analyze SARAH for smooth nonconvex optimization, i.e., we study (1) with the following assumption
We notice that, the above assumption is weaker than the assumption on -smoothness of each , . Throughout this paper for non-convex results, we only consider Assumption 1 and no other assumptions. We stress that our convergence analysis only relies on the above average smooth assumption without bounded variance assumption (as required in ).
We measure the convergence rate in terms of total complexity , i.e., the total number of gradient computations. For SARAH we have
We notice that SARAH, using the notation and definition of , is a random algorithm that maps functions to a sequence of iterates
In this paper, we show that in SARAH we can choose parameters and such that, for , the total complexity is
Related Work: The paper that introduces SARAH is only able to analyze convergence of a single outer loop giving a total complexity of .
Besides the lower bound, introduces SPIDER, as a variant of SARAH, which achieves the best known convergence result in the nonconvex case. SPIDER uses the SARAH update rule (2) as was originally proposed in and the mini-batch version of SARAH in . SPIDER and SARAH are different in terms of iteration (3), which are and , respectively. Also, SPIDER does not divide into outer loop and inner loop as SARAH does although SPIDER does also perform a full gradient update after a certain fixed number of iterations. A recent technical report provides an improved version of SPIDER called SpiderBoost which allows a larger learning rate. Both SPIDER and SpiderBoost are able to show for smooth nonconvex optimization a total complexity of .
According to the results in Table 1, we can observe that SARAH enjoys the same fast convergence rate as those of SPIDER and SpiderBoost in the nonconvex case for finding a first-order stationary point based on only the average smooth assumption. Its complexity matches the lower-bound worst case complexity in up to a constant factor when .
Contributions: We summarize our key contributions as follows.
Smooth Non-Convex. We provide a convergence analysis for the full SARAH algorithm with multiple outer iterations for nonconvex problems (unlike in which only analyses a single outer iteration). Its complexity matches the lower-bound worst case complexity in up to a constant factor when . The convergence analysis only supposes the average smooth assumption (which is weaker than Lipschitz continuous assumption on each component gradient) in the non-convex case (Theorem 1). We extend this result to the mini-batch case (Theorem 2).
Smooth Convex. In order to complete the picture, we study SARAH+ which was designed as a variant of SARAH for convex optimization. We propose a novel variant of SARAH+ called SARAH++. Here, we study the iteration complexity measured by the total number of iterations (which counts one full gradient computation as adding one iteration to the complexity) – and leave an analysis of the total complexity as an open problem. For SARAH++ we show a sublinear convergence rate in the general convex case (Theorem 3) and a linear convergence rate in the strongly convex case (Theorem 4). SARAH itself may already lead to good convergence and there may no need to introduce SARAH++; in numerical experiments we show the advantage of SARAH++ over SARAH. We further propose a practical version called SARAH Adaptive which improves the performance of SARAH and SARAH++ for convex problems – numerical experiments on various data sets show good overall performance.
For the convergence analysis of SARAH for the non-convex case and SARAH++ for the convex case we show that the analysis generalizes the total complexity of Gradient Descent (GD) (Remarks 1 and 2), i.e., the analysis reproduces known total complexity results of GD. Up to the best of our knowledge, this is the first variance reduction method having this property.
Non-Convex Case: Convergence Analysis of SARAH
SARAH is very different from other algorithms since it has a biased estimator of the gradient. Therefore, in order to analyze SARAH’s convergence rate, it is non-trivial to use existing proof techniques from unbiased estimator algorithms such as SGD, SAGA, and SVRG.
We start analyzing SARAH (Algorithm 1) for the case where we choose a single sample uniformly at random from in the inner loop.
Suppose that Assumption 1 holds. Consider a single outer loop iteration in SARAH (Algorithm 1) with . Then, for any , we have
where is any lower bound of , and is the result of the -th iteration in the -th outer loop.
is simply the average of the expectation of the squared norms of the gradients of all the iteration results generated by SARAH. For nonconvex problems, our goal is to achieve
Suppose that Assumption 1 holds. Consider SARAH (Algorithm 1) with where is the inner loop size. Then, in order to achieve an -accurate solution, the total complexity is
The total complexity can be minimized over the inner loop size . By choosing , we achieve the minimal total complexity:
Suppose that Assumption 1 holds. Consider SARAH (Algorithm 1) with where is the inner loop size and chosen equal to . Then, in order to achieve an -accurate solution, the total complexity is
The total complexity in Corollary 1 covers all choices for the inner loop size . For example, in the case of , SARAH recovers the Gradient Descent (GD) algorithm which has total complexity . Theorem 1 for also recovers the requirement on the learning rate for GD, which is .
The above results explain the relationship between SARAH and GD and explains the advantages of the inner loop and outer loop of SARAH. SARAH becomes more beneficial in ML applications where is large.
2 Mini-batch case
The above results can be extended to the mini-batch case where instead of choosing a single sample , we choose samples uniformly at random from for updating in the inner loop. We then replace in Algorithm 1 by
where we choose a mini-batch of size uniformly at random at each iteration of the inner loop. The result of Theorem 1 generalizes as follows.
Suppose that Assumption 1 holds. Consider SARAH (Algorithm 1) by replacing in the inner loop size by (8) with
where is any lower bound of , and is the -th iteration in the -th outer loop.
We can again derive similar corollaries as was done for Theorem 1.
For the conditions in Theorem 2, in order to achieve an -accurate solution, the total complexity is
For the conditions in Theorem 2 and Corollary 3 with and where with and , in order to achieve an -accurate solution, the total complexity is
Convex Case: SARAH++: A New Variant of SARAH+
In this section, we propose a new variant of SARAH+ (Algorithm 2) , called SARAH++ (Algorithm 3), for convex problems of form (1).
Different from SARAH, SARAH+ provides a stopping criteria for the inner loop; as soon as
Here, we modify SARAH+ (Algorithm 2) into SARAH++ (Algorithm 3) by choosing the stopping criteria for the inner loop as
and by introducing a stopping criteria for the outer loop.
Before analyzing and explaining SARAH++ in detail, we introduce the following assumptions used in this section.
Under Assumption 3, let us define the (unique) optimal solution of (1) as . Then strong convexity of implies that
We note here, for future use, that for strongly convex functions of the form (1), arising in machine learning applications, the condition number is defined as . Assumption 3 covers a wide range of problems, e.g. -regularized empirical risk minimization problems with convex losses.
We separately assume the special case of strong convexity of all ’s with , called the general convexity assumption, which we will use for convergence analysis.
SARAH++ is motivated by the following lemma.
Suppose that Assumptions 2 and 4 hold. Consider a single outer loop iteration in SARAH (Algorithm 1) with . Then, for and any , we have
where is any optimal solution of .
where , inequality (11) implies
For this reason, we choose the stopping criteria for the inner loop in SARAH++ as with . Unlike SARAH+, for analyzing the convergence rate can be as small as .
The above discussion leads to SARAH++ (Algorithm 3). In order to analyze its convergence for convex problems, we define random variable as the stopping time of the inner loop in the -th outer iteration:
Note that is at least 1 since at , the condition always holds (and ).
Let random variable be the stopping time of the outer iterations as a function of an algorithm parameter :
Notice that SARAH++ maintains a running sum against which parameter is compared in the stopping criteria of the outer loop.
For the general convex case which supposes Assumption 4 in addition to smoothness we have the next theorem.
Suppose that Assumptions 2 and 4 hold. Consider SARAH++ (Algorithm 3) with , . Then,
the expectation of the average of the squared norm of the gradients of all iterations generated by SARAH++, is bounded by
The theorem leads to the next corollary about iteration complexity, i.e., we bound which is the total number of iterations performed by the inner loop across all outer loop iterations. This is different from the total complexity since does not separately count the gradient evaluations when the full gradient is computed in the outer loop.
For the conditions in Theorem 3 with , we achieve an -accurate solution after inner loop iterations.
By supposing Assumption 3 in addition to the smoothness and general convexity assumptions, we can prove a linear convergence rate. For strongly convex objective functions we have the following result.
Suppose that Assumptions 2, 3 and 4 hold. Consider SARAH++ (Algorithm 3) with , . Then, for the final output of SARAH++, we have
This leads to the following iteration complexity.
The proofs of the above results hold for any . If we choose , then SARAH++ reduces to the Gradient Descent algorithm since the inner “while” loop stops right after updating . In this case, Corollaries 5 and 6 recover the rate of convergence and complexity of GD.
In this section, we showed that SARAH++ has a guarantee of theoretical convergence (see Theorems 3 and 4) while SARAH+ does not have such a guarantee.
An interesting open question we would like to discuss here is the total complexity of SARAH++. Although we have shown the convergence results of SARAH++ in terms of the iteration complexity, the total complexity which is computed as the total number of evaluations of the component gradient functions still remains an open question. It is clear that the total complexity must depend on the learning rate (or ) – the factor that decides when to stop the inner iterations.
We note that can be “closely” understood as the total number of updates of the algorithm. The total complexity is equal to . For the special case , , the algorithm recovers the GD algorithm with . Since each full gradient takes gradient evaluations, the total complexity for this case is equal to (in the general convex case) and (in the strongly convex case).
However, it is non-trivial to derive the total complexity of SARAH++ since it should depend on the learning rate . We leave this question as an open direction for future research.
2 Numerical Experiments
Paper provides experiments showing good overall performance of SARAH over other algorithms such as SGD , SAG , SVRG , etc. For this reason, we provide experiments comparing SARAH++ directly with SARAH. We notice that SARAH (with multiple outer loops) like SARAH++ has theoretical guarantees with sublinear convergence for general convex and linear convergence for strongly convex problems as proved in . Because of these theoretical guarantees (which SARAH+ does not have), SARAH itself may already perform well for convex problems and the question is whether SARAH++ offers an advantage.
where is the training data and the regularization parameter is set to , a widely-used value in literature . The condition number is equal to . We conducted experiments to demonstrate the advantage in performance of SARAH++ over SARAH for convex problems on popular data sets including covtype ( training data; estimated ) and ijcnn1 ( training data; estimated ) from LIBSVM .
Figure 1 shows comparisons between SARAH++ and SARAH for different values of learning rate . We depicted the value of (i.e. in log scale) for the -axis and “number of effective passes” (or number of epochs, where an epoch is the equivalent of component gradient evaluations or one full gradient computation) for the -axis. For SARAH, we choose the outer loop size and tune the inner loop size to achieve the best performance. The optimal solution of the strongly convex problem in (13) is found by using Gradient Descent with stopping criterion . We observe that, SARAH++ achieves improved overall performance compared to regular SARAH as shown in Figure 1. From the experiments we see that the stopping criteria () of SARAH++ is indeed important. The stopping criteria helps the inner loop to prevent updating tiny redundant steps.
3 SARAH Adaptive: A New Practical Variant
We now propose a practical adaptive method which aims to improve performance. Although we do not have any theoretical result for this adaptive method, numerical experiments are very promising and they heuristically show the improved performance on different data sets.
We have conducted numerical experiments on the same datasets and problems as introduced in the previous subsection. Figures 2 and 3 show the comparison between SARAH Adaptive and SARAH and SARAH++ for different values of . We observe that SARAH Adaptive has an improved performance over SARAH and SARAH++ (without tuning learning rate). We also present the numerical performance of SARAH Adaptive for different values of in Appendix. We also present the numerical performance of SARAH Adaptive for different values of in Appendix.
We note that additional experiments in this section on more data sets are performed in Appendix.
References
Appendix
Useful Existing Results
Consider defined by (2) (or (8)) in SARAH (Algorithm 1) for any . Then for any ,
Suppose that Assumptions 2 and 4 hold. Consider defined as (2) in SARAH (Algorithm 1) with for any . Then we have that for any ,
Nonconvex SARAH
Lemma 1. Suppose that Assumption 1 holds. Consider SARAH (Algorithm 1) within a single outer loop with . Then, for any , we have
We use some parts of the proof in . By Assumption 1 and , for any , we have
Now, we would like to determine such that the expression in (17)
Let be the -algebra generated by . Note that also contains all information of . We have
Taking the expectations to both sides yields
Note that . Hence, by summing over (), we have
By choosing , we have
since is a root of equation . Therefore, with , we have
Proof of Corollary 1
Corollary 1. Suppose that Assumption 1 holds. Consider SARAH (Algorithm 1) with where is the inner loop size. Then, in order to achieve -accurate solution, the total complexity is .
since . Therefore, the total complexity to achieve -accurate solution is
Proof of Theorem 2
Theorem 2 (Smooth nonconvex with mini-batch). Suppose that Assumption 1 holds. Consider SARAH (Algorithm 1) by replacing in the inner loop size by (8) with
where is any lower bound of , and is the -th iteration in the -th outer loop.
Following the proof of Lemma 1, we would like to determine such that the expression in (17)
Let be the -algebra generated by ; . Note that also contains all the information of as well as . We have
Note that . Hence, by summing over (), we have
By choosing , we have
since is a root of equation .
Therefore, with , we have
where is any lower bound of , and is the -th iteration in the -th outer loop. ∎
Proof of Corollary 3
Corollary 3. For the conditions in Theorem 2, in order to achieve an -accurate solution, the total complexity is
In order to achieve the -accurate solution, we need
since . Therefore, the total complexity is
Proof of Corollary 4
Corollary 4. For the conditions in Theorem 2 and Corollary 3 with and where with and , in order to achieve an -accurate solution, the total complexity is
Let , , and , we have
In order to minimize the order of , we need to choose , which is equivalent to with . The best option is to choose with and in order to achieve .
In order to minimize the order of , we need to choose , which is equivalent to with . The best option is to choose and in order to achieve .
Therefore, with and where with and , we have
By Corollary 3 with , it implies the total complexity
Convex SARAH++
Lemma 2. Suppose that Assumptions 2 and 4 holds. Consider SARAH (Algorithm 1) within a single outer loop with . Then, for and any , we have
where is any optimal solution of .
By using (16) and adding for both sides, where , we have
Proof of Theorem 3
Theorem 3 (Smooth general convex). Suppose that Assumptions 2 and 4 holds. Consider SARAH++ (Algorithm 3) with , . Then, the expectation of the average of squared norm of gradient of all iterations generated by SARAH++
We recall the following definitions. is the stopping time (a random variable) of the -th outer iteration such that
and is the stopping time of the outer iterations (a random variable) and such that for some
Note that is the first time such that . Hence, for a given , we have , for , and
where the last inequality follows since . Hence, by taking the expectation to both sides, we could have
Therefore, we achieve the desired result since the LHS is the expectation of the average of squared norm of gradient of all iterations generated by SARAH++ (Algorithm 3). ∎
Proof of Corollary 5
Corollary 5 (Smooth general convex). Consider the conditions in Theorem 3 with . Then we could achieve the -accurate solution after total iterations.
Proof of Theorem 4
Theorem 4 (Smooth strongly convex). Suppose that Assumptions 2, 3 and 4 holds. Consider SARAH++ (Algorithm 3) with , . Then, for the final output of SARAH++, we have
Following the beginning part of the proof of Theorem 3, we have, for a given ,
where the last inequality follows since . Hence, by taking the expectation to both sides, we could have
Proof of Corollary 6
Note that: , . We can have
By choosing , we have . ∎
Additional Experiments
We provide more experiments in this section on popular data sets with diverse size including covtype ( training data; estimated ), ijcnn1 ( training data; estimated ), w8a ( training data, estimated ) and phishing ( training data, estimated ) from LIBSVM.
Additional experiments in Section 3.3
Sensitivity of γ𝛾\gamma for SARAH Adaptive
In Figure 7 we present the numerical performance of SARAH Adaptive for different values of on covtype, ijcnn1, w8a, and phishing data sets.