Stop Wasting My Gradients: Practical SVRG

Reza Babanezhad, Mohamed Osama Ahmed, Alim Virani, Mark Schmidt, Jakub Konečný, Scott Sallinen

Introduction

We consider the problem of optimizing the average of a finite but large sum of smooth functions,

A huge proportion of the model-fitting procedures in machine learning can be mapped to this problem. This includes classic models like least squares and logistic regression but also includes more advanced methods like conditional random fields and deep neural network models. In the high-dimensional setting (large dd), the traditional approaches for solving (1) are: full gradient (FG) methods which have linear convergence rates but need to evaluate the gradient fif_{i} for all nn examples on every iteration, and stochastic gradient (SG) methods which make rapid initial progress as they only use a single gradient on each iteration but ultimately have slower sublinear convergence rates.

Le Roux et al. proposed the first general method, stochastic average gradient (SAG), that only considers one training example on each iteration but still achieves a linear convergence rate. Other methods have subsequently been shown to have this property , but these all require storing a previous evaluation of the gradient fi′f_{i}^{\prime} or the dual variables for each ii. For many objectives this only requires O(n)O(n) space, but for general problems this requires O(np)O(np) space making them impractical.

Recently, several methods have been proposed with similar convergence rates to SAG but without the memory requirements . They are known as mixed gradient, stochastic variance-reduced gradient (SVRG), and semi-stochastic gradient methods (we will use SVRG). We give a canonical SVRG algorithm in the next section, but the salient features of these methods are that they evaluate two gradients on each iteration and occasionally must compute the gradient on all examples. SVRG methods often dramatically outperform classic FG and SG methods, but these extra evaluations mean that SVRG is slower than SG methods in the important early iterations. They also mean that SVRG methods are typically slower than memory-based methods like SAG.

In this work we first show that SVRG is robust to inexact calculation of the full gradients it requires (§3), provided the accuracy increases over time. We use this to explore growing-batch strategies that require fewer gradient evaluations when far from the solution, and we propose a mixed SG/SVRG method that may improve performance in the early iterations (§4). We next explore using support vectors to reduce the number of gradients required when close to the solution (§5), give a justification for the regularized SVRG update that is commonly used in practice (§6), consider alternative mini-batch strategies (§7), and finally consider the generalization error of the method (§8).

Notation and SVRG Algorithm

SVRG assumes ff is μ\mu-strongly convex, each fif_{i} is convex, and each gradient fi′f_{i}^{\prime} is Lipschitz-continuous with constant LL. The method begins with an initial estimate x0x^{0}, sets x0=x0x_{0}=x^{0} and then generates a sequence of iterates xtx_{t} using

where η\eta is the positive step size, we set μs=f′(xs)\mu^{s}=f^{\prime}(x^{s}), and iti_{t} is chosen uniformly from {1,2,…,n}\{1,2,\dots,n\}. After every mm steps, we set xs+1=xtx^{s+1}=x_{t} for a random t∈{1,…,m}t\in\{1,\dots,m\}, and we reset t=0t=0 with x0=xs+1x_{0}=x^{s+1}.

To analyze the convergence rate of SVRG, we will find it convenient to define the function

as it appears repeatedly in our results. We will use ρ(a)\rho(a) to indicate the value of ρ(a,b)\rho(a,b) when a=ba=b, and we will simply use ρ\rho for the special case when a=b=La=b=L. Johnson & Zhang show that if η\eta and mm are chosen such that 0<ρ<10<\rho<1, the algorithm achieves a linear convergence rate of the form

where x∗x^{*} is the optimal solution. This convergence rate is very fast for appropriate η\eta and mm. While this result relies on constants we may not know in general, practical choices with good empirical performance include setting m=nm=n, η=1/L\eta=1/L, and using xs+1=xmx^{s+1}=x_{m} rather than a random iterate.

Unfortunately, the SVRG algorithm requires 2m+n2m+n gradient evaluations for every mm iterations of (2), since updating xtx_{t} requires two gradient evaluations and computing μs\mu^{s} require nn gradient evaluations. We can reduce this to m+nm+n if we store the gradients fi′(xs)f_{i}^{\prime}(x^{s}), but this is not practical in most applications. Thus, SVRG requires many more gradient evaluations than classic SG iterations of memory-based methods like SAG.

