Convergence of Adam Under Relaxed Assumptions
Haochuan Li, Alexander Rakhlin, Ali Jadbabaie
Introduction
In this paper, we study the non-convex unconstrained stochastic optimization problem
The Adaptive Moment Estimation (Adam) algorithm (Kingma and Ba, 2014) has become one of the most popular optimizers for solving (1) when is the loss for training deep neural networks. Owing to its efficiency and robustness to hyper-parameters, it is widely applied or even sometimes the default choice in many machine learning application domains such as natural language processing (Vaswani et al., 2017; Brown et al., 2020; Devlin et al., 2019), generative adversarial networks (Radford et al., 2015; Isola et al., 2016; Zhu et al., 2017), computer vision (Dosovitskiy et al., 2020), and reinforcement learning (Lillicrap et al., 2015; Mnih et al., 2016; Schulman et al., 2017). It is also well known that Adam significantly outperforms stochastic gradient descent (SGD) for certain models like transformer (Zhang et al., 2020b; Kunstner et al., 2023; Ahn et al., 2023).
Despite its success in practice, theoretical analyses of Adam are still limited. The original proof of convergence in (Kingma and Ba, 2014) was later shown by Reddi et al. (2018) to contain gaps. The authors in (Reddi et al., 2018) also showed that for a range of momentum parameters chosen independently with the problem instance, Adam does not necessarily converge even for convex objectives. However, in deep learning practice, the hyper-parameters are in fact problem-dependent as they are usually tuned after given the problem and weight initialization. Recently, there have been many works proving the convergence of Adam for non-convex functions with various assumptions and problem-dependent hyper-parameter choices. However, these results leave significant room for improvement. For example, (D’efossez et al., 2020; Guo et al., 2021) prove the convergence to stationary points assuming the gradients are bounded by a constant, either explicitly or implicitly. On the other hand, (Zhang et al., 2022; Wang et al., 2022) consider weak assumptions, but their convergence results are still limited. See Section 2 for more detailed discussions of related works.
To address the above-mentioned gap between theory and practice, we provide a new convergence analysis of Adam without assuming bounded gradients, or equivalently, Lipschitzness of the objective function. In addition, we also relax the standard global smoothness assumption, i.e., the Lipschitzness of the gradient function, as it is far from being satisfied in deep neural network training. Instead, we consider a more general, relaxed, and non-uniform smoothness condition according to which the local smoothness (i.e., Hessian norm when it exists) around is bounded by a sub-quadratic function of the gradient norm (see Definition 3.2 and Assumption 2 for the details). This generalizes the smoothness condition proposed by (Zhang et al., 2019) based on language model experiments. Even though our assumptions are much weaker and more realistic, we can still obtain the same gradient complexity for convergence to an -stationary point.
The key to our analysis is a new technique to obtain a high probability, constant upper bound on the gradients along the optimization trajectory of Adam, without assuming Lipschitzness of the objective function. In other words, it essentially turns the bounded gradient assumption into a result that can be directly proven. Bounded gradients imply bounded stepsize at each step, with which the analysis of Adam essentially reduces to the simpler analysis of AdaBound (Luo et al., 2019). Furthermore, once the gradient boundedness is achieved, the analysis under the generalized non-uniform smoothness assumption is not much harder than that under the standard smoothness condition. We will introduce the technique in more details in Section 5. We note that the idea of bounding gradient norm along the trajectory of the optimization algorithm can be use in other problems as well. For more details, we refer the reader to our concurrent work (Li et al., 2023) in which we present a set of new techiniques and methods for bounding gradient norm for other optimization algorithms under a generalized smoothness condition.
Another contribution of this paper is to show that the gradient complexity of Adam can be further improved with variance reduction methods. To this end, we propose a variance-reduced version of Adam by modifying its momentum update rule, inspired by the idea of the STORM algorithm (Cutkosky and Orabona, 2019). Under additional generalized smoothness assumption of the component function for each , we show that this provably accelerates the convergence with a gradient complexity of . This rate improves upon the existing result of (Wang and Klabjan, 2022) where the authors obtain an asymptotic convergence of their approach to variance reduction for Adam in the non-convex setting, under the bounded gradient assumption.
In light of the above background, we summarize our main contributions as follows.
We develop a new analysis to show that Adam converges to stationary points under relaxed assumptions. In particular, we do not assume bounded gradients or Lipschitzness of the objective function. Furthermore, we also consider a generalized non-uniform smoothness condition where the local smoothness or Hessian norm is bounded by a sub-quadratic function of the gradient norm. Under these more realistic assumptions, we obtain a dimension free gradient complexity of if the gradient noise is centered and bounded.
We generalize our analysis to the setting where the gradient noise is centered and has sub-Gaussian norm, and show the convergence of Adam with a gradient complexity of .
We propose a variance-reduced version of Adam (VRAdam) with provable convergence guarantees. In particular, we obtain the accelerated gradient complexity.
Related work
In this section, we discuss the relevant literature related to different aspects of our work.
Adam was first proposed by Kingma and Ba (2014) with a theoretical convergence guarantee for convex functions. However, Reddi et al. (2018) found a gap in the proof of this convergence analysis, and also constructed counter-examples for a range of hyper-parameters on which Adam does not converge. That being said, the counter-examples depend on the hyper-parameters of Adam, i.e., they are constructed after picking the hyper-parameters. Therefore, it does not rule out the possibility of obtaining convergence guarantees for problem-dependent hyper-parameters, as also pointed out by (Shi et al., 2021; Zhang et al., 2022).
Many recent works have developed convergence analyses of Adam with various assumptions and hyper-parameter choices. Zhou et al. (2018b) show Adam with certain hyper-parameters can work on the counter-examples of (Reddi et al., 2018). De et al. (2018) prove convergence for general non-convex functions assuming gradients are bounded and the signs of stochastic gradients are the same along the trajectory. The analysis in (D’efossez et al., 2020) also relies on the bounded gradient assumption. Guo et al. (2021) assume the adaptive stepsize is upper and lower bounded by two constants, which is not necessarily satisfied unless assuming bounded gradients or considering the AdaBound variant (Luo et al., 2019). (Zhang et al., 2022; Wang et al., 2022) consider very weak assumptions. However, they show either 1) “convergence” only to some neighborhood of stationary points with a constant radius, unless assuming the strong growth condition; or 2) convergence to stationary points but with a slower rate.
After Reddi et al. (2018) pointed out the non-convergence issue with Adam, various variants of Adam that can be proved to converge were proposed (Zou et al., 2018; Gadat and Gavra, 2022; Chen et al., 2018, 2022; Luo et al., 2019; Zhou et al., 2018b). For example, AMSGrad (Reddi et al., 2018) and AdaFom (Chen et al., 2018) modify the second order momentum so that it is non-decreasing. AdaBound (Luo et al., 2019) explicitly imposes upper and lower bounds on the second order momentum so that the stepsize is also bounded. AdaShift (Zhou et al., 2018b) uses a new estimate of the second order momentum to correct the bias. There are also some works (Zhou et al., 2018a; Gadat and Gavra, 2022; Iiduka, 2023) that provide convergence guarantees of these variants. One closely related work to ours is (Wang and Klabjan, 2022), which considers a variance-reduced version of Adam by combining Adam and SVRG (Johnson and Zhang, 2013). However, they assume bounded gradients and can only get an asymptotic convergence in the non-convex setting.
Generalizing the standard smoothness condition in a variety of settings has been a focus of many recent papers. Recently, (Zhang et al., 2019) proposed a generalized smoothness condition called smoothness, which assumes the local smoothness or Hessian norm is bounded by an affine function of the gradient norm. The assumption was well-validated by extensive experiments conducted on language models. Various analyses of different algorithms under this condition were later developed (Zhang et al., 2020a; Qian et al., 2021; Zhao et al., 2021; Faw et al., 2023; Reisizadeh et al., 2023; Crawshaw et al., 2022). One recent closely-related work is (Wang et al., 2022) which studies converges of Adam under the smoothness condition. However, their results are still limited, as we have mentioned above. In this paper, we consider an even more general smoothness condition where the local smoothness is bounded by a sub-quadratic function of the gradient norm, and prove the convergence of Adam under this condition. In our concurrent work (Li et al., 2023), we further analyze various other algorithms in both convex and non-convex settings under similar generalized smoothness conditions following the same key idea of bounding gradients along the trajectory.
The technique of variance reduction was introduced to accelerate convex optimization in the finite-sum setting (Roux et al., 2012; Johnson and Zhang, 2013; Shalev-Shwartz and Zhang, 2013; Mairal, 2013; Defazio et al., 2014). Later, many works studied variance-reduced methods in the non-convex setting and obtained improved convergence rates for standard smooth functions. For example, SVRG and SCSG improve the gradient complexity of stochastic gradient descent (SGD) to (Allen-Zhu and Hazan, 2016; Reddi et al., 2016; Lei et al., 2017). Many new variance reduction methods (Fang et al., 2018; Tran-Dinh et al., 2019; Liu et al., 2020; Li et al., 2021; Cutkosky and Orabona, 2019; Liu et al., 2023) were later proposed to further improve the complexity to , which is optimal and matches the lower bound in (Arjevani et al., 2023). Recently, (Reisizadeh et al., 2023; Chen et al., 2023) obtained the complexity for the more general smooth functions. Our variance-reduced Adam is motivated by the STORM algorithm proposed by (Cutkosky and Orabona, 2019), where an additional term is added in the momentum update to correct the bias and reduce the variance.
Preliminaries
The formal definition of Adam proposed in (Kingma and Ba, 2014) is shown in Algorithm 1, where Lines 5–9 describe the update rule of iterates . Lines 5–6 are the updates for the first and second order momentum, and , respectively. In Lines 7–8, they are re-scaled to and in order to correct the initialization bias due to setting . Then the iterate is updated by where is the adaptive stepsize vector for some parameters and .
2 Assumptions
In what follows below, we will state our main assumptions for analysis of Adam.
We start with a standard assumption in optimization on the objective function whose domain lies in a Euclidean space with dimension .
Besides Assumption 1, the only additional assumption we make regarding is that its local smoothness is bounded by a sub-quadratic function of the gradient norm. More formally, we consider the following smoothness condition with .
A differentiable real-valued function is smooth for some constants if the following inequality holds almost everywhere in
When , Definition 3.2 reduces to the smoothness condition in (Zhang et al., 2019). When or , it reduces to the standard smoothness condition.
The objective function is smooth with .
The standard smooth function class is very restrictive as it only contains functions that are upper and lower bounded by quadratic functions. The smooth function class is more general since it also contains, e.g., univariate polynomials and exponential functions. Assumption 2 is even more general and contains univariate rational functions, double exponential functions, etc. See Appendix B.1 for the formal propositions and proofs. We also refer the reader to our concurrent work (Li et al., 2023) for more detailed discussions of examples of smooth functions for different s.
It turns out that bounded Hessian norm at a point implies local Lipschitzness of the gradient in the neighborhood around . In particular, we have the following lemma.
Lemma 3.4 can be actually used as the definition of smooth functions in place of Assumption 2. Besides the local gradient Lipschitz condition, it also suggests that, as long as the update at each step is small enough, the iterates will not go outside of the domain.
For the special case of , choosing , one can verify that the required locality size in Lemma 3.4 satisfies . In this case, Lemma 3.4 states that implies Therefore, it reduces to the local gradient Lipschitz condition for smooth functions in (Zhang et al., 2019, 2020a) up to numerical constant factors. For , the proof is more involved because Grönwall’s inequality used in (Zhang et al., 2019, 2020a) no longer applies. Therefore we defer the detailed proof of Lemma 3.4 to Appendix B.2.
2.2 Stochastic gradient
We consider one of the following two assumptions on the stochastic gradient in our analysis of Adam.
The gradient noise is centered and almost surely bounded. In particular, for some and all ,
The gradient noise is centered with sub-Gaussian norm. In particular, for some and all ,
Results
In the section, we provide our convergence results for Adam under Assumptions 1, 2, and 3 or 4. To keep the statements of the theorems concise, we first define several problem-dependent constants. First, we let be the initial sub-optimality gap. Next, given a large enough constant , we define
where can be viewed as the effective smoothness constant along the trajectory if one can show and at each step (see Section 5 for more detailed discussions). We will also use to denote some small enough numerical constants and to denote some large enough ones. The formal convergence results under Assumptions 1, 2, and 3 are presented in the following theorem, whose proof is deferred in Appendix C.
Suppose Assumptions 1, 2, and 3 hold. Denote for any . Let be a constant satisfying . Choose
Let . Then with probability at least , we have for every , and .
Note that , the upper bound of gradients along the trajectory, is a constant that depends on , and the initial sub-optimality gap , but not on . There is no requirement on the second order momentum parameter , although many existing works like (D’efossez et al., 2020; Zhang et al., 2022; Wang et al., 2022) need certain restrictions on it. We choose very small and , both of which are . Therefore, from the choice of , it is clear that we obtain a gradient complexity of , where we only consider the leading term. We are not clear whether the dependence on is optimal or not, as the lower bound in (Arjevani et al., 2023) assumes the weaker bounded variance assumption than our Assumpion 3. However, it matches the state-of-the-art complexity among existing analyses of Adam.
One limitation of the dependence of our complexity on is , which might be large since is usually small in practice, e.g., the default choice is in the PyTorch implementation. There are some existing analyses on Adam (D’efossez et al., 2020; Zhang et al., 2022; Wang et al., 2022) whose rates do not depend explicitly on or only depend on . However, all of them depend on , whereas our rate is dimension free. The dimension is also very large, especially when training transformers, for which Adam is widely used. We believe that independence on is better than that on , because is fixed given the architecture of the neural network but is a hyper-parameter which we have the freedom to tune. In fact, based on our preliminary experimental results on CIFAR-10 shown in Figure 1, the performance of Adam is not very sensitive to the choice of . Although the default choice of is , increasing it up to only makes minor differences.
As discussed in Section 3.2.2, we can generalize the bounded gradient noise condition in Assumption 3 to the weaker sub-Gaussian noise condition in Assumption 4. The following theorem formally shows the convergence result under Assumptions 1, 2, and 4, whose proof is deferred in Appendix C.6.
Suppose Assumptions 1, 2, and 4 hold. Denote and for any . Let be a constant satisfying . Choose
Let . Then with probability at least , we have for every , and .
Note that the main difference of Theorem 4.2 from Theorem 4.1 is that is now instead of a constant. With some standard calculations, one can show that the gradient complexity in Theorem 4.2 is bounded by , where .
Analysis
We want to bound the gradients along the optimization trajectory mainly for two reasons. First, as discussed in Section 2, many existing analyses of Adam rely on the assumption of bounded gradients, because unbounded gradient norm leads to unbounded second order momentum which implies very small stepsize, and slow convergence. On the other hand, once the gradients are bounded, it is straightforward to control as well as the stepsize, and therefore the analysis essentially reduces to the easier one for AdaBound. Second, informally speakingThe statement is informal because here we can only show bounded gradients and Hessians at the iterate points, which only implies local smoothness near the neighborhood of each iterate point (see Section 5.2). However, the standard smoothness condition is a stronger global condition which assumes bounded Hessian at every point within a convex set., under Assumption 2, bounded gradients also imply bounded Hessians, which essentially reduces the smoothness to the standard smoothness. See Section 5.2 for more formal discussions.
In this paper, instead of imposing the strong assumption of globally bounded gradients, we develop a new analysis to show that with high probability, the gradients are always bounded along the trajectory of Adam until convergence. The essential idea can be informally illustrated by the following “circular" reasoning that we will make precise later. On the one hand, if for every , it is not hard to show the gradient converges to zero based on our discussions above. On the other hand, we know that a converging sequence must be upper bounded. Therefore there exists some such that for every . In other words, the bounded gradient condition implies the convergence result and the convergence result also implies the boundedness condition, forming a circular argument.
This circular argument is of course flawed. However, we can break the circularity of reasoning and rigorously prove both the bounded gradient condition and the convergence result using a contradiction argument. Before introducing the contradiction argument, we first need to provide the following useful lemma, which is the reverse direction of a generalized Polyak-Lojasiewicz (PL) inequality, whose proof is deferred in Appendix B.3.
Under Assumptions 1 and 2, we have .
Define the function over . It is easy to verify that if , is increasing and its range is . Therefore, is invertible and is also increasing. Then, for any constant , denoting , Lemma 5.1 suggests that if , we have
In other words, if , the gradient is bounded within any sub-level set, even though the sub-level set could be unbounded. Then, let be the first time the sub-optimality gap is strictly greater than , truncated at , or formally,
Then at least when , we have and thus . Based on our discussions above, it is not hard to analyze the updates before time , and one can contruct some Lyapunov function to obtain an upper bound on . On the other hand, if , we immediately obtain a lower bound on , that is , by the definition of in (3). If the lower bound is greater than the upper bound, it leads to a contradiction, which shows , i.e., the sub-optimality gap and the gradient norm are always bounded by and respectively before the algorithm terminates. We will illustrate the technique in more details in the simple deterministic setting in Section 5.3, but first, in Section 5.2, we introduce several prerequisite lemmas on the smoothness.
2 Local smoothness
In Section 5.1, we informally mentioned that smoothness essentially reduces to the standard smoothness if the gradient is bounded. In this section, we will make the statement more precise. First, note that Lemma 3.4 implies the following useful corollary.
The proof of Corollary 5.2 is deferred in Appendix B.4. Although the inequalities in Corollary 5.2 look very similar to the standard global smoothness condition with constant , it is still a local condition as it requires . Fortunately, at least before , such a requirement is easy to satisfy for small enough , according to the following lemma whose proof is deferred in Appendix C.5.
Under Assumption 3, if and choosing , we have where .
Then as long as , we have which satisfies the requirement in Corollary 5.2. Then we can apply the inequalities in it in the same way as the standard smoothness condition. In other words, most classical inequalities derived for standard smooth functions also apply to smooth functions.
3 Warm-up: analysis in the deterministic setting
In this section, we consider the simpler deterministic setting where the stochastic gradient in Algorithm 1 or (18) is replaced with the exact gradient . As discussed in Section 5.1, the key in our contradiction argument is to obtain both upper and lower bounds on . In the following derivations, we focus on illustrating the main idea of our analysis technique and ignore minor proof details. In addition, all of them are under Assumptions 1, 2, and 3.
In order to obtain the upper bound, we need the following two lemmas. First, denoting , we can obtain the following informal descent lemma for deterministic Adam.
For any , choosing and a small enough ,
where “” omits less important terms.
By the definition of , for all , we have which implies . Then from the update rule (18) in Proposition C.1 provided later in Appendix C, it is easy to verify since is a convex combination of . Let be the stepsize vector and denote . We know
As discussed in Section 5.2, when is small enough, we can apply Corollary 5.2 to obtain
where in the first (approximate) inequality we ignore the second order term in Corollary 5.2 for small enough ; the equality applies the update rule ; in the second inequality we use for any PSD matrix and vectors and ; and the last inequality is due to (5). ∎
Compared with the standard descent lemma for gradient descent, there is an additional term of in Lemma 5.4. In the next lemma, we bound this term recursively.
Choosing , if , we have
By the update rule (18) in Proposition C.1, we have
For small enough , we can apply Corollary 5.2 to get
where the second inequality is due to and ; and the last inequality uses and Young’s inequality . Therefore,
where the first inequality uses (7) and Young’s inequality for any ; the second inequality uses and (8); and in the last inequality we use and choose which implies . ∎
Now we combine them to get the upper bound on . Define the function . Note that for any , (4)(6) gives
The above inequality shows is non-increasing and thus a Lyapunov function. Therefore, we have
where in the last inequality we use since in the deterministic setting.
As discussed in Section 5.1, if , we have . Note that we are able to choose a large enough constant so that is greater than , which leads to a contradiction and shows . Therefore, (9) holds for all . Taking a summation over and re-arranging terms, we get
if choosing , i.e., it shows convergence with a gradient complexity of since both and are constants independent of in the deterministic setting.
4 Extension to the stochastic setting
Fortunately, is in fact a stopping time with nice properties. If the noise is almost surely bounded as in Assumption 3, by a more careful analysis, we can obtain a high probability upper bound on using concentration inequalities. Then we can still obtain a contradiction and convergence under this high probability event. If the noise has sub-Gaussian norm as in Assumption 4, one can change the definition of to
for appropriately chosen and . Then at least when , the noise is bounded by . Hence we can get the same upper bound on as if Assumption 3 still holds. However, when , the lower bound does not necessarily holds, which requires some more careful analyses. The details of the proofs are involved and we defer them in Appendix C.
Variance-reduced Adam
Aside from the adaptive stepsize, one major difference between Algorithm 2 and STORM is that our hyper-parameters and are fixed constants whereas theirs are decreasing as a function of . Choosing constant hyper-parameters requires a more accurate estimate at the initialization. That is why we use a mega-batch to evaluate the gradient at the initial point to initialize and (Lines 2–3). In practice, one can also do a full-batch gradient evaluation at initialization. Note that there is no initialization bias for the momentum, so we do not re-scale and only re-scale . We also want to point out that although the initial mega-batch gradient evaluation makes the algorithm a bit harder to implement, constant hyper-parameters are usually easier to tune and more common in training deep neural networks. It should be not hard to extend our analysis to time-decreasing and and we leave it as an interesting future work.
In addition to Assumption 1, we need to impose the following assumptions which can be viewed as stronger versions of Assumptions 2 and 3, respectively.
The objective function and the component function for each fixed are smooth with .
The random variables are sampled i.i.d. from some distribution such that for any ,
Assumption 6 is stronger than Assumption 3. Assumption 3 applies only to the iterates generated by the algorithm, while Assumption 6 is a pointwise assumption over all and further assumes an i.i.d. nature of the random variables . Also note that, similar to Adam, it is straightforward to generalize the assumption to noise with sub-Gaussian norm as in Assumption 4.
In this part, we briefly discuss challenges in the analysis of VRAdam. The detailed analysis is deferred in Appendix D. Note that Corollary 5.2 requires bounded update at each step. For Adam, it is easy to satisfy for a small enough according to Lemma 5.3. However, for VRAdam, obtaining a good enough almost sure bound on the update is challenging even though the gradient noise is bounded. To bypass this difficulty, we directly impose a bound on by changing the definition of the stopping time , similar to how we deal with the sub-Gaussian noise condition for Adam. In particular, we define
Then by definition, both and are bounded by before time , which directly implies bounded update . Of course, the new definition brings new challenges to lower bounding , which requires more careful analyses specific to the VRAdam algorithm. Please see Appendix D for the details.
2 Convergence guarantees for VRAdam
In the section, we provide our main results for convergence of VRAdam under Assumptions 1, 5, and 6. We consider the same definitions of problem-dependent constants as those in Section 4 to make the statements of theorems concise. Let be a small enough numerical constant and be a large enough numerical constant. The formal convergence result is shown in the following theorem.
Suppose Assumptions 1, 5, and 6 hold. For any , let be a constant satisfying Choose and , where . Choose
Then with probability at least , we have for every , and
Note that the choice of , the upper bound of gradients along the trajectory of VRAdam, is very similar to that in Theorem 4.1 for Adam. The only difference is that now it also depends on the failure probability . Similar to Theorem 4.1, there is no requirement on and we choose a very small . However, the variance reduction technique allows us to take a larger stepsize (compared with for Adam) and obtain an accelerated gradient complexity of , where we only consider the leading term. We are not sure whether it is optimal as the lower bound in (Arjevani et al., 2023) assumes the weaker bounded variance condition. However, our result significantly improves upon (Wang and Klabjan, 2022), which considers a variance-reduced version of Adam by combining Adam and SVRG (Johnson and Zhang, 2013) and only obtains asymptotic convergence in the non-convex setting. Similar to Adam, our gradient complexity for VRAdam is dimension free but its dependence on is . Another limitation is that, the dependence on the failure probability is polynomial, worse than the poly-log dependence in Theorem 4.1 for Adam.
Conclusion and future works
In this paper, we proved the convergence of Adam and its variance-reduced version under less restrictive assumptions compared to those in the existing literature. We considered a generalized non-uniform smoothness condition, according to which the Hessian norm is bounded by a sub-quadratic function of the gradient norm almost everywhere. Instead of assuming the Lipschitzness of the objective function as in existing analyses of Adam, we use a new contradiction argument to prove that gradients are bounded by a constant along the optimization trajectory. There are several interesting future directions that one could pursue following this work.
Our analysis relies on the assumption of bounded noise or noise with sub-Gaussian norm. However, the existing lower bounds in (Arjevani et al., 2023) consider the weaker bounded variance assumption. Hence, it is not clear whether the complexity we obtain for Adam is tight in this setting. It will be interesting to see whether one can relax the assumption to the bounded variance setting. One may gain some insights from recent papers such as (Faw et al., 2022; Wang et al., 2023) that analyze AdaGrad under weak noise conditions. An alternative way to show the tightness of the complexity is to prove a lower bound under the bounded noise assumption.
Another interesting future direction is to see if the techniques developed in this work for bounding gradients (including those in the the concurrent work (Li et al., 2023)) can be generalized to improve the convergence results for other optimization problems and algorithms. We believe it is possible so long as the function class is well behaved and the algorithm is efficient enough so that can be well bounded for some appropriately defined stopping time .
We want to note that our results can not explain why Adam is better than SGD for training transformers, because (Li et al., 2023) shows that non-adaptive SGD converges with the same gradient complexity under even weaker conditions. It would be interesting and impactful if one can find a reasonable setting (function class, gradient oracle, etc) under which Adam or other adaptive methods provably outperform SGD.
Acknowledgments
This work was supported, in part, by the MIT-IBM Watson AI Lab and ONR Grants N00014-20-1-2394 and N00014-23-1-2299. We also acknowledge support from DOE under grant DE-SC0022199, and NSF through awards DMS-2031883 and DMS-1953181.
References
Appendix A Probabilistic lemmas
In this section, we state several well-known and useful probabilistic lemmas without proof.
Let be a martingale with respect to a filtration . Assume that almost surely for all . Then for any fixed , with probability at least ,
In this section, we provide proofs related to smoothness. In what follows, we first provide a formal proposition in Appendix B.1 showing that univariate rational functions and double exponential functions are smooth with , as we claimed in Section 3.2.1, and then provide the proofs of Lemma 3.4, Lemma 5.1, and Corollary 5.2 in Appendix B.2, B.3 and B.4 respectively.
Any univariate rational function , where are two polynomials, and any double exponential function , where , are smooth with . However, they are not necessarily smooth.
We prove the proposition in the following four parts:
1. Univariate rational functions are smooth with . Let where and are two polynomials. Then the partial fractional decomposition of is given by
Then we have . For any , we know that for any . Then we can show that
where the first equality is because one can easily verify that the first and second order derivatives of dominate those of all other terms when goes to , and the second equality is because , , and (here we assume since otherwise there is no need to prove (10) for ). Note that (10) implies that, for any , there exists such that
Similarly, one can show , which implies there exists such that
We know is a compact set and therefore the continuous function is bounded within , i.e., there exists some constant such that
Combining (11), (12), and (13), we have shown
which completes the proof of the first part.
2. Rational functions are not necessarily smooth. Consider the ration function . Then we know that and . Note that for any , we have
which shows is not smooth for any .
3. Double exponential functions are smooth with . Let , where , be a double exponential function. Then we know that
where the first equality is a direct calculation; the second equality uses change of variable ; and the last equality is because exponential function grows faster than linear function. Then we complete the proof following a similar argument to that in Part 1.
4. Double exponential functions are not necessarily smooth. Consider the double exponential function . Then we have
For any , we can show that
which shows is not smooth for any . ∎
B.2 Proof of Lemma 3.4
Before proving Lemma 3.4, we need the following lemma that generalizes (a special case of) Grönwall’s inequality.
It is straightforward to verify that the solution to (14) satisfies
Then it suffices to show . Note that
With Lemma B.2, one can bound the gradient norm within a small enough neighborhood of a given point as in the following lemma.
Suppose is smooth for some . For any and points satisfying , we have
Denote functions and for . Note that for any , by triangle inequality,
We know that is differentiable since is second order differentiableHere we assume for . Otherwise, we can define and consider the interval instead.. Then we have
Let . By Lemma B.2, we know that
Denote . We have
Since is increasing, we have . ∎
With Lemma B.3, we are ready to prove Lemma 3.4.
On the other hand, by the definition of , we know for every . Then by Lemma B.3, for all , we have . Therefore for all
which contradicts with (15). Therefore we have shown . We have
where the last inequality is due to Lemma B.3. ∎
B.3 Proof of Lemma 5.1
Denote and . Let . Then we have
where the inequality can be easily verified considering both cases of and . Then based on Corollary 5.2, we have and
B.4 Proof of Corollary 5.2
First, Lemma 3.4 states that for any ,
If , we choose . Then it is straightforward to verify that
Therefore we have shown for any satisfying ,
Next, let for . We know
Appendix C Convergence analysis of Adam
In this section, we provide detailed convergence analysis of Adam. We will focus on proving Theorem 4.1 under the bounded noise assumption (Assumption 3) in most parts of this section except Appendix C.6 where we will show how to generalize the results to noise with sub-Gaussian norm (Assumption 4) and provide the proof of Theorem 4.2.
For completeness, we repeat some important technical definitions here. First, we define
as the deviation of the re-scaled momentum from the actual gradient. Given a large enough constant defined in Theorem 4.1, denoting , we formally define the stopping time as
i.e., is the first time when the sub-optimality gap is strictly greater than , truncated at to make sure it is bounded in order to apply Lemma A.2. Based on Lemma 5.1 and the discussions below it, we know that if , we have both and . It is clear to see that is a stopping timeIndeed, is also a stopping time because only depends on , but that is unnecessary for our analysis. with respect to because the event is a function of and independent of . Next, let
be the stepsize vector and be the diagonal stepsize matrix. Then the update rule can be written as
Finally, as in Corollary 5.2 and Lemma 5.3, we define the following constants.
The bias correction steps in Lines 7–8 make Algorithm 1 a bit complicated. In the following proposition, we provide an equivalent yet simpler update rule of Adam.
Denote and . Then the update rule in Algorithm 1 is equivalent to
where initially we set and . Note that since , there is no need to define and .
Denote . Then we know and . By the momentum update rule in Algorithm 1, we have
Note that satisfies the following property
Next, we verify the initial condition. By Algorithm 1, since we set , we have . Therefore we have since . Then the proof is completed by applying the same analysis on and . ∎
C.2 Useful lemmas for Adam
In this section, we list several useful lemmas for the convergence analysis. Their proofs are all deferred in Appendix C.5.
First note that when , all the quantities in the algorithm are well bounded. In particular, we have the following lemma.
Next, we provide a useful lemma regarding the time-dependent re-scaled momentum parameters in (18).
Let , then for all , we have .
In the next lemma, we provide an almost sure bound on in order to apply Azuma-Hoeffding inequality (Lemma A.1).
Denote . Choosing , if , we have and .
Finally, the following lemma hides messy calculations and will be useful in the contradiction argument.
Under the parameter choices in either Theorem 4.1 or Theorem 4.2, we have and .
C.3 Proof of Theorem 4.1
Before proving the main theorems, several important lemmas are needed. First, we provide a descent lemma for Adam.
If , choosing and , we have
Since we choose , by Lemma 5.3, we have if . Then we can apply Corollary 5.2 to show that for any ,
where the second inequality uses (17) and (19); the third inequality is due to Young’s inequality and for any PSD matrix ; the second last inequality uses ; and the last inequality is due to (19). ∎
The following lemma bounds the sum of the error term before the stopping time . Since its proof is complicated, we defer it in Appendix C.4.
If and , with probability ,
Combining Lemma C.6 and Lemma C.7, we obtain the following useful lemma, which simultaneously bounds and .
If and , then with probability at least ,
With Lemma C.8, we are ready to complete the contradiction argument and the convergence analysis. Below we provide the proof of Theorem 4.1.
By the definition of , if , we have
Based on Lemma C.5, we have , which leads to a contradiction. Therefore, we must have conditioned on . Then, Lemma C.8 also implies that under ,
where the last inequality is due to Lemma C.5. ∎
C.4 Proof of Lemma C.7
In order to prove Lemma C.7, we need the following several lemmas.
Denote . If and , we have for every ,
According to the update rule (18), we have
Since we choose , by Lemma 5.3, we have if . Therefore by Corollary 5.2, for any ,
where the first inequality uses Young’s inequality for any ; the second inequality is due to
the third inequality uses (24) and Young’s inequality; and in the last inequality we choose , which implies . Then by (23), we have
Denote . If and , with probability ,
Since is a stopping time, we know that is a function of . Also, by definition, we know is a function of . Then, denoting
Then by the Azuma-Hoeffding inequality (Lemma A.1), we have with probability at least ,
where in the last inequality we use Lemma C.3. ∎
By Lemma C.9, we have for every ,
Taking a summation over from to , we have
where the first inequality uses Lemma C.10; and the second inequality uses Lemma C.3 and . Then we complete the proof by multiplying both sides by . ∎
C.5 Omitted proofs for Adam
In this section, we provide all the omitted proofs for Adam including those of Lemma 5.3 and all the lemmas in Appendix C.2.
By definition of , we have if . Then Assumption 3 directly implies . can be bounded by a standard induction argument as follows. First note that . Supposing for some , then we have
Then we can show in a similar way noting that . Given the bound on , it is straight forward to bound the stepsize . ∎
First, when , we have . Therefore,
Next, note that when , we have . Then we have
Therefore we have ∎
We prove for all by induction. First, note that for , we have
Now suppose for some . According to the update rule (18), we have
Since we choose , by Lemma 5.3, we have if . Therefore by Corollary 5.2, we have for any ,
where the last inequality uses the choice of and . Therefore we have which completes the induction. Then it is straight forward to show
We first list all the related parameter choices below for convenience.
We will show first. Note that if denoting , we have
Below are some facts that can be easily verified given the parameter choices.
By the choice of , we have for large enough , which implies .
By the choice of , we have .
By the choice of , we have .
By the choice of , we have , which implies for small enough .
By the choice of and (a), we have for small enough .
where the first inequality is due to Facts (a-c); the second inequality uses , , and for ; and the last inequality is due to Facts (d-e).
Next, we will show . We have
where in the first inequality we use and for ; the second inequality uses ; the second equality uses the parameter choice of ; and in the last inequality we choose a large enough and small enough . ∎
C.6 Proof of Theorem 4.2
We define stopping time as follows
Then it is straightforward to verify that are all stopping times.
where the fourth inequality uses Assumption 4; and the last inequality uses .
Next, if , by definition, we have , or equivalently,
On the other hand, since for any , under the new definition of , we still have
By Lemma C.5, we know , which suggests that , i.e., . Then we can show
and under the event , we have and
where the last inequality is due to Lemma C.5. ∎
Appendix D Convergence analysis of VRAdam
In this section, we provide detailed convergence analysis of VRAdam and prove Theorem 6.2. To do that, we first provide some technical definitions Note that the same symbol for Adam and VRAdam may have different meanings.. Denote
as the deviation of the momentum from the actual gradient. From the update rule in Algorithm 2, we can write
Let be the constant defined in Theorem 6.2 and denote . We define the following stopping times as discussed in Section 6.1.
It is straight forward to verify that are all stopping times. Then if , we have
Then we can also bound the update where if (see Lemma D.3 for the details). Finally, we consider the same definition of and as those for Adam. Specifically,
We first list several useful lemmas in this section without proofs. Their proofs are deferred later in Appendix D.3.
To start with, we provide a lemma on the local smoothness of each component function when the gradient of the objective function is bounded.
With the new definition of stopping time in (D), all the quantities in Algorithm 2 are well bounded before . In particular, the following lemma holds.
Next, we provide the following lemma which bounds the update at each step before .
if , where .
The following lemma bounds when .
If , , and ,
Finally, we present some inequalities regarding the parameter choices, which will simplify the calculations later.
Under the parameter choices in Theorem 6.2, we have
D.2 Proof of Theorem 6.2
Before proving the theorem, we will need to present several important lemmas. First, note that the descent lemma still holds for VRAdam.
If , choosing and , we have
The proof is essentially the same as that of Lemma C.6. ∎
Choose , , and . We have
where in the second inequality we choose . Therefore, noting that , by (25), we have
Taking a summation over and re-arranging the terms, we get
Taking expectations on both sides, noting that
by the Optional Stopping Theorem (Lemma A.2), we have
Under the parameter choices in Theorem 6.2, we have
First note that according to Lemma D.5, it is straight forward to verify that the parameter choices in Theorem 6.2 satisfy the requirements in Lemma D.6 and Lemma D.7. Then by Lemma D.6, if ,
Taking a summation over , re-arranging terms, multiplying both sides by , and taking an expection, we get
where the last inequality is due to Lemma D.5. Then (28) + (29) gives
With all the above lemmas, we are ready to prove the theorem.
First note that according to Lemma D.5, it is straight forward to verify that the parameter choices in Theorem 6.2 satisfy the requirements in all the lemmas for VRAdam.
Then, first note that if , we know by the definition of . Therefore,
where the second inequality uses Markov’s inequality; the third inequality is by Lemma D.8; and the last inequality is due to Lemma D.5.
Similarly, if , we know . We have
where the second inequality uses Markov’s inequliaty; the third inequality is by Lemma D.8; and the last inequality is due to Lemma D.5. where the last inequality is due to Lemma D.5. Therefore,
Let be the event of not converging to stationary points. By Markov’s inequality, we have
i.e., with probability at least , we have both and . ∎
D.3 Proofs of lemmas in Appendix D.1
This lemma is a direct corollary of Corollary 5.2. Note that by Assumption 6, we have . Hence, when computing the locality size and smoothness constant for the component function , we need to replace the constant in Corollary 5.2 with , that is why we get a smaller locality size of and a larger smoothness constant of . ∎
The bound on is by the definition of in (D). All other quantities for VRAdam are defined in the same way as those in Adam (Algorithm 1), so they have the same upper bounds as in Lemma C.2. ∎
where the first inequality uses the update rule in Algorithm 2 and by Lemma D.2; the second inequality is again due to Lemma D.2. ∎
By the definition of , it is easy to verify that
where the second inequality uses Lemma D.1; and the last inequality is due to . Then, we have
These inequalities can be obtained by direct calculations. ∎