Robustness to Unbounded Smoothness of Generalized SignSGD
Michael Crawshaw, Mingrui Liu, Francesco Orabona, Wei Zhang, Zhenxun Zhuang
Introduction
Recent years have witnessed a surge in non-convex machine learning models, with a focus on deep neural networks . DNNs have achieved tremendous progress in a variety of tasks, including computer vision , natural language processing , and a lot more. Despite their huge empirical success, the theoretical analyses of non-convex optimization prove to be fundamentally more challenging than the established convex optimization theory . Among the numerous literature, many of them assume smoothness of the objective function, namely requiring the gradients to be Lipschitz. Under this scenario, past works have succeeded in proving the convergence rates for a number of algorithms, e.g., Stochastic Gradient Descent , AdaGrad , and STORM .
Nevertheless, it was recently observed that the smoothness assumption does not capture the training of LSTMs : the Hessian can grow with the size of the gradients . Inspired by this, Zhang et al. proposed a relaxed smoothness assumption, named smoothness:
They also showed that the well-known gradient clipping technique can ensure SGD’s convergence in such scenarios. Later, their results were improved to show that SGD with clipping can be made unaffected by the in (1) and is able to recover the optimal convergence rate of SGD under the original smoothness setting .
Nevertheless, the condition has not yet been empirically verified beyond LSTMs. Therefore, our first contribution lies in studying the applicability and generalization of the condition. In particular, we have empirically verified that the popular Transformer model also seems to satisfy this assumption, see Figure 1. Yet, we noticed that different coordinates, especially when they are in different layers of the model, exhibit very distinct and values as shown in Figure 3. Hence, we propose to refine the assumption in (1) to a coordinate-wise version (Assumption 2) and consider this to better capture the loss surface when training deep neural networks like Transformers.
Given that we assume (a generalization) of the assumption, it would be natural to use some clipping procedure. However, we found out that the use of clipping on Adam , while carried out in common practice [e.g., 53], has no effect on the training and testing performance on optimizing a large transformer model as shown in Figure 2. In retrospect, this might not be surprising: It is known that Adam has an implicit clipping behavior due to the normalization by the estimated second moment of the gradients. Indeed, Adam can be interpreted as a variant of SignSGD .
Inspired by this, our second contribution is to propose and analyze a generalized SignSGD algorithm under the relaxed smoothness assumption. It is parameterized in such a way that it on one end recovers SignSGD while on the other end closely resembles Adam. Apart from the convergence rates, we also located the critical role the momentum plays in analyzing Adam-type algorithms: it not only reduces the effects of noise but also gives an exponential decaying effect on the unbounded gradient norms and smoothness. This can partly explain the phenomenon that clipping does not help Adam.
The structure of this paper is as follows. Section 2 discusses related works and how our paper builds upon and distinguishes from them. The settings and assumptions are carried out in Section 3. We will introduce formally the generalized SignSGD algorithm and its analysis in Section 4, with a detailed discussion on the bounds and the role of momentum. The experimental results are shown in Section 5, comparing our algorithm with some popular competitors in deep learning tasks. Finally, we draw some conclusions and discuss the limitations of our work in Section 6.
Related Works
Adaptive Gradient Methods Adaptive gradient methods are popular optimizers for training deep neural networks. The traditional analysis of adaptive gradient methods is providing regret bounds under the online convex optimization framework . Recently, there are some analysis of adaptive gradient methods for nonconvex smooth functions . Zou et al. introduces an intriguing connection between Adam and SignGD when training a two-layer neural network in the deterministic setting, where SignGD is an algorithm following the negative gradient sign direction to perform the update. However, these works cannot be directly extended to nonconvex functions with unbounded smoothness in the stochastic setting. To the best of our knowledge, this work is the first one establishing guarantees for coordinate-wise type optimizers like generalized SignSGD as well as Adam-type updates under a relaxed smoothness condition.
Gradient Clipping The algorithm and analysis of gradient clipping can be traced back to under the assumption that the function is convex and rapidly growing. Hazan et al. considered gradient clipping in quasi-convex optimization. Mai and Johansson showed the stability and convergence of stochastic gradient clipping algorithms for convex problems without the smoothness condition. Gradient clipping is a standard technique in training deep neural networks such as RNNs and LSTMs. The theoretical analysis of gradient clipping for nonconvex models is pioneered by , in which the authors analyzed the convergence of gradient clipping under the relaxed smoothness assumption rather than the standard smoothness assumption. Zhang et al. further improved the convergence rate bound under the same assumption as in . Gradient clipping is also used when there is a heavy tail noise in the stochastic gradient to establish high probability convergence rates . Cutkosky and Mehta proved that normalized momentum improves normalized SGD under a second-order smoothness condition. A close algorithm is the one in which employs gradient normalization, momentum, and no gradient clipping to tackle the condition (1) and control noise. Yet, their algorithm normalizes each coordinate with the same scale unlike popular optimizers such as Adam . Moreover, we observe empirically that normalized SGD with momentum performs worse than Adam. Motivated by this, we propose a coordinate-wise optimization algorithm which requires new analysis tools compared with .
Employ to compute in Adam Designed to combine the advantages of Adagrad and RMSProp , the update of Adam employs the ratio between the exponential moving average of the stochastic gradient () and the exponential moving average of the squared stochastic gradient (). Many variants of Adam have been proposed ever since. Among them, one idea is to use to compute instead of . The intuition is that represents a better update direction than and can thus better capture the second-moment information. Reddi et al. adopted this change to prove the convergence of Adam in a federated learning setting; yet, they only consider the smooth setting and require a large to obtain convergence in contrast to the original Adam. Later, Wang et al. explored this idea in more detail, but their analyses are still restricted to the smooth setting.
Settings and Preliminaries
In this paper, we focus on the following stochastic optimization problem:
where is a random variable representing a randomly selected data sample or random noise following an unknown distribution . We will use the following assumptions.
We will denote and .
Indeed, our Assumption 2 implies (4) when and for all , up to constants (See Lemma 3 in the Appendix). Note that the factor in ours is exactly for easy comparison with (4). The reason we turn to the current coordinate-wise version is that we observed a vast variance across different layers in training Transformer models: (1) is still true globally (Figure 1), but each layer or even each coordinate satisfies has a very different pair (Figure 3). The smoothness assumption has been generalized in orthogonal directions in other work .
One merit of Assumption 2 is that it gives us the following descent lemma.
Our last assumption is common in the literature studying the smooth condition .
A Generalized SignSGD Algorithm
In this section, we present in Algorithm 1 a generalized SignSGD algorithm. This algorithm encompasses a variety of optimization algorithms.
At first sight, it seems very similar to Adam. Indeed, if we employ in computing instead of , then it is exactly Adam, except for the bias correction terms. We would like to clarify that the idea of this change has been explored before, as detailed in Section 2. In this paper, the motivation for adopting this idea comes from the known effect of momentum on reducing the influence of noises . Indeed, in our analysis the difference between and is much more controllable than between and . Thus, we consider employing in computing a better choice.
Note that both SignSGD and Adam are good candidates for optimization algorithms whose update must be bounded on functions that satisfy the condition. Indeed, SignSGD can be seen as an extreme form of gradient clipping. On the other hand, as said in the introduction, Adam does not seem to require gradient clipping at all when used to train the large Transformer model in Figure 2.
Hence, we expect our algorithm, a generalization of SignSGD and a close resemblance to Adam, can enjoy the merits of both and be robust to the unbounded smoothness in the scenario. In the next section, we will formalize this claim by presenting the theoretical analysis of Algorithm 1.
Under Assumptions 1, 2, and 3, assume is finite for each , let be any upper bound on , , , , , , for , Algorithm 1 guarantees, with probability at least , that
Furthermore, for the case when , we have the following refined guarantee:
Here, denotes the maximum absolute value of the partial derivative of for coordinate among the sub-level set of , namely any point with . In other words, we assume gradients to be bounded in the sub-level set of ; yet, we do not make any restriction on gradients outside of this set. We believe this is not a strong assumption, for example, when the sub-level set of is bounded, then by the assumed continuity of gradients it trivially holds. Also, we just require an upper bound and it can even be exponentially large as we have an exponentially decaying coefficient to counteract it: notice how the term is multiplied by a term that decays exponentially with . Better still, when , we no longer even need this assumption and the algorithm is entirely free of the influence of . To see why this is good, we show a refined lower bound of Gradient Descent under the relaxed smoothness scenario below which is originally in .
Theorem 2 shows that in the relaxed smoothness setting, GD with any constant step size will suffer from a linear term depending on . On a side note, it is a fixed version of the lower bound in : we provide in Appendix an explanation of errors in their lower bound and our corrected proof.
Compared with GD, our algorithm only has an exponentially decaying dependence on . We consider this to be substantial merit of our algorithm. Furthermore, when in which case we recover the SignSGD with Momentum algorithm, we can even show that it completely removes the effects of the unbounded gradient norms. Also notice that in such case we actually no longer need the assumption of being finite for each anymore, and the term does not appear in the final bound anymore.
We also would like to point out that this bound closely resembles the one achieved by SGD with gradient clipping algorithm except that we consider the coordinate-wise setting: take the setting of for example, we need at most to get a point with with high probability.
Remark 1 The almost surely bounded assumption 3 can be relaxed to sub-gaussian noise, using standard extensions of Freedman inequality [e.g., 16].
Remark 2 When , we can prove an average-iterate complexity bound (see Proof of Theorem 1 for in Appendix A.3); yet, we use the min form for consistency between the two cases.
The proof of the theorem is highly technical and it uses recent advancements in the analysis of momentum methods , key techniques to deal with the assumption , as well as a novel and essential inductive argument to control the norm of past gradients. We want to stress that the difficulty mainly comes from analyzing Adam-type updates when , while for the other case of the proof is significantly simpler. The full proof is in the Appendix, but here we present a proof sketch that underlines the main steps. First, we list some key lemmas we used but move their proofs to the appendix due to space constraints.
With notations in Algorithm 1, for , we have .
Lemma 5 limits our focus to the most recent steps on which Assumption 2 and Lemma 1 can apply.
Assume Assumption 3. With the notation of Algorithm 1, let and . Then, with probability at least , for any , we have
Lemma 7 is the major tool we use to handle the noise we incur during drawing stochastic gradients. It is derived based on Lemma 12 in .
With the notation of Algorithm 1 and under the assumptions of Theorem 1, if holds for all and , and , then, with probability at least we have that,
where and .
Lemma 10 is similar to Lemma A.2 in which considered the deterministic and smooth setting; in contrast, our proof is much more challenging in that we need to tackle both the noise and the unbounded smoothness. With this lemma, we know that either the true gradient is small or that the update of our Algorithm 1 can be lower bounded.
Under Assumptions 1, 2, and 3, using the hyperparameters in Theorem 1, denoting and , for all and we have, with probability at least ,
Lemma 12 shows how the use of momentum can help control the noise by choosing wisely. It is adapted from the proof of Theorem 2 in but with the added difficulty of unbounded smoothness.
Observing the formula of setting , we can see that when , . As , Algorithm 1 reduces to SignSGD. In this case, the key component is Lemma 12 using which we are able to show that can be controlled as . The summation of true gradients over time can then be offsetted by choosing and wisely when we invoke the descent lemma 1. The rest is standard.
Now for the other case in which , we take a different route.
First, notice that Assumption 2 and the Descent Lemma 1 only hold when two points are not too far away. Thus, we need to restrict our attention to the recent updates (Lemma 5), beyond which we would have no control. This means we want the influence of those updates too long ago to not have a big effect on the current one. To make this happen, one natural idea is to use a bounded gradient assumption, then with the use of exponential averaging, their effect would be quickly reduced. Yet, assuming directly that all gradients are bounded would trivialize the assumption. Thus, we pose a much weaker condition, assuming that being finite for each . Then, we prove that will provide an upper bound to all the true gradients the algorithm see. We prove it using induction, analyzing separately the case that either the true gradient is already very small and we have reached the proximity of a stationary point, or the objective function is monotonically non-increasing and the gradient remains bounded.
Having controlled the past gradients, we prove in Lemma 10 that the update of Algorithm 1 is either very small that we can pass or having a constant lower bound that we can use in the Descent Lemma 1.
Also, considering that this is the stochastic setting, noise typically slows down convergence or can even cause the algorithm to diverge if the hyperparameters are not chosen wisely. To handle this, we invoke Freedman’s inequality to show that the addition of adjacent stochastic noise almost cancels out each other and the absolute value of the sum remains controlled (Lemma 7).
Yet, we still need another block to handle the difference between the true gradient and the momentum as we are updating in the direction of the momentum instead of the true gradient. Turns our that we can prove that when is not too small. As before, in the case is small, we have converged on that coordinate.
Combining all these blocks together, we are able to arrive at the final results. ∎
Experiments
We conducted our experiments using PyTorch on Nvidia V100 GPUs.
To validate the efficacy of our Algorithm 1, we compare it with Adam , SGD , SGD Momentum Normalized , SGDClipGrad, and SGDClipMomentum. The latter two are from Algorithm 1 in where SGDClipGrad corresponds to the case when and SGDClipMomentum corresponds to when .
Training Unless otherwise specified, we use grid-search to fine-tune the initial learning rate for all optimizers, as well as the clipping threshold for SGDClipGrad and SGDClipMomentum, and for Adam and our algorithm, to select the one giving the best validation performance on a separated validation set. We then employ the best performing hyperparameters to train the model over all training data and report the testing performance. The testing is repeated with random seeds 5 times to eliminate the influence of stochasticity. For more details, please refer to Section A.4.
Resnet for Image Classification on CIFAR-10 We employ the 20-layer Residual Network model to do image classification on the CIFAR-10 dataset. Images are normalized per channel using the means and standard deviations computed from all training images. We adopt the data augmentation technique following (for training only): 4 pixels are padded on each side of an image and a 32 × 32 crop is randomly sampled from the padded image or its horizontal flip. The mini-batch size is and we train all algorithms for epochs. We do not employ any learning rate decay schedule in order to focus on the comparison of the optimizers themselves. We fixed the weight decay value to be and the momentum parameter ( to be . Figure 4 and Table 1 report the training and testing performance for each algorithm, showing that ours is among the best.
LSTM for Language Modeling on Penn Treebank We adopt a 3-layer AWD-LSTM to do language modeling on the Penn Treebank (PTB) dataset (word level). The mini-batch size is and we trained each algorithm for epochs. Apart from the hyperparameters we stated above, we further fine-tuned the weight decay value for all algorithms noticing its significant influence on the performance. We choose the set of hyperparameters that give the smallest final validation perplexity. We report the results in Figure 5 and Table 1. It can be seen that we can match the performance of Adam while beating the others.
For Figure 1 which verifies the original form (1) of the condition using the norm, we followed the method in Section H.3 of . Specifically, given and , denote . We estimate the smoothness at by
where denotes the sample locations and we use .
For Figure 3 verifying the coordinate-wise version (3) of the condition, note that the equation is symmetric in that if we just swap and it shall still holds. Thus, during plotting, we compare vs. .
Figure 1(a) is on training a -layer Transformer Encoder to do language modeling on the Wikitext-2 dataset. The implementation, settings, and parameter choices follow this.https://pytorch.org/tutorials/beginner/transformer_tutorial.html We only plot the first training epochs. Figure 1(b) and 3 are on training a -layer Transformer to do machine translation on the WMT’16 Multimodal Machine Translation Task German-English dataset. The implementation of the transformer is forked from herehttps://github.com/jadore801120/attention-is-all-you-need-pytorch and we also follow their default settings. The mini-batch size is and we trained for epochs using Adam and report the whole training trajectory.
3 Clipping does not Affect Adam’s Performance
We compare clipping and non-clipping for Adam optimizer on the Wikitext-103 (103 million tokens, 180MB) language modeling task, with a 16-layer GPT-2 transformer model . This GPT-2 model has an input length of 256 tokens, 410-dimension word embedding, 16 Attention layers with 10 Attention heads and 2100 hidden dimensions. Model size is 201.58 MB. The vocabulary size is 28996. We use the hyper-parameter settings prescribed in : batch size 256, warm up learning rate from 0 to in the first 64000 samples (i.e., 250 iterations) and then cosine-anneal learning rate to zero, on top of an Adam optimizer. It takes about 40 hours to train 200 epochs on 8 V100 GPUs. We use clipping threshold max_norm 0.25 for the entire model as prescribed in the literature . We also count that with this clipping scheme, clipping occurs in every single batch. As we can see from Figure 2, neither training loss (2.79 vs 2.76) nor perplexity score (27.92 vs 27.97) differs much in the clipping and non-clipping case, which is consistent with our theory that Adam naturally achieves gradients clipping effect.
Conclusion and Limitations
Smoothness has been a widely adopted condition for proving convergence rates of algorithms in the non-convex optimization scenario. Yet, it has been found that this assumption does not capture losses when employing some deep learning models including RNNs and LSTMs. In light of this, a relaxed smoothness assumption was proposed that aligns well with the practice. We observed that the loss surface of training using Transformers also exhibits this relaxed smoothness. Under this assumption, SGD with clipped gradient has been proven to work well. However, we found that clipping is not necessary for achieving convergence in such a setting. Indeed, we showed that a generalized SignSGD algorithm does not require explicit clipping but can almost guarantee the same bound as SGD with clipping. In the analyses, we identified the key effect of using momentum in analyzing Adam-type algorithms, that it reduces both the noise and the unbounded gradient norms. Finally, we conducted a variety of deep learning tasks showing that our algorithm can match Adam’s performance while exceeding others.
Limitations The current work is in no way a perfect one and there are many directions worth exploring beyond it. First of all, though our algorithm could be seen as a close resemblance to the original Adam algorithm, they are still not equal. Considering the huge popularity of Adam and its established effectivity in practice, it is worth studying whether Adam in its original form can converge in the relaxed smooth setting. Second, while our Theorem 1 are upper bounds and cannot be directly compared between the two cases of , it does suggests that minimizes the worst-case convergence rate. However, it still does not fully explain the phenomenon that a choice of close to yields better performance in using our Algorithm 1 as well as Adam in practice. Third, despite there are lower bounds showing that, for example, GD with a constant step size can be arbitrarily worse than GD with clipping, it would be more meaningful to study whether the relaxed smooth condition is inherently more difficult, possibly by establishing a lower bound for all first-order optimization algorithms. Fourth, we did show that Transformers observe the relaxed smoothness condition, but we consider it more beneficial to research in-depth what properties or structures make a model satisfy such conditions. Finally, when conducting our experiments, we observed that the weight decay value plays a prominent role in each optimizer’s performance, and that the best weight decay value varies for different optimizers. Thus, one potential direction would be to explore different ways of incorporating the regularization in a way to preserve the scale-freeness of Algorithm 1, just as AdamW does .
Acknowledgements
Michael Crawshaw is supported by the Institute for Digital Innovation fellowship from George Mason University. Michael Crawshaw and Mingrui Liu are both supported by a grant from George Mason University. Francesco Orabona is supported by the National Science Foundation under the grants no. 1908111 “AF: Small: Collaborative Research: New Representations for Learning Algorithms and Secure Computation”, no. 2022446 “Foundations of Data Science Institute”, and no. 2046096 “CAREER: Parameter-free Optimization Algorithms for Machine Learning”.
References
Appendix A Appendix
Below, we prove the descent lemma for coordinate-wisely -smooth functions satisfying Assumption 2.
where the second inequality uses the fact that and the final one is due to Assumption 2. ∎
The following Lemma shows that our coordinate-wise smooth assumption 2 is equivalent to the original smooth assumption (1) at least in -d case.
(2) (1) This is a special case for -d and of Corollary A.4 in . ∎
When and for all , Assumption 2 implies (4) (up to constants).
Suppose all are the same across , then we have
A.2 Proof of Lower Bound
By Lemma 2, we know that, in 1-d case, our coordinate-wise assumption 2 is equivalent as the original one (1). Thus, without loss of generality, we use the original condition (1) in the proof. We will construct two different -smooth functions based on the value of .
Case . In this case, we can construct a function on which GD does not converge, hence the lower bound is trivially true. Consider the function
Note that is -smooth. Without loss of generality, we can assume , in fact if this is not the case we can translate the function accordingly. This setting of guarantees that the bound on the gradient is correct. Moreover, with this choice, we claim the function will diverge. To see this, we use mathematical induction to show that and for any . First, for the case when , we have
Then suppose the condition holds up until and we prove for . From the formula of , we have that and that is monotonically increasing with . Thus, from the update of gradient descent which moves along the negative direction of the gradient, if we can show that , then . This yields
Now, note that is decreasing for and increasing for . Hence, we have that
where the first inequality is true by the choice of and the condition on and the second one is true by the induction hypothesis.
Case .
We have that is -smooth, hence also -smooth. Note that the presence of the fourth power makes this function twice differentiable. Moreover, the maximum gradient in this case is .
As before, without loss of generality, let the initial point , where . We have that , hence . Now, while we stay on the last branch of the function, we have
we guarantee . ∎
As we said in the main text, unfortunately, the lower bound theorem in is wrong, both statement and proof. First of all, they have a logarithm of a quantity with units, , which is an undefined mathematical operation. A closer look at the proof reveals that, differently from the statement of their theorem, they construct a function with , which explains why these terms are missing in the logarithm. Moreover, it is also unclear if the second constructed function satisfies the assumptions of the theorem. We correct all these issues by properly scaling the constructed functions so that they always satisfy the condition and all the units are coherent. This result in the correct term inside the logarithm and the right conditions on , , , and .
A.3 Proof of Theorem 1
We first write down some notations here that we will use heavily later for easier reference:
Also, we would need the following formula many times:
where in the first inequality we used the fact that for .
With the notations in Algorithm 1, for each coordinate we have
The following lemma shows when we can apply Assumption 2 and Lemma 1.
With notations in Algorithm 1, for , we have .
The following two lemmas are the major tools we use to analyze the effects of noises.
Assume Assumption 3. With the notation of Algorithm 1, let and . Then, with probability at least , for any , we have
The following lemma upper bounds the differences between recent true gradients and the current one.
With the notation of Algorithm 1 and under the assumptions in Theorem 1, for any and any with , we have
where the first inequality is due to Assumption 2 and Lemma 5, the second inequality uses Lemma 4, and the final inequality uses the fact that for any . ∎
The following lemma upper bounds a past momentum with the current one.
With the notation of Algorithm 1 and under the assumptions of Theorem 1, for any , with probability at least , it holds that
We now upper bound the first term of (59) using Lemma 8 by using the fact that :
Finally, the second term of (59) can be bounded using Lemma 7 by noticing that
The following Lemma is adapted from . Yet, they only considered Adam under the -smooth setting and when there is no noise. The existence of noise and the relaxed smoothness assumption makes the proofs substantially more challenging. With this lemma, we know that either the true gradient is small or that the update of our Algorithm 1 can be lower bounded.
With the notation of Algorithm 1 and under the assumptions of Theorem 1, if holds for all and , and , then, with probability at least we have that,
Given that for any and , using Lemma 4 and Assumption 3, it is immediate to show that . Then, denote namely the largest integer that is no greater than , from Lemma 4, we have
where the final inequality uses the assumption that . Using Lemma 9 and the definition of , with probability at least , as we need to invoke Lemma 7 for at most times, we have
where in the last inequality we used the fact that .
Thus, we consider following two cases depending on the relative size of vs. .
Case 1: , then
Case 2: , then we have
Also, for we have from Lemma 4 that
The first term can be bounded below by using Lemma 8 and that :
The second term can be bounded using Lemma 7. Thus,
where we used (39) and that for .
Therefore, with probability at least we have
Given that , depending on the relative size of vs. , we have following two cases.
Case 2.1: .
Case 2.2: , using the fact that the r.h.s of (79) is decreasing in , we have
where in the last inequality we used the fact that . Note that so the above lower bound is smaller than (71). ∎
The following two lemmas are for the special case of .
With choices of parameters in Theorem 1, when , we have .
Using the fact that and the condition on , we have
The following lemma is adapted from the proof of Theorem 2 in .
Under Assumptions 1, 2, and 3, using the settings of the hyperparameters in Theorem 1, denoting and , for all and we have, with probability at least ,
We can derive the following recursive formulation for any :
Take the absolute value of both sides, to obtain
where the second inequality uses (84) and Lemma 7, the fourth and fifth inequalities use (84), and the final one is due to (83). ∎
Under Assumptions 1, 2, and 3, assume is finite for each , let be any upper bound on , , , , , , for , Algorithm 1 guarantees, with probability at least , that
Furthermore, for the case when , we have the following refined guarantee:
From Lemma 11 we know that for all . Thus, we can apply Lemma 1 to have
Thus, denoting by gives
Sum both sides over , to have
Use Lemma 12 to bound each coordinate of :
The above one holds with probability at least as we invoked Lemma 12 for times which in turns means invoking Lemma 7 for times. Yet, the above inequality would need to sum from to , meaning in total we would invoke Lemma 7 for times. Thus, following results hold with probability at least .
Now, put the above inequality back into (103) to have
Now, using the definitions of and , and the conditions on , we have
Divide both sides by and rearrange terms to give
Now, we need to consider the following two cases:
: then and
: then and
Put concludes the proof. ∎
Note that when , , . Then our Generalized SignSGD algorithm 1 reduces to the SignSGD algorithm, and thus has the same guarantee of (125). Therefore, we only consider the other case when .
Note that the only randomness comes from evaluating stochastic gradients. In the following proof, we will need to invoke Lemma 7 for times for each coordinate . Therefore, the following results hold with probability at least . For simplicity, we use the term "with high probability" later in the proof to denote this.
We derive the following quantity which will be used multiple times later:
First, from Lemma 10 we have . Then, from the choice of the hyperparameters, we have
Thus, we have and, as ,
Also, for those coordinates with small gradients , we have
We are now ready to prove the theorem. We will need to use Lemma 10, hence we first need to show that all past true gradients are bounded by , namely that, for any , holds for all and all . From the definition of stated in the theorem, in order to guarantee this, we only need to prove that for all . We will prove this by induction.
For the condition is trivially true.
We then assume that the condition holds for and prove based on this that it still holds for .
For those coordinates with , denote , with high probability, we have
where the first equality comes from Lemma 4; for the second inequality, the third term can be bounded using Lemma 8, and the final term can be bounded using Lemma 7; for the third inequality, we used (39) and that for . This inequality implies that with high probability.
Denote . From the choices of hyperparameters we can show that which means (Lemma 5). Thus, using Lemma 1, with high probability we have
where the second inequality uses (136), (143), and Lemma 4, and the third inequality uses Lemma 10 and (133).
Now, noticing the conditions on , , , and , use (131) to have
or .
This concludes the mathematical induction up until (151) is met for the first time which we denote as . In the following, we will explain that if (151) holds then the algorithm has found an approximate stationary point.
Now, suppose , then (150) holds all the time and we sum both sides of it from to to have, with high probability,
Note that RHS of (151) is less than RHS of (153). Thus, for the other case of , (153) still holds.
Recalling that , , , and , we have
When , then and . Hence, we obtain
Finally, taking , we obtain the stated result. ∎
A.4 More Experiment Details
In this section, we provide more details for the experiments we show in Section 5.
Hyperparameter Tuning During the validation stage, we used grid-search to fine-tune respective hyperparameters and choose the ones that yield the best validation results. We tuned the hyperparameters using the following two-stage grid searching strategy: First, search over a coarse grid, and select the one yielding the best validation result. Next, continue searching in a fine grid centering at the best-performing hyperparameters found in the coarse stage, and in turn, take the best one as the final choice. Also, whenever the best-performing hyperparameters lie in the boundary of the searching grid, we always extend the grid to make the final best-performing hyperparameters fall into the interior of the grid, if possible.
Resnet on CIFAR-10 We randomly selected images from the training dataset for validation. Yet, during testing, we trained on the whole training dataset. The detailed search ranges and the hyperparameter choices yielding the highest validation accuracy for each optimizer are listed in Table 2.
AWD-LSTM on Penn Treebank We used the original train-validation-test split that comes with the dataset. The momentum parameter ( is fixed to be except for SGDClipGrad which does not use momentum. The detailed search ranges and the hyperparameter choices yielding the lowest validation perplexity for each optimizer are listed in Table 3.
A.5 Training a Transformer Model on WMT’16 German-English Translation Task
We noted that Transformers are gaining huge popularities recently and reported in Figure 1 and 3 that Transformers observe the relaxed smoothness conditions. Thus, to further showcase the effectivity of our algorithm 1 compared with other optimizers listed in 5.1, we train a -layer Transformer model to do machine translation on the WMT’16 Multimodal Machine Translation Task German-English dataset. The implementation of the transformer is forked from herehttps://github.com/jadore801120/attention-is-all-you-need-pytorch and we inherited the default model structure. We also adopted the warm-up steps of and the learning rate decay strategy as recommended by the GitHub repo. The mini-batch size is and we trained for epochs.
For the hyperparameter tuning, the momentum parameter ( is fixed to be except for SGDClipGrad which does not use momentum. We then used grid-search to fine-tune the initial learning rate and the weight decay value for all optimizers, as well as the clipping threshold for SGDClipGrad and SGDClipMomentum, and for Adam and our algorithm. We select the combination of hyperparameters that gives the lowest validation perplexity. The detailed search ranges and the hyperparameter choices yielding the lowest validation perplexity for each optimizer are listed in Table 3.
We then employ the best-performing hyperparameters to report the testing performance. The testing is repeated with random seeds 5 times to eliminate the influence of stochasticity. The results are reported in Figure 6 and Table 4. Here the accuracy means the proportion of correct correspondences of words, namely the same word at the same location, between the machine-translated output and the target. It can be seen that we can still match the performance of Adam while beating the others. Also, note that the curves of SGD Momentum and the ones of SGDClipMomentum overlap as they utilize the same weight decay values and initial learning rates, and turns out clipping is seldomly performed when employing SGDClipMomentum.