SVRG with Error

We first give a result for the SVRG method where we assume that μs\mu^{s} is equal to f′(xs)f^{\prime}(x^{s}) up to some error ese^{s}. This is in the spirit of the analysis of , who analyze FG methods under similar assumptions. We assume that ∥xt−x∗∥≤Z\|x_{t}-x^{*}\|\leq Z for all tt, which has been used in related work and is reasonable because of the coercity implied by strong-convexity.

If μs=f′(xs)+es\mu^{s}=f^{\prime}(x^{s})+e^{s} and we set η\eta and mm so that ρ<1\rho<1, then the SVRG algorithm (2) with xs+1x^{s+1} chosen randomly from {x1,x2,…,xm}\{x_{1},x_{2},\dots,x_{m}\} satisfies

Xiao & Zhang show that non-uniform sampling (NUS) improves the performance of SVRG. They assume each fi′f_{i}^{\prime} is LiL_{i}-Lipschitz continuous, and sample it=ii_{t}=i with probability Li/nLˉL_{i}/n\bar{L} where Lˉ=1n∑i=1nLi\bar{L}=\frac{1}{n}\sum_{i=1}^{n}L_{i}. The iteration is then changed to

which maintains that the search direction is unbiased. In Appendix A, we show that if μs\mu^{s} is computed with error for this algorithm and if we set η\eta and mm so that 0<ρ(Lˉ)<10<\rho(\bar{L})<1, then we have a convergence rate of

which can be faster since the average Lˉ\bar{L} may be much smaller than the maximum value LL.

2 SVRG with Batching

There are many ways we could allow an error in the calculation of μs\mu^{s} to speed up the algorithm. For example, if evaluating each fi′f_{i}^{\prime} involves solving an optimization problem, then we could solve this optimization problem inexactly. For example, if we are fitting a graphical model with an iterative approximate inference method, we can terminate the iterations early to save time.

When the fif_{i} are simple but nn is large, a natural way to approximate μs\mu^{s} is with a subset (or ‘batch’) of training examples Bs\mathcal{B}^{s} (chosen without replacement),

The batch size ∣Bs∣|\mathcal{B}^{s}| controls the error in the approximation, and we can drive the error to zero by increasing it to nn. Existing SVRG methods correspond to the special case where ∣Bs∣=n|\mathcal{B}^{s}|=n for all ss.

Algorithm 1 gives pseudo-code for an SVRG implementation that uses this sub-sampling strategy. If we assume that the sample variance of the norms of the gradients is bounded by S2S^{2} for all xsx^{s},

If the batch size satisfies the above condition then

and the convergence rate of SVRG is unchanged compared to using the full batch on all iterations.

Mixed SG and SVRG Method

An approximate μs\mu^{s} can drastically reduce the computational cost of the SVRG algorithm, but does not affect the 22 in the 2m+n2m+n gradients required for mm SVRG iterations. This factor of 22 is significant in the early iterations, since this is when stochastic methods make the most progress and when we typically see the largest reduction in the test error.

To reduce this factor, we can consider a mixed strategy: if iti_{t} is in the batch Bs\mathcal{B}^{s} then perform an SVRG iteration, but if iti_{t} is not in the current batch then use a classic SG iteration. We illustrate this modification in Algorithm 2. This modification allows the algorithm to take advantage of the rapid initial progress of SG, since it predominantly uses SG iterations when far from the solution. Below we give a convergence rate for this mixed strategy.

We give the proof in Appendix B. The extra term depending on the variance σ2\sigma^{2} is typically the bottleneck for SG methods. Classic SG methods require the step-size η\eta to converge to zero because of this term. However, the mixed SG/SVRG method can keep the fast progress from using a constant η\eta since the term depending on σ2\sigma^{2} converges to zero as α\alpha converges to one. Since α<1\alpha<1 implies that ρ(L,αL)<ρ\rho(L,\alpha L)<\rho, this result implies that when [f(xs)−f(x∗)][f(x^{s})-f(x^{*})] is large compared to ese^{s} and σ2\sigma^{2} that the mixed SG/SVRG method actually converges faster.

