Tight Analyses for Non-Smooth Stochastic Gradient Descent
Nicholas J. A. Harvey, Christopher Liaw, Yaniv Plan, Sikander Randhawa
Introduction
Stochastic gradient descent (SGD) is one of the oldest randomized algorithms, dating back to 1951 . It is a very simple and widely used iterative method for minimizing a function. In a nutshell, the method works by querying an oracle for a noisy estimate of a subgradient, then taking a small step in the opposite direction. The simplicity and effectiveness of this algorithm has established it both as an essential tool for applied machine learning , and as a versatile framework for theoretical algorithm design.
In theoretical algorithms, SGD often appears in the guise of coordinate descent, an important special case in which each gradient estimate has a single non-zero coordinate. Some of the fast algorithms for Laplacian linear systems are based on coordinate descent (and the related Kaczmarz method ). Multi-armed Bandits were discovered years ago to be a perfect setting for coordinate descent : the famous Exp3 algorithm combines coordinate descent and the multiplicative weight method. Recent work on the geometric median problem gave a sublinear time algorithm based on SGD, and very recently a new privacy amplification technique has been developed that injects noise to the subgradients while executing SGD. Surveys and monographs discussing gradient descent and aimed at a theoretical CS audience include Bansal and Gupta , Bubeck , Hazan , and Vishnoi .
The efficiency of SGD is usually measured by the rate of decrease of the error — the difference in value between the algorithm’s output and the true minimum. The optimal error rate is known under various assumptions on , the function to be minimized. In addition to convexity, common assumptions are that is smooth (gradient is Lipschitz) or strongly convex (locally lower-bounded by a quadratic). Strongly convex functions often arise due to regularization, whereas smooth functions can sometimes be obtained by smoothening approximations (e.g., convolution). Existing analyses show that, after steps of SGD, the expected error of the final iterate is for smooth functions, and for functions that are both smooth and strongly convex; furthermore, both of these error rates are optimal without further assumptions.
The non-smooth setting is the focus of this paper. In theoretical algorithms and discrete optimization, the convex functions that arise are often non-smooth. For example, the objective for the geometric median problem is a (sum of) 2-norms , so Lipschitz but not smooth. Similarly, formulating the minimum - cut problem as convex minimization , the objective is a 1-norm, so Lipschitz but not smooth. In machine learning, the objective for regularized support vector machines is strongly convex but not smooth.
A trouble with the non-smooth setting is that the error of (even deterministic) gradient descent need not decrease monotonically with , so it is not obvious how to analyze the error of the final iterate. A workaround, known as early as , is to output the average of the iterates. Existing analyses of SGD show that the expected error of the average is for Lipschitz functions , which is optimal, whereas for functions that are also strongly convex the average has error with high probability, which is not the optimal rate. An alternative algorithm, more complicated than SGD, was discovered by Hazan and Kale ; it achieves the optimal expected error rate of . Suffix averaging, a simpler approach in which the last half of the SGD iterates are averaged, was also shown to achieve expected error , although implementations can be tricky or memory intensive if the number of iterations is unknown a priori. Non-uniform averaging schemes with optimal expected error rate and simple implementations are also known , although the solutions may be less interpretable.
Shamir asked the very natural question of whether the final iterate of SGD achieves the optimal rate in the non-smooth scenario, as it does in the smooth scenario. If true, this would yield a very simple, implementable and interpretable form of SGD. Substantial progress on this question was made by Shamir and Zhang , who showed that the final iterate has expected error for Lipschitz , and for strongly convex . Both of these bounds are a factor worse than the optimal rate, so Shamir and Zhang write
An important open question is whether the [expected] rate we obtained on [the last iterate], for strongly-convex problems, is tight. This question is important, because running SGD for iterations, and returning the last iterate, is a very common heuristic. In fact, even for the simpler case of (non-stochastic) gradient descent, we do not know whether the behavior of the last iterate… is tight.
Our work shows that the factor is necessary, both for Lipschitz functions and for strongly convex functions, even for non-stochastic gradient descent. So both of the expected upper bounds due to Shamir and Zhang are actually tight. This resolves the first question of Shamir . In fact, we show a much stronger statement: any convex combination of the last iterates must incur a factor. Thus, suffix averaging must average a constant fraction of the iterates to achieve the optimal rate.
High probability bounds on SGD are somewhat scarce; most of the literature proves bounds in expectation, which is of course easier. A common misconception is that picking the best of several independent trials of SGD would yield high-probability bounds, but this approach is not as efficient as it might seem It is usually the case that selecting the best of many independent trials is very inefficient. Such a scenario, which is very common in uses of SGD, arises if is defined as or . In such scenarios, evaluating exactly could be inefficient, and even estimating it to within error requires samples via a Hoeffding bound, whereas SGD uses only samples. . So it is both interesting and useful that high-probability bounds hold for a single execution of SGD. Some known high-probability bounds for the strongly convex setting include , for uniform averaging, and , which give a suboptimal bound of for suffix averaging (and a variant thereof). In this work, we give two high probability bounds on the error of SGD for strongly convex functions: for suffix averaging and for the final iterate. Both of these are tight. (Interestingly, the former is used as an ingredient for the latter.) The former answers a question of Rakhlin et al. [28, §6], and the latter resolves the second question of Shamir . For Lipschitz functions, we prove a high probability bound of for the final iterate, which is also tight.
Our work can also be seen as extending a line of work on understanding the difference between an average of the iterates or the last iterate of an iterative process. For instance, one of the most important results in game theory is that the multiplicative weights update algorithm converges to an equilibrium , i.e. the set of players are required to play some sort of “coordinated average” of their past strategies. Recently, studied the convergence behaviour of players’ individual strategies and found that the strategies diverge and hence, coordination (i.e. averaging) is needed to obtain an equilibrium. In a similar spirit, our work shows that the iterates of gradient descent have a sub-optimal convergence rate, at least for non-smooth convex functions, and thus, some form of averaging is needed to achieve the optimal rate. It is an interesting direction to see whether or not this is necessary in other iterative methods as well. For instance, the multiplicative weights update algorithm can be used to give an iterative algorithm for maximum flow , or linear programming in general , but also requires some form of averaging. We hope that this paper contributes to a better understanding on when averaging is necessary in iterative processes.
Preliminaries
We say that is -Lipschitz if for all and . For the remainder of this paper, unless otherwise stated, we make the assumption that and ; this is only a normalization assumption and is without loss of generality (see Appendix F). For the sake of simplicity, we also assume that a.s. although our arguments generalize to the setting when are sub-Gaussian (see Appendix F).
Let denote the projection operator on . The (projected) stochastic gradient algorithm is given in Algorithm 1. Notice that there the algorithm maintains a sequence of points and there are several strategies to output a single point. The simplest strategy is to simply output . However, one can also consider averaging all the iterates or averaging only a fraction of the final iterates . Notice that the algorithm also requires the user to specify a sequence of step sizes. The optimal choice of step size is known to be for strongly convex functions , and for Lipschitz functions. For our analyses, we will use a step size of for strongly convex functions and for Lipschitz functions.
Our Contributions
Our main results are bounds on the error of the final iterate of stochastic gradient descent for non-smooth, convex functions.
We prove an lower bound, even in the non-stochastic case, and an upper bound with probability .
Lipschitz functions.
We prove an lower bound, even in the non-stochastic case, and an upper bound with probability .
1 High probability upper bounds
Suppose is -strongly convex and -Lipschitz. Suppose that (i.e., , the noise of the stochastic gradient oracle) has norm at most almost surely. Consider running Algorithm 1 for iterations with step size . Let . Then, with probability at least ,
Suppose is and -Lipschitz and has diameter . Suppose that (i.e., , the noise of the stochastic gradient oracle) has norm at most almost surely. Consider running Algorithm 1 for iterations with step size . Let . Then, with probability at least ,
The assumptions on the strong convexity parameter, Lipschitz parameter, and diameter are without loss of generality; see Appendix F. The bounded noise assumption for the stochastic gradient oracle is made only for simplicity; our analysis can be made to go through if one relaxes the a.s. bounded condition to a sub-Gaussian condition. We also remark that a linear dependence on is necessary for strongly convex functions; see Appendix G.
Our main probabilistic tool to prove Theorem 3.1 and Theorem 3.2 is a new extension of the classic Freedman inequality to a setting in which the martingale exhibits a curious phenomenon. Ordinarily a martingale is roughly bounded by the square root of its total conditional variance (this is the content of Freedman’s inequality). We consider a setting in which the total conditional variance As stated, Theorem 3.3 assumes a conditional sub-Gaussian bound on the martingale difference sequence, whereas Freedman assumes both a conditional variance bound and an almost-sure bound. These assumptions are easily interchangeable in both our proof and Freedman’s proof. For example, Freedman’s inequality with the sub-Gaussian assumption appears in [9, Theorem 2.6]. is itself bounded by (a linear transformation of) the martingale. We refer to this as a “chicken and egg” phenomenon.
Let be a martingale difference sequence. Suppose , are positive and -measurable random variables such that for all . Let and . Let and set . Then
The proof of Theorem 3.3 appears in Appendix C. Freedman’s Inequality (as formulated in [9, Theorem 2.6], up to constants) simply omits the terms highlighted in yellow, i.e., it sets .
2 Lower bounds
More generally, any weighted average of the last iterates has
Thus, suffix averaging must average a constant fraction of iterates to achieve the optimal error.
More generally, any weighted average of the last iterates has
Furthermore, the value of strictly monotonically increases for the first iterations:
In order to incur a factor in the error of the iterate, Theorem 3.4 and Theorem 3.5 constructs a function parameterized by . It is also possible to create a single function , independent of , which incurs the factor for infinitely many . This is described in Remark B.5.
3 High probability upper bound for suffix averaging
Interestingly, our proof of Theorem 3.1 requires understanding the suffix average. (In fact this connection is implicit in ). Hence, en route, we prove the following high probability bound on the error of the average of the last half of the iterates of SGD.
Suppose is -strongly convex and -Lipschitz. Consider running Algorithm 1 for iterations with step size . Let . Then, with probability at least ,
This upper bound is optimal. Indeed, Appendix G shows that the error is even for the one-dimensional function .
Theorem 3.7 is an improvement over the O\big{(}\log(\log(T)/\delta)/T\big{)} bounds independently proven by Rakhlin et al. (for suffix averaging) and Hazan and Kale (for EpochGD). Once again, we defer the statement of the theorem for general strongly-convex and Lipschitz parameters to Appendix F.
Techniques
Final iterate. When analyzing gradient descent, it simplifies matters greatly to consider the expected error. This is because the effect of a gradient step is usually bounded by the subgradient inequality; so by linearity of expectation, one can plug in the expected subgradient, thus eliminating the noise [6, §6.1].
High probability bounds are more difficult. (Indeed, it is not a priori obvious that the error of the final iterate is tightly concentrated.) A high probability analysis must somehow control the total noise that accumulates from each noisy subgradient step. Fortunately, the accumulated noise forms a zero-mean martingale but unfortunately, the martingale depends on previous iterates in a highly nontrivial manner. Indeed, suppose is the martingale of the accumulated noise and let be the conditional variance at time . A significant technical step of our analysis (Lemma 7.4) shows that the total conditional variance (TCV) of the accumulated noise exhibits the “chicken and egg” phenomenon alluded to in the discussion of Theorem 3.3. Roughly speaking, we have where are scalars. Since Freedman’s inequality shows that , an inductive argument gives that . This naive analysis involves invoking Freedman’s inequality times, so a union bound incurs an extra factor in the bound on . This can be improved via a trick : by upper-bounding the TCV by a power-of-two (and by ), it suffices to invoke Freedman’s inequality times, which only incurs an extra factor in the bound on .
Notice that this analysis actually shows that for all , whereas the original goal was only to control . Any analysis that simultaneously controls all , , must necessarily incur an extra factor . This is a consequence of the Law of the Iterated LogarithmLet be uniform and i.i.d. and . The Law of the Iterated Logarithm states that a.s.. Previous work employs exactly such an analysis and incurs the factor. Rakhlin et al. explicitly raise the question of whether this factor is necessary.
Our work circumvents this issue by developing a generalization of Freedman’s Inequality (Theorem 3.3) to handle martingales of the above form, which ultimately yields optimal high-probability bounds. We are no longer hindered by the Law of the Iterated Logarithm because our variant of Freedman’s Inequality does not require us to have fine grained control over the martingale over all times.
Another important tool that we employ is a new bound on the Euclidean distance between the iterates computed by SGD (Lemma 7.3). This is useful because, by the subgradient inequality, the change in the error at different iterations can be bounded using the distance between iterates. Various naive approaches yield a bound of the form (in the strongly convex case). We derive a much stronger bound, comparable to . Naturally, in the stochastic case, there are additional noise terms that contribute to the technical challenge of our analysis. Nevertheless, this new distance bound could be useful in further understanding non-smooth gradient descent (even in the non-stochastic setting).
As in previous work on the strongly convex case , the error of the suffix average plays a critical role in bounding the error of the final iterate. Therefore, we also need a tight high probability bound on the error of the suffix average.
To complete the optimal high probability analysis on the final iterate, we need a high probability bound on the suffix average that avoids the factor. As in the final iterate setting, the accumulated noise for the suffix average forms a zero-mean martingale, , but now the conditional variance at step satisfies , where is a mean-zero random variable and and are constants. In , using Freedman’s Inequality combined with the trick from , they obtain a bound on a similar martingale but do so over all time steps and incur a factor. However, our goal is only to bound and according to Freedman’s Inequality . So, our goal becomes to bound . To do so, we develop a probabilistic tool to bound the iterate of a stochastic process that satisfies a recursive dependence on the iterate similar to the one exhibited by .
Let be a stochastic process and let be a filtration such that is measurable and is non-negative almost surely. Let and for every . Let be a mean-zero random variable conditioned on such that almost surely for every . Suppose that for every . Then, the following hold.
where .
The recursion presents two challenges that make it difficult to analyze. Firstly, the fact that it is a non-linear recurrence makes it unclear how one should unwind . Furthermore, unraveling the recurrence introduces many terms in a non-trivial way. Interestingly, if we instead consider the moment generating function (MGF) of , then we can derive an analogous recursive MGF relationship which removes this non-linear dependence and removes the term. This greatly simplifies the recursion and leads to a surprisingly clean analysis. The proof of Theorem 4.1 can be found in Appendix D. (The recursive MGF bound which removes the non-linear dependence is by Claim D.1.)
Deterministic lower bound.
As mentioned above, a challenge with non-smooth gradient is that the error of the iterate may not monotonically decrease with , even in the deterministic setting. The full extent of this non-decreasing behavior seems not to have been previously understood. We develop a technique that forces the error to be monotonically increasing for consecutive iterations. The idea is as follows. If GD takes a step in a certain direction, a non-differentiable point can allow the function to suddenly increase in that direction. If the function were one-dimensional, the next iteration of GD would then be guaranteed to step in the opposite direction, thereby decreasing the function. However, in higher dimensions, the second gradient step could be nearly orthogonal to the first step, and the function could have yet another non-differentiable point in this second direction. In sufficiently high dimensions, this behavior can be repeated for many iterations. The tricky aspect is designing the function to have this behavior while also being convex. We show that this is possible, leading to the unexpectedly large error in the iteration. We believe that this example illuminates some non-obvious behavior of gradient descent.
Lower bound on error of final iterate, strongly convex case
It is easy to see that is -strongly convex due to the term. Furthermore is -Lipschitz over because and . Finally, the minimum value of over is non-positive because .
In order to execute Algorithm 1 on we must specify a subgradient oracle. First, we require the following claim, which follows from standard facts in convex analysis [16, Theorem 4.4.2].
is the convex hull of , where .
Our subgradient oracle is non-stochastic: given , it simply returns where .
Explicit description of iterates.
We will show inductively that these are precisely the first iterates produced by Algorithm 1 when using the subgradient oracle defined above. The following claim is easy to verify from the definition of .
For , is non-negative. In particular, for and for .
and for . Thus for all .
The “triangular shape” of the vectors allows us to determine the value and subdifferential at .
for all . The subgradient oracle for at returns the vector .
We claim that for all . By definition, is supported on its first coordinates. However, and agree on the first coordinates (for ). This proves the first part of the claim.
Next we claim that for all . This also follows from the definition of and :
These two claims imply that for all , and therefore . Moreover . Thus, when evaluating the subgradient oracle at the vector , it returns the vector . ∎
Since the subgradient returned at is determined by Claim 5.3, and the next iterate of SGD arises from a step in the opposite direction, a straightforward induction proof allows us to show the following lemma. A detailed proof is in Appendix B.1.
For the function constructed in this section, the vector in Algorithm 1 equals , for every .
The value of the final iterate is easy to determine from Lemma 5.4 and Claim 5.3:
(Here the second inequality uses Claim 5.2.) This proves (3.1). A small modification of the last calculation proves (3.2); details may be found in Claim B.1. This completes the proof of Theorem 3.4.
Lower bound on error of final iterate, Lipschitz case
In this section we prove a lower bound result for Lipschitz functions analogous to those in Section 5. Specifically, we define a function , depending on , for which the final iterate produced by Algorithm 1 has , thereby proving (3.3). Throughout this section we will assume that for .
Note that is -Lipschitz over because
Also, the minimum value of over is non-positive because .
In order to execute Algorithm 1 on we must specify a subgradient oracle. Similar to Claim 6.1, [16, Theorem 4.4.2] implies
is the convex hull of , where .
Our subgradient oracle is as follows: given , it simply returns where .
Explicit description of iterates.
We will show inductively that these are precisely the first iterates produced by Algorithm 1 when using the subgradient oracle defined above.
For , is non-negative. In particular, for and for .
By definition, for all . For ,
We have for all , and for , we have
Since Claim 6.2 shows that , we have , and therefore . ∎
The “triangular shape” of the vectors allows us to determine the value and subdifferential at .
for all . The subgradient oracle for at returns the vector .
We claim that for all . By definition, is supported on its first coordinates. However, and agree on the first coordinates (for ). This proves the first part of the claim.
Next we claim that for all . This also follows from the definition of and :
These two claims imply that for all , and therefore . Moreover . Thus, when evaluating the subgradient oracle at the vector , it returns the vector . ∎
Since the subgradient returned at is determined by Claim 6.4, and the next iterate of SGD arises from a step in the opposite direction, a straightforward induction proof allows us to show the following lemma.
For the function constructed in this section, the vector in Algorithm 1 equals , for every .
The proof is by induction. By definition and , establishing the base case.
So assume for ; we will prove that . Recall that Algorithm 1 sets , and that . By the inductive hypothesis, . By Claim 6.4, the algorithm uses the subgradient . Thus,
So . Since by definition, and by Claim 6.3, we have . ∎
The value of the final iterate is easy to determine from Lemma 5.4 and Claim 5.3:
(Here the second inequality uses Claim 6.2.) This proves (3.3). A small modification of the last calculation proves (3.4); details may be found in Claim B.2. The proof of (3.5) may be found in Subsection B.3. This completes the proof of Theorem 3.5.
Upper bound on error of final iterate, strongly convex case
We now turn to the proof of the upper bound on the error of the final iterate of SGD, in the case where is 1-strongly convex and 1-Lipschitz (Theorem 3.1). Recall that the step size used by Algorithm 1 in this case is . We will write , where is the vector returned by the oracle at the point , , and is the noise. Let be the -algebra generated by the first steps of SGD. Finally, recall that and .
We begin with the following lemma which can be inferred from the proof of Theorem 1 in Shamir and Zhang . For completeness, we provide a proof in Appendix E.
Let be 1-strongly convex and 1-Lipschitz. Suppose that we run SGD (Algorithm 1) with step sizes . Then
Lemma 7.1 asserts that the error of the last iterate is upper bounded by the sum of the error of the suffix average and some noise terms (up to the additive term). Thus, it remains to show that the error due to the suffix average is small with high probability (Theorem 3.7) and the noise terms are small. We defer the proof of Theorem 3.7 to Subsection 7.3. By changing the order of summation, we can write where
The main technical difficulty is to show that is small with high probability. Formally, we prove the following lemma, whose proof is outlined in Subsection 7.1.
with probability at least .
Given Theorem 3.7 and Lemma 7.2, the proof of Theorem 3.1 is immediate.
The main technical difficulty in the proof is to understand the noise term, which we have denoted by . Notice that is a sum of a martingale difference sequence. The natural starting point is to better understand the TCV of (i.e. ). We we will see that is bounded by a linear transformation of . This “chicken and egg” relationship inspires us to derive a new probabilistic tool (generalizing Freedman’s Inequality) to disentangle the total conditional variance from the martingale.
The main challenge in analyzing is precisely analyzing the distance between SGD iterates. A loose bound of follows easily from Jensen’s Inequality. We prove the following tighter bound, which may be of independent interest. The proof is in Appendix E.
Suppose is 1-Lipschitz and 1-strongly convex. Suppose we run Algorithm 1 for iterations with step sizes . Let . Then,
Using Lemma 7.3 and some delicate calculations we obtain the following upper bound on , revealing the surprisingly intricate relationship between (the martingale) and (its TCV). This is the main technical step that inspired our probabilistic tool (the generalized Freedman’s Inequality).
There exists positive values , , , such that
This bound is mysterious in that the left-hand side is an upper bound on the total conditional variance of , whereas the right-hand side essentially contains a scaled version of itself. This is the “chicken and egg phenomenon” alluded to in Section 4, and it poses another one of the main challenges of bounding . This bound inspires our main probabilistic tool, which we restate for convenience here.
Theorem 3.3 (Generalized Freedman). Let be a martingale difference sequence. Suppose , are positive and -measurable random variables such that for all . Let and . Let and set . Then
In order to apply Theorem 3.3, we need to refine Lemma 7.4 to replace the terms and with sufficient high probability upper bounds. In , they showed that for all simultaneously, with high probability, so using that would give a slightly suboptimal result. In contrast, our analysis only needs a high probability bound on and ; this allows us to avoid a factor here. Indeed, we have
For all , with probability , and
Let for . Then, w.p. .
The proof of Theorem 7.5, in Subsection 7.2, uses our tool for bounding recursive stochastic processes (Theorem 4.1). Therefore, we need to expose a recursive relationship between and that satisfies the conditions of Theorem 4.1. Interestingly, Theorem 7.5 is also the main ingredient in the analysis of the error of the suffix average (see Subsection 7.3). We now have enough to give our refined version of Lemma 7.4, which is now in a format usable by Freedman’s Inequality.
For every there exists positive values , such that with probability at least .
The lemma essentially follows from combining our bounds in Theorem 7.5 with an easy corollary of Freedman’s Inequality (Corollary C.4) which states that a high probability bound of on the TCV of a martingale implies a high probability bound of on the martingale.
Let , , , and be as in Lemma 7.4, and consider the resulting upper bound on . The first claim in Theorem 7.5 gives because .
By the second claim in Theorem 7.5, we have with probability at least because each . Hence, we have derived a high probability bound on the total conditional variance of . Therefore, we turn this into a high probability bound on the martingale itself by applying Corollary C.4 and obtain with probability at least . ∎
Now that we have derived an upper bound on the total conditional variance of in the form required by our Generalized Freedman Inequality (Theorem 3.3), we are finally ready to prove Lemma 7.2 (our high probability upper bound on the noise, ).
We have demonstrated that satisfies the “Chicken and Egg” phenomenon with high probability. Translating this into a high probability upper bound on the martingale itself is a corollary of Theorem 3.3.
Indeed, consider a filtration . Let define a martingale difference sequence where and . Suppose there are positive values, , , such that and with probability at least . Then, Corollary C.5 bounds the martingale at time step by with high probability.
Observe that Lemma 7.6 allows us to apply Corollary C.5 with , , for , , , and to prove Lemma 7.2. ∎
In this section, we prove Theorem 7.5. We begin with the following claim which can be extracted from .
Suppose is -strongly-convex and -Lipschitz. Define and . Then
This claim exposes a recursive relationship between and and inspires our probabilistic tool for recursive stochastic processes (Theorem 4.1). We prove Theorem 7.5 using this tool:
Consider the stochastic process where is as defined by Claim 7.7. Note that satisfies the conditions of Theorem 4.1 with , , , , and . Observe that is a measurable random variable which is mean zero conditioned on Furthermore, note that with probability 1 because with probability 1. Furthermore, it is easy to check that with the above setup. So, we may apply Theorem 4.1 to obtain:
Recalling that and setting proves Theorem 7.5. ∎
3 Upper Bound on Error of Suffix Averaging
To complete the proof of the final iterate upper bound (Theorem 3.1), it still remains to prove the suffix averaging upper bound (Theorem 3.7). In this section, we prove this result as a corollary of the high probability bounds on that we obtained in the previous subsection.
It suffices to bound the right hand side of (7.2) by with probability at least . Indeed, bounding by 4, (a) in (7.2) is bounded by . Term (b) is bounded by by Theorem 7.5.
It remains to bound (c). Theorem 7.5 implies with probability at least . Therefore, Corollary C.4 shows that (c) is at most with probability at least . ∎
Upper bound on error of final iterate, Lipschitz case: Proof Sketch
In this section we provide a proof sketch of the upper bound of the final iterate of SGD, in the case where is 1-Lipschitz but not necessarily strongly-convex (Theorem 3.2). The proof of Theorem 3.2 closely resembles the proof of Theorem 3.1 and we will highlight the main important differences. Perhaps the most notable difference is that the analysis in the Lipschitz case does not require a high probability bound on .
Recall that the step size used by Algorithm 1 in this case is . We will write , where is the vector returned by the oracle at the point , , and is the noise. Let be the -algebra generated by the first steps of SGD. Finally, recall that and .
As before, we begin with a lemma which can be obtained by modifying the proof of Lemma 7.1 to replace applications of strong convexity with the subgradient inequality.
Let be 1-Lipschitz. Suppose that we run SGD (Algorithm 1) with step sizes . Then,
Lemma 8.1 asserts that the error of the last iterate is bounded by the sum of the error of the average of the iterates and some noise terms (up to the additive term). A standard analysis (similar to the proof of Lemma E.1) reveals . Applying Azuma’s inequality on the summation (using the diameter bound to obtain ) shows
As a consequence of Lemma 8.2, it is enough to prove that the error due to the noise terms are small in order to complete the proof of Theorem 3.2. By changing the order of summation, we can write where
Just as in Section 7, the main technical difficulty is to show that is small with high probability. Formally, we prove the following lemma, whose proof is outlined in Subsection 8.1.
For every , with probability at least .
Given Lemma 8.2 and Lemma 8.3, the proof of Theorem 3.2 is straightforward. The next sub-section provides a proof sketch of Lemma 8.3.
The goal of this section is to prove Lemma 8.3. Just as in Section 7, the main technical difficulty is to understand the noise term, denoted . Observe that is a sum of a martingale difference sequence, and is the TCV of . The TCV of will be shown to exhibit the “chicken and egg” relationship which we have already seen explicitly exhibited by the TCV of the noise terms in the strongly convex case. That is, we will see that the is bounded by a linear transformation of . We will again use our Generalized Freedman to disentangle the total conditional variance from the martingale.
The distance between SGD iterates is again a crucial quantity to understand in order to bound (see Subsection 7.1 to see why). Therefore, we develop a distance estimate analogous to Lemma 7.3
Suppose is 1-Lipschitz. Suppose we run Algorithm 1 for iterations with step sizes . Let . Then,
We then use Lemma 8.4 to prove Lemma 8.5, our main upper bound on . This follows from some delicate calculations similar to those in Appendix E.1, replacing the strongly-convex distance estimate (Lemma 7.3) with the Lipschitz distance estimate (Lemma 8.4), along with some other minor modifications. This upper bound reveals the surprisingly intricate relationship between (the martingale) and (its TCV).
There exists positive values , , and , such that
Just as in Lemma 7.4, the left-hand side is an upper bound on the total conditional variance of , whereas the right-hand side essentially contains a scaled version of itself. This is another instance of the “chicken and egg phenomenon” alluded to in Section 4, and it is the main challenge of bounding . For convenience, we restate our main probabilistic tool which allows us to deal with the chicken and egg phenomenon.
Theorem 3.3 (Generalized Freedman). Let be a martingale difference sequence. Suppose , are positive and -measurable random variables such that for all . Let and . Let and set . Then
In order to apply Theorem 3.3, we need to refine Lemma 8.5 to replace with a sufficient high probability upper bound. This is similar to the refinement of Lemma 7.4 from Subsection 7.1. However, unlike the refinement in Subsection 7.1 (which required a high probability bound on without any diameter bound), the refinement here is quite easy. Using the diameter bound, the almost sure bound of , and Azuma’s inequality, we can bound by with probability at least . This yields the following lemma.
For every , there exists positive values , , such that with probability at least .
Now that we have derived an upper bound on the total conditional variance of in the form required by Generalized Freedman Inequality (Theorem 3.3), we are now finally ready to prove Lemma 8.3 (the high probability upper bound on the noise, ).
We have demonstrated that satisfies the “Chicken and Egg” phenomenon with high probability. Translating this into a high probability upper bound on the martingale itself is a corollary of Theorem 3.3.
Indeed, consider a filtration . Let define a martingale difference sequence where and . Suppose there are positive values, , , such that and with probability at least . Then, Corollary C.5 bounds the martingale at time step by with high probability.
Observe that Lemma 8.6 allows us to apply Corollary C.5 with , , for , , , and to prove Lemma 8.3.
Appendix A Standard results
Let be a random variable and . Then .
Let and be random variables. Then .
Let be random variables and be such that . Then
Let be random variables and be such that for all . Then for all .
Let and observe that . By assumption, if (i.e. ) then . Applying Theorem A.3, we conclude that
Suppose there is such that for all , \operatorname{E}\left[\,\exp\big{(}\lambda^{2}X^{2}\big{)}\,\right]\leq\exp\big{(}\lambda^{2}c^{2}\big{)} for some constant . Then, if is mean zero it holds that
Apply Lemma A.1 to to get . Set and to complete the proof. ∎
For , .
For any , we have .
The function has derivative
This is positive for all and , and so
for all . This implies the claim. ∎
The sum may be upper-bounded by an integral as follows:
Let . Let be such that . Then,
Suppose . Then, .
Let . Then, \sum_{i=a}^{b}\frac{1}{i}\leq\log\big{(}b/(a-1)\big{)}.
Appendix B Omitted proofs for the lower bounds
By definition, . By Claim 5.3, the subgradient returned at is , so Algorithm 1 sets , the first standard basis vector. Then Algorithm 1 projects onto the feasible region, obtaining , which equals since . Since also equals , the base case is proven.
So assume for ; we will prove that . By Claim 5.3, the subgradient returned at is . Then Algorithm 1 sets . Since and , we obtain
So . Since is defined to be the projection onto , and by Claim 5.2, we have . ∎
For any , let be any convex combination of the last iterates. Then
By Lemma 5.4, . By Claim 5.2, every so . Moreover, for all and . Consequently, for all . Thus,
B.2 Lipschitz case
For any , let be any convex combination of the last iterates. Then
By Lemma 6.5, for all . By Claim 6.2, every so . Moreover, for all and , and for all . Consequently, for all and . Thus,
B.3 Monotonicity
The following claim completes the proof of (3.5), under the assumption that .
For any , we have .
B.4 A function independent of T𝑇T
Appendix C Proof of Theorem 3.3 and Corollaries
In this section we prove Theorem 3.3 and derive some corollaries. We restate Theorem 3.3 here for convenience.
Theorem 3.3. Let be a martingale difference sequence. Suppose , are positive and -measurable random variables such that for all . Let and . Let and set . Then
is a supermartingale w.r.t. .
Define the stopping time with the convention that . Since is a supermartingale w.r.t. , is a supermartingale w.r.t. . Hence,
Since was arbitrary, we conclude that
where the inequality is because . Now, we can pick to conclude that
Let and . Then there exists such that .
If or then the claim is trivial (just take ). So assume .
The equality holds if and only if . The discriminant of is . Since , the discriminant of is non-negative so the roots of are real. The smallest root of is located at
Set . Using the numeric inequality valid for all , we have
On the other hand, using the numeric inequality valid for all , we have
In this paper, we often deal with martingales, , where the total conditional variance of the martingale is bounded by a linear transformation of the martingale, with high probability (which is what we often refer to as the “chicken and egg” phenomenon — the bound on the total conditional variance of involves itself). Transforming these entangled high probability bounds on the total conditional variance into high probability bounds on the martingale itself are easy consequences of our Generalized Freedman inequality (Theorem 3.3).
Let be a martingale difference sequence. Let be a measurable random variable such that for all and for all . Define and define . Let and suppose there are positive values , such that . Then,
Fix . Define the following events: , .
where the final inequality is due to applying Theorem 3.3 to . ∎
In this paper, we use Lemma C.3 in the following ways:
Let be a filtration and suppose that are -measurable random variables and are -measurable random variables. Further, suppose that
almost surely and ; and
with probability at least .
Define . Then \sum_{t=1}^{T}d_{t}~{}\leq~{}O\big{(}\sqrt{R}\log(1/\delta)\big{)} with probability at least .
Since , by Cauchy-Schwarz we have that . Therefore, \operatorname{E}\left[\,\exp\big{(}\lambda d_{t}\big{)}\,\mid\,\mathcal{F}_{t-1}\,\right]\leq\exp\big{(}\frac{\lambda^{2}}{2}\left\lVert b_{t}\right\rVert^{2}\big{)} for all by Lemma A.5. Next, applying Lemma C.3 with and , for all , and yields
The last term is at most by taking . ∎
Let be a filtration and suppose that are -measurable random variables and are -measurable random variables. Define . Assume that almost surely and . Furthermore, suppose that there exists positive values and where , such that exactly one of the following holds for every
with probability at least .
with probability at least .
Then \sum_{t=1}^{T}d_{t}~{}\leq~{}O\big{(}\sqrt{R}\log(1/\delta)\big{)} with probability at least .
We prove only the first case, the second case can be proved by bounding by and using the proof of the first case.
Since , by Cauchy-Schwarz we have that . Therefore, \operatorname{E}\left[\,\exp\big{(}\lambda d_{t}\big{)}\,\mid\,\mathcal{F}_{t-1}\,\right]\leq\exp\big{(}\frac{\lambda^{2}}{2}\left\lVert b_{t}\right\rVert^{2}\big{)} for all by Lemma A.5. Next, applying Lemma C.3 with and , with , and yields
The last term is at most by taking because .
Appendix D Proof of Theorem 4.1
Theorem 4.1. Let be a stochastic process and let be a filtration such that is measurable and is non-negative almost surely. Let and for every . Let be a mean-zero random variable conditioned on such that almost surely for every . Suppose that for every . Then, the following hold.
where .
We begin by deriving a recursive MGF bound on .
Suppose . Then for every ,
Observe that because almost surely. Since is -measurable, we have for all . Hence, we may apply Claim A.6 to obtain
For every and for all , .
Let . We proceed by induction over . Assume that . Now, consider the MGF of :
where the first inequality is valid because and the second inequality follows because and so we can use the induction hypothesis since . Furthermore, because we have
which shows that . Hence,
Now we are ready to complete the proof of both claims in Theorem 4.1.The first claim from Theorem 4.1 follows by observing our MGF bound on and then applying the transition from MGF bounds to tail bounds given by Claim A.7.
Next, we prove the second claim from Theorem 4.1. Claim D.2 gives that for every and for all , we have . Hence, we can combine these MGF bounds using Lemma A.4 to obtain for all . With this MGF bound in hand, we may apply the transition from MGF bounds to tail bounds given by Claim A.7 to complete the proof of the second claim from Theorem 4.1. ∎
Appendix E Omitted proofs from Section 7
Let be an 1-strongly convex and 1-Lipschitz function. Consider running Algorithm 1 for iterations. Then, for every and every ,
Let . Apply Lemma E.1, replacing with and to obtain:
Now, divide this by and define to obtain
Observe that . Combining this with the previous inequality yields
Note that and . So we can bound the middle term as
We begin by stating two consequences of strong convexity:
,
(since ).
Recall that because and is 1-Lipschitz. Multiplying through by and bounding by 4 yields the desired result. ∎
Recall from Section 7 that and .
Define .
.
Let . Then
where the first inequality is due to the convexity of and the second inequality is Claim A.12. ∎
Lemma 7.3. Suppose is 1-Lipschitz and 1-strongly convex. Suppose we run Algorithm 1 for iterations with step sizes . Let . Then,
Repeating this argument iteratively on , , …, , we obtain:
Applying the inequality to each term of the second summation gives the desired result. ∎
Using Lemma 7.3 and the bound for all , let us write where
Let us bound each of the terms separately.
\Lambda_{1}\leq O\bigg{(}\frac{\log^{2}(T)}{T^{2}}\bigg{)}.
This follows from some straightforward calculations. Indeed,
We will prove Claim E.5 in the next section.
Rearranging the order of summation in we get:
The previous three claims and the fact that is an upper bound on (Claim E.3) complete the proof of Lemma 7.4. ∎
E.2 Proof of Claim E.5
and determine the coefficients .
For each , \gamma_{a}~{}=~{}O\bigg{(}\frac{\log(T)}{T^{2}}\bigg{)}.
In the definition of , the indices providing a positive coefficient for must satisfy , , and . Hence, the positive contribution to is:
The terms contributing to the negative portion of satisfy, , , and . The negative contribution can be written as
where on the last line we used . Now, combining the positive and negative contribution we see:
Appendix F Generalizations
In this section, we discuss generalizations of our results. In Subsection F.1, we explain that the scaling of the function (e.g., Lipschitzness) can be normalized without loss of generality. In Subsection F.2, we explain how the assumption of almost surely bounded noise can be relaxed to sub-Gaussian noise in our upper bounds (Theorems 3.1, 3.2 and 3.7).
For most of this paper we consider only convex functions that have been appropriately normalized, due to the following facts.
Strongly convex case. The case of an -strongly convex and -Lipschitz function can be reduced to the case of a -strongly convex and -Lipschitz function.
Lipschitz case. The case of an -Lipschitz function on a domain of diameter can be reduced to the case of a -Lipschitz function on a domain of diameter .
We will discuss only the first of these in detail. The second is proven with similar ideas.
The main results from this section are as follows.
Suppose is -strongly convex and -Lipschitz, and that has norm at most almost surely. Consider running Algorithm 1 for iterations with step size . Let . Then, with probability at least ,
Suppose is -strongly convex and -Lipschitz, and that has norm at most almost surely. Consider running Algorithm 1 for iterations with step size . Let . Then, with probability at least ,
We prove these theorems by reduction to Theorem 3.1 and Theorem 3.7, respectively. That is, suppose that is a function that has strong convexity parameter and Lipschitz parameter . We construct a function that is 1-Lipschitz and 1-strongly convex (using Claim F.4) and a subgradient oracle such that running SGD on with this subgradient oracle is equivalent to running SGD on . Formally, we show the following:
the execution of Algorithm 1 on input with initial point , step size and convex set
Now, suppose we are given an -strongly convex and -Lipschitz function, , an initial point and a convex set . We obtain Theorem F.1 and Theorem F.2 by performing the above coupling and executing SGD on the 1-Lipschitz and 1-strongly convex function. We may apply our high probability upper bounds to this execution of SGD because it satisfies the assumptions of Theorem 3.1 and Theorem 3.7. Finally, because of Claim F.3, we can reinterpret the iterates of the execution of SGD on as a scaled version of the iterates of the execution of SGD on . This immediately proves Theorem F.1 and Theorem F.2. Now, let us prove Claim F.3.
The coupling is given by constraining the algorithms to run in parallel and enforcing the execution of SGD on to use a scaled version of the outputs of the subgradient oracle used by the execution of SGD on . That is, at step , if is the output of the subgradient oracle of the execution of SGD on , then we set the output of the subgradient oracle of the execution of SGD on at step to be .
Let be an -strongly convex and -Lipschitz function. Then, is -Lipschitz and -strongly convex.
The inequality holds since is -Lipschitz.
Now we show that is -strongly convex. A function is strongly convex, if and only if the function is convex. Indeed, for :
The function on the right is convex because is -strongly convex. This implies that is convex, meaning that is 1-strongly convex. ∎
F.2 Sub-Gaussian Noise
In this section, we relax the assumption that with probability 1 and instead assume that for each , is sub-Gaussian conditioned on . The proof of the extensions are quite easy, given the current analyses. See the full version of our paper for statements and proofs of this extension.
Most of our analyses can remain unchanged. The main task at hand is identifying the places where we use the upper bound outside of the MGF analyses (using this bound inside an MGF is morally the same using the fact that is sub-Gaussian). The main culprit is that we often bound by 4. Instead we must carry these terms forward and handle them using MGFs. The consequences of this are two-fold. Firstly, this introduces new MGFs to bound, but intuitively these are easy to bound because the terms they were involved in in the original analysis were sufficiently bounded and therefore their MGFs should now also be sufficiently bounded. Furthermore, removing these constant bounds results in many of our MGF expressions to include more random terms which we previously ignored and pulled out of our MGF arguments because they were constant. But again, these terms can be dealt with by first isolating them by applying an MGF triangle inequality (using Hölder or Cauchy-Schwarz) and then bounding their MGF.
Appendix G Necessity of log(1/δ)1𝛿\log(1/\delta)
In this section, we show that the error of the last iterate and suffix average of SGD is with probability at least .
Let be independent random variables taking value uniformly at random and . Then for any ,
Consider the single-variable function and suppose that the domain is . Then is 1-strongly convex and 1-Lipschitz on . Moreover, suppose that the subgradient oracle returns where is or with probability (independently from all previous calls to the oracle). Finally, suppose we run Algorithm 1 with step sizes with an initial point .
If then with probability at least .
We claim that for all where is the random sign returned by the subgradient oracle at iteration . Indeed, for , we have since . Moreover, since . Now, suppose that . Then . Since , we have .
Hence, by Lemma G.1 with , we have with probability at least (provided ). We conclude that with probability at least . ∎
We can also show that Theorem 3.7 is tight. To make the calculations simpler, first assume is a multiple of . We further assume that the noise introduced by the stochastic subgradient oracle is generated as follows. For and , . For , first define . Then we set to be with probability . Note that for so we still have for all .
If then with probability at least .
Proceeding as in the above claim, we have . We claim that
where the last equality uses the assumption that only if and changes the name of the index. Notice that is with probability so we can write Eq. (G.1) as
where are random signs. Applying Lemma G.1 with , we conclude that Eq. (G.1) is at least with probability at least (provided ). So we conclude that with probability at least . ∎