Sharing a single step size η\eta between the SG and SVRG iterations in Proposition 2 is sub-optimal. For example, if xx is close to x∗x^{*} and ∣Bs∣≈n|\mathcal{B}^{s}|\approx n, then the SG iteration might actually take us far away from the minimizer. Thus, we may want to use a decreasing sequence of step sizes for the SG iterations. In Appendix B, we show that using η=O∗((n−∣B∣)/n∣B∣)\eta=O^{*}(\sqrt{(n-|\mathcal{B}|)/n|\mathcal{B}|}) for the SG iterations can improve the dependence on the error ese^{s} and variance σ2\sigma^{2}.

Using Support Vectors

Using a batch Bs\mathcal{B}^{s} decreases the number of gradient evaluations required when SVRG is far from the solution, but its benefit diminishes over time. However, for certain objectives we can further reduce the number of gradient evaluations by identifying support vectors. For example, consider minimizing the Huberized hinge loss (HSVM) with threshold ϵ\epsilon ,

In terms of (1), we have fi(x)=f(biaiTx)f_{i}(x)=f(b_{i}a_{i}^{T}x). The performance of this loss function is similar to logistic regression and the hinge loss, but it has the appealing properties of both: it is differentiable like logistic regression meaning we can apply methods like SVRG, but it has support vectors like the hinge loss meaning that many examples will have fi(x∗)=0f_{i}(x^{*})=0 and fi′(x∗)=0f_{i}^{\prime}(x^{*})=0. We can also construct Huberized variants of many non-smooth losses for regression and multi-class classification.

If we knew the support vectors where fi(x∗)>0f_{i}(x^{*})>0, we could solve the problem faster by ignoring the non-support vectors. For example, if there are 100000100000 training examples but only 100100 support vectors in the optimal solution, we could solve the problem 10001000 times faster. While we typically don’t know the support vectors, in this section we outline a heuristic that gives large practical improvements by trying to identify them as the algorithm runs.

Our heuristic has two components. The first component is maintaining the list of non-support vectors at xsx^{s}. Specifically, we maintain a list of examples ii where fi′(xs)=0f_{i}^{\prime}(x^{s})=0. When SVRG picks an example iti_{t} that is part of this list, we know that fit′(xs)=0f_{i_{t}}^{\prime}(x^{s})=0 and thus the iteration only needs one gradient evaluation. This modification is not a heuristic, in that it still applies the exact SVRG algorithm. However, at best it can only cut the runtime in half.

The heuristic part of our strategy is to skip fi′(xs)f_{i}^{\prime}(x^{s}) or fi′(xt)f_{i}^{\prime}(x_{t}) if our evaluation of fi′f_{i}^{\prime} has been zero more than two consecutive times (and skipping it an exponentially larger number of times each time it remains zero). Specifically, for each example ii we maintain two variables, skisk_{i} (for ‘skip’) and psips_{i} (for ‘pass’). Whenever we need to evaluate fi′f_{i}^{\prime} for some xsx^{s} or xtx_{t}, we run Algorithm 3 which may skip the evaluation. This strategy can lead to huge computational savings in later iterations if there are few support vectors, since many iterations will require no gradient evaluations.

Identifying support vectors to speed up computation has long been an important part of SVM solvers, and is related to the classic shrinking heuristic . While it has previously been explored in the context of dual coordinate ascent methods , this is the first work exploring it for linearly-convergent stochastic gradient methods.

Regularized SVRG

We are often interested in the special case where problem (1) has the decomposition

A common choice of hh is a scaled 11-norm of the parameter vector, h(x)=λ∥x∥1h(x)=\lambda\|x\|_{1}. This non-smooth regularizer encourages sparsity in the parameter vector, and can be addressed with the proximal-SVRG method of Xiao & Zhang . Alternately, if we want an explicit ZZ we could set hh to the indicator function for a 22-norm ball containing x∗x^{*}. In Appendix C, we give a variant of Proposition 1 that allows errors in the proximal-SVRG method for non-smooth/constrained settings like this.

where μs=1n∑i=1ngi(xs)\mu^{s}=\frac{1}{n}\sum_{i=1}^{n}g_{i}(x^{s}). That is, they take an exact gradient step with respect to the regularizer and an SVRG step with respect to the gig_{i} functions. When the gi′g_{i}^{\prime} are sparse, this form of the update allows us to implement the iteration without needing full-vector operations. A related update is used by Le Roux et al. to avoid full-vector operations in the SAG algorithm [1, §4]. In Appendix C, we prove the below convergence rate for this update.

Consider instances of problem (1) that can be written in the form (4) where h′h^{\prime} is LhL_{h}-Lipschitz continuous and each gi′g_{i}^{\prime} is LgL_{g}-Lipschitz continuous, and assume that we set η\eta and mm so that 0<ρ(Lm)<10<\rho(L_{m})<1 with Lm=max⁡{Lg,Lh}L_{m}=\max\{L_{g},L_{h}\}. Then the regularized SVRG iteration (5) has

Mini-Batching Strategies

Konečný et al. have also recently considered using batches of data within SVRG. They consider using ‘mini-batches’ in the inner iteration (the update of xtx_{t}) to decrease the variance of the method, but still use full passes through the data to compute μs\mu^{s}. This prior work is thus complimentary to the current work (in practice, both strategies can be used to improve performance). In Appendix D we show that sampling the inner mini-batch proportional to LiL_{i} achieves a convergence rate of

where MM is the size of the mini-batch while

and we assume 0<ρM<10<\rho_{M}<1. This generalizes the standard rate of SVRG and improves on the result of Konečný et al. in the smooth case. This rate can be faster than the rate of the standard SVRG method at the cost of a more expensive iteration, and may be clearly advantageous in settings where parallel computation allows us to compute several gradients simultaneously.

The regularized SVRG form (5) suggests an alternate mini-batch strategy for problem (1): consider a mini-batch that contains a ‘fixed’ set Bf\mathcal{B}_{f} and a ‘random’ set Bt\mathcal{B}_{t}. Without loss of generality, assume that we sort the fif_{i} based on their LiL_{i} values so that L1≥L2≥⋯≥LnL_{1}\geq L_{2}\geq\dots\geq L_{n}. For the fixed Bf\mathcal{B}_{f} we will always choose the MfM_{f} values with the largest LiL_{i}, Bf={f1,f2,…,fMf}\mathcal{B}_{f}=\{f_{1},f_{2},\dots,f_{M_{f}}\}. In contrast, we choose the members of the random set Bt\mathcal{B}_{t} by sampling from Br={fMf+1,…,fn}B_{r}=\{f_{M_{f}+1},\dots,f_{n}\} proportional to their Lipschitz constants, pi=Li(Mr)Lˉrp_{i}=\frac{L_{i}}{(M_{r})\bar{L}_{r}} with Lˉr=(1/Mr)∑i=Mf+1nLi\bar{L}_{r}=(1/M_{r})\sum_{i=M_{f}+1}^{n}L_{i}. In Appendix D, we show the following convergence rate for this strategy:

Let g(x)=(1/n)∑i∉[Bf]fi(x)g(x)=(1/n)\sum_{i\notin[\mathcal{B}_{f}]}f_{i}(x) and h(x)=(1/n)∑i∈[Bf]fi(x)h(x)=(1/n)\sum_{i\in[\mathcal{B}_{f}]}f_{i}(x). If we replace the SVRG update with

where ζ=(n−Mf)Lˉr(M−Mf)n\zeta=\frac{(n-M_{f})\bar{L}_{r}}{(M-M_{f})n} and κ=max⁡{L1n,ζ}\kappa=\max\{\frac{L_{1}}{n},\zeta\}.

If L1≤nLˉ/ML_{1}\leq n\bar{L}/M and Mf<(α−1)nMαn−MM_{f}<\frac{(\alpha-1)nM}{\alpha n-M} with α=LˉLˉr\alpha=\frac{\bar{L}}{\bar{L}_{r}}, then we get a faster convergence rate than SVRG with a mini-batch of size MM. The scenario where this rate is slower than the existing mini-batch SVRG strategy is when L1≤nLˉ/ML_{1}\leq n\bar{L}/M. But we could relax this assumption by dividing each element of the fixed set Bf\mathcal{B}_{f} into two functions: βfi\beta f_{i} and (1−β)fi(1-\beta)f_{i}, where β=1/M\beta=1/M, then replacing each function fif_{i} in Bf\mathcal{B}_{f} with βfi\beta f_{i} and adding (1−β)fi(1-\beta)f_{i} to the random set BrB_{r}. This result may be relevant if we have access to a field-programmable gate array (FPGA) or graphical processing unit (GPU) that can compute the gradient for a fixed subset of the examples very efficiently. However, our experiments (Appendix F) indicate this strategy only gives marginal gains.

In Appendix F, we also consider constructing mini-batches by sampling proportional to fi(xs)f_{i}(x^{s}) or ∥fi′(xs)∥\|f_{i}^{\prime}(x^{s})\|. These seemed to work as well as Lipschitz sampling on all but one of the datasets in our experiments, and this strategy is appealing because we have access to these values while we may not know the LiL_{i} values. However, these strategies diverged on one of the datasets.

Learning efficiency

In this section we compare the performance of SVRG as a large-scale learning algorithm compared to FG and SG methods. Following Bottou & Bousquet , we can formulate the generalization error E\mathcal{E} of a learning algorithm as the sum of three terms

where the approximation error Eapp\mathcal{E}_{\text{app}} measures the effect of using a limited class of models, the estimation error Eest\mathcal{E}_{\text{est}} measures the effect of using a finite training set, and the optimization error Eopt\mathcal{E}_{\text{opt}} measures the effect of inexactly solving problem (1). Bottou & Bousquet study asymptotic performance of various algorithms for a fixed approximation error and under certain conditions on the distribution of the data depending on parameters α\alpha or ν\nu. In Appendix E, we discuss how SVRG can be analyzed in their framework. The table below includes SVRG among their results.

In this table, the condition number is κ=L/μ\kappa=L/\mu. In this setting, linearly-convergent stochastic gradient methods can obtain better bounds for ill-conditioned problems, with a better dependence on the dimension and without depending on the noise variance ν\nu.

Experimental Results

We plot the experimental results for one run of the algorithms on one dataset in Figure 1, while Appendix F reports results on the other 88 datasets over 1010 different runs. In our results, the growing batch strategy (Grow) always had better test error performance than using the full batch, while for large datasets it also performed substantially better in terms of the training objective. In contrast, the Mixed strategy sometimes helped performance and sometimes hurt performance. Utilizing support vectors often improved the training objective, often by large margins, but its effect on the test objective was smaller.

Discussion

As SVRG is the only memory-free method among the new stochastic linearly-convergent methods, it represents the natural method to use for a huge variety of machine learning problems. In this work we show that the convergence rate of the SVRG algorithm can be preserved even under an inexact approximation to the full gradient. We also showed that using mini-batches to approximate μs\mu^{s} gives a natural way to do this, explored the use of support vectors to further reduce the number of gradient evaluations, gave an analysis of the regularized SVRG update, and considered several new mini-batch strategies. Our theoretical and experimental results indicate that many of these simple modifications should be considered in any practical implementation of SVRG.

Acknowledgements

We would like to thank the reviewers for their helpful comments. This research was supported by the Natural Sciences and Engineering Research Council of Canada (RGPIN 312176-2010, RGPIN 311661-08, RGPIN-06068-2015). Jakub Konečný is supported by a Google European Doctoral Fellowship.

Appendix A Convergence Rate of SVRG with Error

We first give the proof of Proposition 1, which gives a convergence rate for SVRG with an error and uniform sampling. We then turn to the case of non-uniform sampling.

We follow a similar argument to Johnson & Zhang , but propagating the error ese^{s} through the analysis. We begin by deriving a simple bound on the variance of the sub-optimality of the gradients.

Because each fi′f_{i}^{\prime} is LL-Lipschitz continuous, we have [22, Theorem 2.1.5]

Setting y=x∗y=x^{*} and summing this inequality times (1/n)(1/n) over all ii we obtain the result. ∎

By using the inequality ∥x+y∥2≤2∥x∥2+2∥y∥2\|x+y\|^{2}\leq 2\|x\|^{2}+2\|y\|^{2} and the property

The following Lemma gives a bound on the distance to the optimal solution.

In every iteration tt of the inner loop,

The inequality above follows from convexity of ff. The result follows from applying Cauchy-Schwartz to the linear term in ee and that ∥xt−1−x∗∥≤Z\|x_{t-1}-x^{*}\|\leq Z. ∎

To prove Proposition 1 from the main paper, we first sum the inequality in Lemma 3 for all t=1,...,mt=1,...,m and take the expectation with respect to the choice of xsx^{s} to get

where the last inequality uses strong-convexity and that f′(x∗)=0f^{\prime}(x^{*})=0. By dividing both sides by 2η(1−2Lη)m2\eta(1-2L\eta)m (which is positive due to the constraint η≤1/2L\eta\leq 1/2L implied by 0<ρ<10<\rho<1 and η>0\eta>0), we get

A.2 Non-Uniform Sampling

If we sample iti_{t} proportional to the individual Lipschitz constants LiL_{i}, then we have the following analogue of Lemma 1.

Because each fi′f_{i}^{\prime} is LiL_{i}-Lipschitz continuous, we have [22, Theorem 2.1.5]

Setting y=x∗y=x^{*} and summing this inequality times (1/n)(1/n) over all ii we have

With this modified lemma, we can derive the convergence rate under this non-uniform sampling scheme by following an identical sequence of steps but where each instance of LL is replaced by Lˉ\bar{L}.

Appendix B Mixed SVRG and SG Method

We first give the proof of Proposition 2 in the paper, which analyzes a method that mixes SG and SVRG updates using a constant step size. We then consider a variant where the SG and SVRG updates use different step sizes.

Using this in Lemma 3 and following a similar argument we have

where the second inequality uses convexity of ff and we have defined β=(1−α)\beta=(1-\alpha). We now sum up both sides and take the expectation with respect to the history,

and by dividing both sides by 2η(1−2Lη)m2\eta(1-2L\eta)m we get the result.

B.2 Mixed SVRG and SG with Different Step Sizes

Consider a variant where we use a step size of η\eta in the SVRG update and a step-size ηs\eta_{s} in the SG update (which will decrease as the iterations proceed). Analyzing the mixed algorithm in this setting gives

As before, we take the expectation for all tt and sum up these values, then rearranage and use strong-convexity of ff to get

If we now divide both side by 2m(αη(1−2ηL)+βηs)2m(\alpha\eta(1-2\eta L)+\beta\eta_{s}), we get

To improve the dependence on the error ese^{s} and variance σ2\sigma^{2} compared to the basic SVRG algorithm with error ese^{s} (Proposition 1), we require that the terms depending on these values are smaller,

Thus, it is sufficient that ηs\eta_{s} satisfies

Using the relationship between expected error and S2S^{2}, while noting that S2≤σ2S^{2}\leq\sigma^{2} and (n−∣B∣)n∣B∣≤1\frac{(n-|\mathcal{B}|)}{n|\mathcal{B}|}\leq 1, a step size of the form ηs=O∗((n−∣B∣)/n∣B∣)\eta_{s}=O^{*}(\sqrt{(n-|\mathcal{B}|)/n|\mathcal{B}|}) will improve the dependence on ese^{s} and σ2\sigma^{2} compared to the dependence on ese^{s} in the pure SVRG method.

Appendix C Proximal and Regularized SVRG

In this section we consider objectives of the form

where g(x)=1n∑i=1ngi(x)g(x)=\frac{1}{n}\sum_{i=1}^{n}g_{i}(x). We first consider the case where hh is non-smooth and consider a proximal-gradient variant of SVRG where there is an error in the calculation of the gradient (Algorithm 4). We then consider smooth functions hh where we use a modified SVRG iteration,

Similar to the work of , in this section we assume that f,gf,g and hh are μ\mu-, μg\mu_{g}-, μh\mu_{h}-strongly convex (respectively). As before, we assume each gig_{i} is convex and has an LL-Lipschitz continuous gradient, but hh can potentially be non-smooth. The algorithm we propose here extends the algorithm of , but adding an error term. In the algorithm we use the proximal operator which is defined by

Below, we give a convergence rate for this algorithm with an error ese^{s}.

To prove Proposition 5, we use Lemma 1,2 and 3 from , which are unchanged when we allow an error. Below we modify their Corollary 3 and then the proof of their main theorem.

Using Lemma 1 from and bounding the two expectations gives the result. ∎

Following the proof of Theroem 1 in , we have

Combining with the two previous inequalities we get

If we take the expectation with respect to iti_{t} we have

Now by using the Lemma 5 and ∥xˉt−x∗∥<Z\|\bar{x}_{t}-x^{*}\|<Z we have

The rest of the proof follows the argument of , and is simlar to the previous proofs in this appendix. We take the expectation and sum up values, using convexity to give

By dividing both sides to 2η(1−4Lη)m2\eta(1-4L\eta)m, we get the result. ∎

C.2 Proof of Proposition 3

Now using that ∥h′(xs)−h′(x∗)∥2≥0\|h^{\prime}(x^{s})-h^{\prime}(x^{*})\|^{2}\geq 0 and ∥f(x)−f(y)∥2≤2L[f(x)−f(y)−<f′(y),x−y>]\|f(x)-f(y)\|^{2}\leq 2L[f(x)-f(y)-\left<f^{\prime}(y),x-y\right>],

From this point, we follow the standard SVRG argument to obtain

Appendix D Mini-Batch

We first give an analysis of SVRG where mini-batches are selected by sampling propotional to the Lipschitz constants of the gradients. We then consider the mixed deterministic/random sampling scheme described in the main paper.

Here we consider using a ‘mini-batch’ of examples in the inner SVRG loop. We use MM to denote the batch size, and we assume that the elements of the mini-batch are sampled with a probability of pi=Li/nLˉp_{i}=L_{i}/n\bar{L}. This gives a search direction and inner iteration of:

It follows from the definition of pip_{i} that

D.2 Proof of Proposition 4

We now consider the case where we have g(x)=(1/n)∑i∉[Bf]fi(x)g(x)=(1/n)\sum_{i\notin[\mathcal{B}_{f}]}f_{i}(x) and h(x)=(1/n)∑i∈[Bf]fi(x)h(x)=(1/n)\sum_{i\in[\mathcal{B}_{f}]}f_{i}(x) for some batch Bf\mathcal{B}_{f}. We assume that we sample MrM_{r} elements of gg with probability of pi=Li(n−Mf)Lˉrp_{i}=\frac{L_{i}}{(n-M_{f})\bar{L}_{r}} and that we use:

where the inequality uses ∥a+b∥2≤2∥a∥2+2∥b∥2\|a+b\|^{2}\leq 2\|a\|^{2}+2\|b\|^{2}. Now we bound each of the above terms separately,

Now following the proof technique we used several times, we can show that:

where ζ=(n−Mf)Lˉr(M−Mf)n\zeta=\frac{(n-M_{f})\bar{L}_{r}}{(M-M_{f})n} and κ=max⁡{L1n,ζ}\kappa=\max\{\frac{L_{1}}{n},\zeta\}.

Appendix E Learning efficiency

In this section we closely follow Bottou and Bousquet to discuss the performance of SVRG, and other linearly-convergent stochastic methods, as learning algorithms. In the typical supervised learning setting, we are giving nn independently drawn input-output pairs (xi,yi)(x_{i},y_{i}) from some distribution P(x,y)P(x,y) and we seek to minimize the empirical risk,

which tells us how well we do on test data from the same distribution. We use f∗f^{*} to denote the minimizer of the expected risk,

which is the best that a learner can hope to achieve.

Consider a family F\mathcal{F} of possible functions that we use to predict yiy_{i} from xix_{i}. We write the minimizer of the expected risk over this restricted set as fF∗f_{\mathcal{F}}^{*},

while we denote the empirical risk minimizer within this family as fnf_{n},

where the expectation is taken with respect to the output of the algorithm and with respect to the training examples that we sample. This decomposition shows how three intuitive terms affect the sub-optimality:

Eapp\mathcal{E}_{\text{app}} is the approximation error: it measures the effect of restricting attention to the function class F\mathcal{F}.

Eest\mathcal{E}_{\text{est}} is the estimation error: it measures the effect of only using a finite number of samples.

Eopt\mathcal{E}_{\text{opt}} is the optimization error: it measures the effect of inexactly solving the optimization problem.

All other sections of this work focus on the case of finite datasets where we can afford to do several passes through the data (small-scale learning problems in the language of Bottou & Bousquet). In this setting, Eest\mathcal{E}_{\text{est}} is fixed so all we can do to minimize E\mathcal{E} is drive the optimization error ρ\rho as small as possible. In this section we consider the case where we do not have enough time to process all available examples, or we have an infinite number of possible examples (large-scale learning problems in the language of Bottou & Bousquet). In this setting, the time restriction means we need to make a trade-off between the optimization error and the estimation error: should we increase nn in order to decrease the estimation error Eest\mathcal{E}_{\text{est}} or should we revisit examples to try to more quickly decrease the optimization error Eopt\mathcal{E}_{\text{opt}} while keeping the estimation error fixed?

Bottou & Bousquet discuss how under various assumptions we have the variance condition

To make the second and third terms comparable, we can take ρ=(dnlog⁡nd)α\rho=\left(\frac{d}{n}\log\frac{n}{d}\right)^{\alpha}. Then to achieve an accuracy of O(Eapp+ϵ)O(\mathcal{E}_{\text{app}}+\epsilon) it is sufficient to take n=O(dϵ1/αlog⁡(1/ϵ))n=O\left(\frac{d}{\epsilon^{1/\alpha}}\log(1/\epsilon)\right) samples:

The results presented in the main paper follow from noting that (i) the iteration cost of SVRG is O(d)O(d) and (ii) that the number of iterations for SVRG to reach an accuracy of ρ\rho is O((n+κ)log⁡(1/ρ))O((n+\kappa)\log(1/\rho)).

Appendix F Additional Experimental Results

We list properties of the dataset considered in the experiments in Table 1. In Figures 1-4, we plot the performance on the various datasets in terms of both the training objective and test error, showing the maximum/mean/minimum performance across 10 random trials. In these plots, we see a clear advantage for the Grow strategy on the largest datasets (bottom row), but less of an advantage or no advantage on the smaller datasets. The advantage of using support vectors seemed less dependent on the data size, as it helped in some small datasets as well as some large datasets, while in some small/large datasets it did not make a big difference.

In Figures 5-6, we give the result of experiments comparing different mini-batch selection strategies. In particular, we consider mini-batch SVRG with a batch size of 1616 and compare the following methods: uniform sampling of the mini-batch (Uniform), sampling proportional to the Lipschitz constants (Lipschitz), and a third strategy based on Proposition 4 in the main paper (Lipschitz+). On each iteration, the Lipschitz+ strategy constructs the mini-batch using the 100100 examples with the largest Lipschitz constants (the ‘fixed’ set) in addition to 1616 examples sampled according to their Lipschitz constants from among the remaining examples. We assume that the fixed set is computed ‘for free’ by calculating these gradients on a GPU or FPGA. In these experiments, there was often no difference between the various methods because the rows of the data were normalized. For the two Lipschitz sampling strategies, we used a step size of 1/Lˉ1/\bar{L}. In some cases, the new sampling scheme may have given a small improvement, but in general the theoretical advantage of this method was not reflected in our experiments.

In Figure 7-8, we repeat the mini-batch experiment but include two additional method: sampling example ii proportional to fi(xs)f_{i}(x^{s}) (Function) and sampling ii proportional to ∥fi′(xs)∥\|f_{i}^{\prime}(x^{s})\| (Gradient). For these strategies we used a step size of 1/Lˉ1/\bar{L}, and on eight of the nine datasets we were surprised that these strategies had similar performance to the Lipschitz sampling strategy (even though they do not have access to the LiL_{i}). However, both of these strategies had strange behaviour on one of the datasets. On the covertype dataset, the Function method seemed to diverge in terms of training objective and test error while the Gradient seemed to converge to a sub-optimal solution in terms of training objective but achieved close to the optimal test error.

References