A DAPTIVE G RADIENT M ETHODS WITH D YNAMIC B OUND OF L EARNING R ATE
A BSTRACT
Adaptive optimization methods such as A DA G RAD , RMS PROP and A DAM have been proposed to achieve a rapid training process with an element-wise scaling term on learning rates.
Though prevailing, they are observed to generalize poorly compared with S GD or even fail to converge due to unstable and extreme learning rates.
Recent work has put forward some algorithms such as AMSG RAD to tackle this issue but they failed to achieve considerable improvement over existing methods.
In our paper, we demonstrate that extreme learning rates can lead to poor performance.
We provide new variants of A DAM and AMSG RAD , called
A DA B OUND and AMSB OUND respectively, which employ dynamic bounds on learning rates to achieve a gradual and smooth transition from adaptive methods to
S GD and give a theoretical proof of convergence.
We further conduct experiments on various popular tasks and models, which is often insufﬁcient in previous work.
Experimental results show that new variants can eliminate the generalization gap between adaptive methods and S GD and maintain higher learning speed early in training at the same time.
Moreover, they can bring signiﬁcant improvement over their prototypes, especially on complex deep networks.
The implementation of the algorithm can be found at https://github.com/Luolc/AdaBound
I NTRODUCTION
There has been tremendous progress in ﬁrst-order optimization algorithms for training deep neural networks.
One of the most dominant algorithms is stochastic gradient descent (S GD ) (Robbins &
Monro, 1951), which performs well across many applications in spite of its simplicity.
However, there is a disadvantage of S GD that it scales the gradient uniformly in all directions.
This may lead to poor performance as well as limited training speed when the training data are sparse.
To address this problem, recent work has proposed a variety of adaptive methods that scale the gradient by square roots of some form of the average of the squared values of past gradients.
Examples of such methods include A DAM (Kingma & Lei Ba, 2015), A DA G RAD (Duchi et al., 2011) and RMS PROP (Tieleman & Hinton, 2012).
A DAM in particular has become the default algorithm leveraged across many deep learning frameworks due to its rapid training speed (Wilson et al., 2017).
Despite their popularity, the generalization ability and out-of-sample behavior of these adaptive methods are likely worse than their non-adaptive counterparts.
Adaptive methods often display faster progress in the initial portion of the training, but their performance quickly plateaus on the unseen data (development/test set)
(Wilson et al., 2017).
Indeed, the optimizer is chosen as S GD (or with momentum) in several recent state-of-the-art works in natural language processing and computer vision (Luo et al., 2019; Wu & He, 2018), wherein these instances S GD does perform better than adaptive methods.
Reddi et al.
(2018) have recently proposed a variant of A DAM called AMSG RAD , hoping to solve this problem.
The authors provide a theoretical guarantee of convergence but only illustrate its better performance on training data.
However, the generalization ability of AMSG RAD on unseen data is found to be similar to that of A DAM while a considerable performance gap still exists between AMSG RAD and S GD (Keskar & Socher, 2017; Chen et al., 2018).
In this paper, we ﬁrst conduct an empirical study on A DAM and illustrate that both extremely large and small learning rates exist by the end of training.
The results correspond with the perspective pointed out by Wilson et al.
(2017) that the lack of generalization performance of adaptive methods may stem from unstable and extreme learning rates.
In fact, introducing non-increasing learning rates, the key point in AMSG RAD , may help abate the impact of huge learning rates, while it neglects possible effects of small ones.
We further provide an example of a simple convex optimization problem to elucidate how tiny learning rates of adaptive methods can lead to undesirable non-convergence.
In such settings, RMS PROP and A DAM provably do not converge to an optimal solution, and furthermore, however large the initial step size α is, it is impossible for A DAM to ﬁght against the scale-down term.
Based on the above analysis, we propose new variants of A DAM and AMSG RAD , named A DA B OUND and AMSB OUND , which do not suffer from the negative impact of extreme learning rates.
We employ dynamic bounds on learning rates in these adaptive methods, where the lower and upper bound are initialized as zero and inﬁnity respectively, and they both smoothly converge to a constant ﬁnal step size.
The new variants can be regarded as adaptive methods at the beginning of training, and they gradually and smoothly transform to S GD (or with momentum) as time step increases.
In this framework, we can enjoy a rapid initial training process as well as good ﬁnal generalization ability.
We provide a convergence analysis for the new variants in the convex setting.
We ﬁnally turn to an empirical study of the proposed methods on various popular tasks and models in computer vision and natural language processing.
Experimental results demonstrate that our methods have higher learning speed early in training and in the meantime guarantee strong generalization performance compared to several adaptive and non-adaptive methods.
Moreover, they can bring considerable improvement over their prototypes especially on complex deep networks.
N OTATIONS AND P RELIMINARIES
Notations Given a vector θ ∈ R
d
we denote its i -th coordinate by θ i ; we use θ k to denote elementwise power of k and (cid:107) θ (cid:107) to denote its (cid:96) 2 -norm; for a vector θ t in the t -th iteration, the i -th coordinate of θ t is denoted as θ t,i by adding a subscript i .
Given two vectors v, w ∈ R d , we use (cid:104) v, w (cid:105) to denote their inner product, v (cid:12) w to denote element-wise product, v/w to denote element-wise division, max( v, w ) to denote element-wise maximum and min( v, w ) to denote element-wise minimum.
We use S d + to denote the set of all positive deﬁnite d × d matrices.
For a vector a ∈ R d and a positive deﬁnite matrix M ∈ R d × d , we use a/M to denote M − 1 a and √ M to denote M 1 / 2 .
The projection operation Π F ,M ( y ) for M ∈ S d
+ is deﬁned as arg min x ∈F (cid:107) M 1 / 2 ( x − y )
(cid:107) for y ∈ R d .
We say F has bounded diameter D ∞ if (cid:107) x − y (cid:107) ∞ ≤ D ∞ for all x, y ∈ F .
Online convex programming A ﬂexible framework to analyze iterative optimization methods is the online optimization problem .
It can be formulated as a repeated game between a player (the algorithm) and an adversary.
At step t , the algorithm chooses an decision x t ∈ F , where F ⊂ R d is a convex feasible set.
Then the adversary chooses a convex loss function f t and the algorithm incurs loss f t ( x t ) .
The difference between the total loss (cid:80) Tt =1 f t ( x t ) and its minimum value for a ﬁxed decision is known as the regret , which is represented by R T =
(cid:80) Tt =1 f t ( x t )
− min x ∈F (cid:80) Tt =1 f t ( x ) .
Throughout this paper, we assume that the feasible set F has bounded diameter and (cid:107)∇ f t ( x ) (cid:107) ∞ is bounded for all t ∈ [ T ] and x ∈ F .
We are interested in algorithms with little regret.
Formally speaking, our aim is to devise an algorithm that ensures R T
= o ( T ) , which implies that on average, the model’s performance converges to the optimal one.
It has been pointed out that an online optimization algorithm with vanishing average regret yields a corresponding stochastic optimization algorithm (Cesa-Bianchi et al., 2002).
Thus, following Reddi et al.
(2018), we use online gradient descent and stochastic gradient descent synonymously.
A generic overview of optimization methods We follow Reddi et al.
(2018) to provide a generic framework of optimization methods in Algorithm 1 that encapsulates many popular adaptive and non-adaptive methods.
This is useful for understanding the properties of different optimization methods.
Note that the algorithm is still abstract since the functions φ t : F t → R d and ψ t :
F d → S d + have not been speciﬁed.
In this paper, we refer to α as initial step size and α t / √ V t as learning rate of the algorithm.
Note that we employ a design of decreasing step size by α t = α/ √ t for it is required for theoretical proof of convergence.
However such an aggressive decay of step size typically translates into poor empirical performance, while a simple constant step size α t = α usually works well in practice.
For the sake of clarity, we will use the decreasing scheme for theoretical analysis and the constant schemem for empirical study in the rest of the paper.
Under such a framework, we can summarize the popular optimization methods in Table 1.
A few remarks are in order.
We can see the scaling term ψ t is I in S GD (M), while adaptive methods introduce different kinds of averaging of the squared values of past gradients.
A DAM and RMS PROP can be seen as variants of A DA G RAD , where the former ones use an exponential moving average as function ψ t instead of the simple average used in A DA G RAD .
In particular, RMS PROP is essentially a special case of A DAM with β 1 = 0 .
AMSG RAD is not listed in the table as it does not has a simple expression of ψ t .
It can be deﬁned as ψ t =
diag(ˆ v t ) where ˆ v t is obtained by the following recursion: v t =
β 2 v t − 1 + (1 − β 2 ) g 2 t
and ˆ v t
=
max(ˆ v t − 1 , v t ) with ˆ v 0 = v 0 = 0 .
The deﬁnition of φ t is same with that of A DAM .
In the rest of the paper we will mainly focus on A DAM due to its generality but our arguments also apply to other similar adaptive methods such as RMS PROP and AMSG RAD .
[Table]
T HE N ON -C ONVERGENCE C AUSED BY E XTREME L EARNING R ATE
In this section, we elaborate the primary defect in current adaptive methods with a preliminary experiment and a rigorous proof.
As mentioned above, adaptive methods like A DAM are observed to perform worse than S GD .
Reddi et al.
(2018) proposed AMSG RAD to solve this problem but recent work has pointed out AMSG RAD does not show evident improvement over A DAM (Keskar &
Socher, 2017; Chen et al., 2018).
Since AMSG RAD is claimed to have a smaller learning rate compared with A DAM , the authors only consider large learning rates as the cause for bad performance of A DAM .
However, small ones might be a pitfall as well.
Thus, we speculate both extremely large and small learning rates of A DAM are likely to account for its ordinary generalization ability.
For corroborating our speculation, we sample learning rates of several weights and biases of ResNet34 on CIFAR-10 using A DAM .
Speciﬁcally, we randomly select nine 3 × 3 convolutional kernels from different layers and the biases in the last linear layer.
As parameters of the same layer usually have similar properties, here we only demonstrate learning rates of nine weights sampled from nine kernels respectively to visualize them.
As shown in Figure 1, we can ﬁnd that when the model is close to convergence, learning rates are composed of tiny ones less than 0 .
01 as well as huge ones greater than 1000 .
w w w w w w w w w b -5.8 -3.7 -3.4 -3.
The above analysis and observation show that there are indeed learning rates which are too large or too small in the ﬁnal stage of the training process.
AMSG RAD may help abate the impact of huge learning rates, but it neglects the other side of the coin.
Insofar, we still have the following two doubts.
First, does the tiny learning rate really do harm to the convergence of A DAM ?
Second, as the learning rate highly depends on the initial step size, can we use a relatively larger initial step size α to get rid of too small learning rates?
To answer these questions, we show that undesirable convergence behavior for A DAM and RMS PROP can be caused by extremely small learning rates, and furthermore, in some cases no matter how large the initial step size α is, A DAM will still fail to ﬁnd the right path and converge to some highly suboptimal points.
Consider the following sequence of linear functions for F = [ − 2 , 2] : f t ( x ) =
  − 100 , for x < 0; 0 , for x > 1; − x, for 0 ≤ x ≤ 1 and t mod C = 1; 2 x, for 0 ≤ x ≤ 1 and t mod C = 2; 0 , otherwise where C ∈ N satisﬁes: 5 β C − 2≤ (1 − β 2 ) / (4 − β 2 ) .
For this function sequence, it is easy to see any point satisfying x < 0 provides the minimum regret.
Supposing β 1 = 0 , we show that A DAM converges to a highly suboptimal solution of x ≥ 0 for this setting.
Intuitively, the reasoning is as follows.
The algorithm obtains a gradient − 1 once every C steps, which moves the algorithm in the wrong direction.
Then, at the next step it observes a gradient 2 .
But the larger gradient 2 is unable to counteract the effect to wrong direction since the learning rate at this step is scaled down to a value much less than the previous one, and hence x becomes larger and larger as the time step increases.
We formalize this intuition in the result below.
Theorem 1.
There is an online convex optimization problem where for any initial step size α , A DAM has non-zero average regret i.e., R T /T (cid:57) 0 as T → ∞ .
We relegate all proofs to the appendix.
Note that the above example also holds for constant step size α t
= α .
Also note that vanilla S GD does not suffer from this problem.
There is a wide range of valid choices of initial step size α where the average regret of S GD asymptotically goes to 0 , in other words, converges to the optimal solution.
This problem can be more obvious in the later stage of a training process in practice when the algorithm gets stuck in some suboptimal points.
In such cases, gradients at most steps are close to 0 and the average of the second order momentum may be highly various due to the property of exponential moving average.
Therefore, “correct” signals which appear with a relatively low frequency (i.e. gradient 2 every C steps in the above example) may not be able to lead the algorithm to a right path, if they come after some “wrong” signals (i.e. gradient 1 in the example), even though the correct ones have larger absolute value of gradients.
One may wonder if using large β 1 helps as we usually use β 1 close to 1 in practice.
However, the following result shows that for any constant β 1 and β 2 with β 1 < √ β 2 , there exists an example where A DAM has non-zero average regret asymptotically regardless of the initial step size α .
Theorem 2.
For any constant β 1 , β 2 ∈ [0 , 1) such that β 1 < √ β 2 , there is an online convex optimization problem where for any initial step size α , A DAM has non-zero average regret i.e.,
R T /T (cid:57) 0 as T → ∞ .
Furthermore, a stronger result stands in the easier stochastic optimization setting.
Theorem 3.
For any constant β 1 , β 2 ∈ [0 , 1) such that β 1 < √ β 2 , there is a stochastic convex optimization problem where for any initial step size α , A DAM does not converge to the optimal solution.
Remark.
The analysis of A DAM in Kingma & Lei Ba (2015) relies on decreasing β 1 over time, while here we use constant β 1 .
Indeed, since the critical parameter is β 2 rather than β 1 in our analysis, it is quite easy to extend our examples to the case using decreasing scheme of β 1 .
As mentioned by Reddi et al.
(2018), the condition β 1 < √ β 2 is benign and is typically satisﬁed in the parameter settings used in practice.
Such condition is also assumed in convergence proof of
Kingma & Lei Ba (2015).
The above results illustrate the potential bad impact of extreme learning rates and algorithms are unlikely to achieve good generalization ability without solving this problem.
A DAPTIVE M OMENT E STIMATION WITH D YNAMIC B OUND
In this section we develop new variants of optimization methods and provide their convergence analysis.
Our aim is to devise a strategy that combines the beneﬁts of adaptive methods, viz.
fast initial progress, and the good ﬁnal generalization properties of S GD .
Intuitively, we would like to construct an algorithm that behaves like adaptive methods early in training and like S GD at the end.
Algorithm 2 A
B
1: Set
2: for t
T do 3:
∇ f t
4: m t = β 1 t m t − 1 + (1 − β 1 t ) g t 5: v t = β 2 v t − 1 + (1 − β 2 ) g 2 t
V t = diag( v t ) 6: u
7: x
−
8: end for
Inspired by gradient clipping , a popular technique used in practice that clips the gradients larger than a threshold to avoid gradient explosion, we employ clipping on learning rates in A DAM to propose
A DA B OUND in Algorithm 2.
Consider applying the following operation in A DAM
[Equation]
which clips the learning rate element-wisely such that the output is constrained to be in [ η l , η u ] .
It follows that S GD (M) with α = α ∗ can be considered as the case where η l = η u = α ∗ .
As for A DAM , η l = 0 and η u = ∞ .
Now we can provide the new strategy with the following steps.
We employ η l and η u as functions of t instead of constant lower and upper bound, where η l ( t ) is a non-decreasing function that starts from 0 as t = 0 and converges to α ∗ asymptotically; and η u ( t ) is a non-increasing function that starts from ∞ as t = 0 and also converges to α ∗ asymptotically.
In this setting, A DA B OUND behaves just like A DAM at the beginning as the bounds have very little impact on learning rates, and it gradually transforms to S GD (M) as the bounds become more and more restricted.
We prove the following key result for A DA B OUND .
Theorem 4.
Let { x t } and { v t } be the sequences obtained from Algorithm 2, β 1 = β 11 , β 1 t ≤ βfor all t ∈
[ T ] and β 1 / √ β 2 < 1 .
Suppose η l ( t + 1) ≥ η l ( t ) > 0 , η u ( t + 1) ≤ η u ( t ) , η l ( t ) → α ∗ as t → ∞ , η u ( t ) → α ∗ as t → ∞ , L ∞ =
η l (1) and R ∞ =
η u (1) .
Assume that (cid:107) x − y (cid:107) ∞ ≤ D ∞ for all x, y ∈ F and (cid:107)∇ f t ( x ) (cid:107) ≤ G 2 for all t ∈
[ T ] and x ∈ F .
For x t generated using the
A DA B OUND algorithm, we have the following bound on the regret
[Equation]
The following result falls as an immediate corollary of the above result.
Corollary
[Equation]
Suppose β 1 t = β 1 λ t − 1 in Theorem 4, we have
[Equation]
It is easy to see that the regret of A DA B OUND is upper bounded by O ( √ T ) .
Similar to Reddi et al.
(2018), one can use a much more modest momentum decay of β 1 t = β 1 /t and still ensure a regret of O ( √ T ) .
It should be mentioned that one can also incorporate the dynamic bound in
AMSG RAD .
The resulting algorithm, namely AMSB OUND , also holds a regret of O ( √ T ) and the proof of convergence is almost same to Theorem 4 (see Appendix F for details).
In next section we will see that AMSB OUND has similar performance to A DA B OUND in several well-known tasks.
We end this section with a comparison to the previous work.
For the idea of transforming A DAM to S GD , there is a similar work by Keskar & Socher (2017).
The authors propose a measure that uses A DAM at ﬁrst and switches the algorithm to S GD at some speciﬁc step.
Compared with their approach, our methods have two advantages.
First, whether there exists a ﬁxed turning point to distinguish A DAM and S GD is uncertain.
So we address this problem with a continuous transforming procedure rather than a “hard” switch.
Second, they introduce an extra hyperparameter to decide the switching time, which is not very easy to ﬁne-tune.
As for our methods, the ﬂexible parts introduced are two bound functions.
We conduct an empirical study of the impact of different kinds of bound functions.
The results are placed in Appendix G for we ﬁnd that the convergence target α ∗ and convergence speed are not very important to the ﬁnal results.
For the sake of clarity, we will use η l ( t ) = 0 .
1 − 0 .
[Equation]
β 2 ) t +1 and η u ( t ) = 0 .
1+ 0 .
1 (1 − β 2 ) t in the rest of the paper unless otherwise speciﬁed.
E XPERIMENTS
In this section, we turn to an empirical study of different models to compare new variants with popular optimization methods including S GD (M), A DA G RAD , A DAM , and AMSG RAD .
We focus on three tasks: the MNIST image classiﬁcation task (Lecun et al., 1998), the CIFAR-10 image classiﬁcation task (Krizhevsky & Hinton, 2009), and the language modeling task on Penn Treebank (Marcus et al., 1993).
We choose them due to their broad importance and availability of their architectures for reproducibility.
The setup for each task is detailed in Table 2.
We run each experiment three times with the speciﬁed initialization method from random starting points.
A ﬁxed budget on the number of epochs is assigned for training and the decay strategy is introduced in following parts.
We choose the settings that achieve the lowest training loss at the end.
[Table]
5. H YPERPARAMETER T UNING
Optimization hyperparameters can exert great impact on ultimate solutions found by optimization algorithms so here we describe how we tune them.
To tune the step size, we follow the method in Wilson et al.
We implement a logarithmically-spaced grid of ﬁve step sizes.
If the best performing parameter is at one of the extremes of the grid, we will try new grid points so that the best performing parameters are at one of the middle points in the grid.
Speciﬁcally, we tune over hyperparameters in the following way.
S
[Equation]
For tuning the step size of S GD (M), we ﬁrst coarsely tune the step size on a logarithmic scale from { 100 , 10 , 1 , 0 . 1 , 0 . 01 } and then ﬁne-tune it.
Whether the momentum is used depends on the speciﬁc model but we set the momentum parameter to default value 0 .
9 for all our experiments.
We ﬁnd this strategy effective given the vastly different scales of learning rates needed for different modalities.
For instance, S GD with α = 10 performs best for language modeling on PTB but for the
ResNet-34 architecture on CIFAR-10, a learning rate of 0 .
1 for S GD is necessary.
A DA G RAD
The initial set of step sizes used for A DA G RAD are: { 5 e- 2 , 1 e- 2 , 5 e- 3 , 1 e- 3 , 5 e- 4 } .
For the initial accumulator value, we choose the recommended value as 0 .
A DAM & AMSG RAD
We employ the same hyperparameters for these two methods.
The initial step sizes are chosen from: { 1 e- 2 , 5 e- 3 , 1 e- 3 , 5 e- 4 , 1 e- 4 } .
We turn over β 1 values of { 0 . 9 , 0 . 99 } and β 2 values of { 0 . 99 , 0 . 999 } .
We use for the perturbation value (cid:15)
= 1 e- 8 .
A DA B OUND & AMSB OUND
We directly apply the default hyperparameters for A DAM (a learning rate of 0 .
001 , β 1 = 0 .
9 and β 2 = 0 .
in our proposed methods.
Note that for other hyperparameters such as batch size, dropout probability, weight decay and so on, we choose them to match the recommendations of the respective base architectures.
5. F EEDFORWARD N EURAL N ETWORK
We train a simple fully connected neural network with one hidden layer for the multiclass classiﬁcation problem on MNIST dataset.
We run 100 epochs and omit the decay scheme for this experiment.
Figure 2 shows the learning curve for each optimization method on both the training and test set.
We ﬁnd that for training, all algorithms can achieve the accuracy approaching 100% .
For the test part, S GD performs slightly better than adaptive methods A DAM and AMSG RAD .
Our two proposed methods, A DA B OUND and AMSB OUND , display slight improvement, but compared with their prototypes there are still visible increases in test accuracy.
[Figure]
C ONVOLUTIONAL N EURAL N ETWORK
Using DenseNet-121 (Huang et al., 2017) and ResNet-34 (He et al., 2016), we then consider the task of image classiﬁcation on the standard CIFAR-10 dataset.
In this experiment, we employ the ﬁxed budget of 200 epochs and reduce the learning rates by 10 after 150 epochs.
DenseNet We ﬁrst run a DenseNet-121 model on CIFAR-10 and our results are shown in Figure 3.
We can see that adaptive methods such as A DA G RAD , A DAM and AMSG RAD appear to perform better than the non-adaptive ones early in training.
But by epoch 150 when the learning rates are decayed, S GD M begins to outperform those adaptive methods.
As for our methods, A DA B OUND and AMSB OUND , they converge as fast as adaptive ones and achieve a bit higher accuracy than
S GD M on the test set at the end of training.
In addition, compared with their prototypes, their performances are enhanced evidently with approximately 2% improvement in the test accuracy.
ResNet Results for this experiment are reported in Figure 3.
As is expected, the overall performance of each algorithm on ResNet-34 is similar to that on DenseNet-121.
A DA B OUND and
AMSB OUND even surpass S GD M by 1% .
Despite the relative bad generalization ability of adaptive methods, our proposed methods overcome this drawback by allocating bounds for their learning rates and obtain almost the best accuracy on the test set for both DenseNet and ResNet on CIFAR-10.
5. R ECURRENT N EURAL N ETWORK
Finally, we conduct an experiment on the language modeling task with Long Short-Term Memory (LSTM) network (Hochreiter & Schmidhuber, 1997).
From two experiments above, we observe that
[Figure]
our methods show much more improvement in deep convolutional neural networks than in perceptrons.
Therefore, we suppose that the enhancement is related to the complexity of the architecture and run three models with ( L1 ) 1-layer, ( L2 ) 2-layer and ( L3 ) 3-layer LSTM respectively.
We train them on Penn Treebank, running for a ﬁxed budget of 200 epochs.
We use perplexity as the metric to evaluate the performance and report results in Figure
[Figure]
r p l
[Figure]
x i t
[Figure]
We ﬁnd that in all models, A DAM has the fastest initial progress but stagnates in worse performance than S GD and our methods.
Different from phenomena in previous experiments on the image classiﬁcation tasks, A DA B OUND and AMSB OUND does not display rapid speed at the early training stage but the curves are smoother than that of S GD
[Figure]
Comparing L1, L2 and L3, we can easily notice a distinct difference of the improvement degree.
In L1, the simplest model, our methods perform slightly 1 .
1% better than A DAM while in L3, the most complex model, they show evident improvement over 2 .
8% in terms of perplexity.
It serves as evidence for the relationship between the model’s complexity and the improvement degree.
5. A NALYSIS
To investigate the efﬁcacy of our proposed algorithms, we select popular tasks from computer vision and natural language processing.
Based on results shown above, it is easy to ﬁnd that A DAM and
AMSG RAD usually perform similarly and the latter does not show much improvement for most cases.
Their variants, A DA B OUND and AMSB OUND , on the other hand, demonstrate a fast speed of convergence compared with S GD while they also exceed two original methods greatly with respect to test accuracy at the end of training.
This phenomenon exactly conﬁrms our view mentioned in
Section 3 that both large and small learning rates can inﬂuence the convergence.
Besides, we implement our experiments on models with different complexities, consisting of a perceptron, two deep convolutional neural networks and a recurrent neural network.
The perceptron used on the MNIST is the simplest and our methods perform slightly better than others.
As for
DenseNet and ResNet, obvious increases in test accuracy can be observed.
We attribute this difference to the complexity of the model.
Speciﬁcally, for deep CNN models, convolutional and fully connected layers play different parts in the task.
Also, different convolutional layers are likely to be responsible for different roles (Lee et al., 2009), which may lead to a distinct variation of gradients of parameters.
In other words, extreme learning rates (huge or tiny) may appear more frequently in complex models such as ResNet.
As our algorithms are proposed to avoid them, the greater enhancement of performance in complex architectures can be explained intuitively.
The higher improvement degree on LSTM with more layers on language modeling task also consists with the above analysis.
F UTURE W ORK
Despite superior results of our methods, there still remain several problems to explore.
For example, the improvement on simple models are not very inspiring, we can investigate how to achieve higher improvement on such models.
Besides, we only discuss reasons for the weak generalization ability of adaptive methods, however, why S GD usually performs well across diverse applications of machine learning still remains uncertain.
Last but not least, applying dynamic bounds on learning rates is only one particular way to conduct gradual transformation from adaptive methods to S GD .
There might be other ways such as well-designed decay that can also work, which remains to explore.
C ONCLUSION
We investigate existing adaptive algorithms and ﬁnd that extremely large or small learning rates can result in the poor convergence behavior.
A rigorous proof of non-convergence for A DAM is provided to demonstrate the above problem.
Motivated by the strong generalization ability of S GD , we design a strategy to constrain the learning rates of A DAM and AMSG RAD to avoid a violent oscillation.
Our proposed algorithms, A DA B OUND and AMSB OUND , which employ dynamic bounds on their learning rates, achieve a smooth transition to S GD .
They show the great efﬁcacy on several standard benchmarks while maintaining advantageous properties of adaptive methods such as rapid initial progress and hyperparameter insensitivity.
A CKNOWLEDGMENTS
We thank all reviewers for providing the constructive suggestions.
We also thank Junyang Lin and
Ruixuan Luo for proofreading and doing auxiliary experiments.
Xu Sun is the corresponding author of this paper.
A PPENDIX A A UXILIARY L EMMAS
Lemma 1 (Mcmahan & Streeter (2010)) .
For any Q ∈ S d + and convex feasible set F ⊂ R d , suppose u 1 = min x ∈F (cid:107) Q 1 / 2 ( x − z 1 ) (cid:107) and u 2 = min x ∈F (cid:107) Q 1 / 2 ( x − z 2 ) (cid:107) then we have (cid:107) Q 1 / 2 ( u 1 − u 2 ) (cid:107) ≤ (cid:107) Q 1 / 2 ( z 1 − z 2 ) (cid:107) .
Proof.
We provide the proof here for completeness.
Since u 1 = min x ∈F (cid:13)(cid:13) Q 1 / 2 ( x − z 1 ) (cid:13)(cid:13) and u 2 = min x ∈F (cid:13)(cid:13) Q 1 / 2 ( x − z 2 ) (cid:13)(cid:13) and from the property of projection operator we have the following: (cid:104) u
1 − z 1 , Q ( u 2 − u 1 ) (cid:105) ≥ 0 and (cid:104) u 2 − z 2 , Q ( u 1 −
[Equation]
) (cid:105)
[Equation]
Combining the above inequalities, we have
[Equation]
Also, observe the following:
[Equation]
The above inequality can be obtained from the fact that
[Equation]
and rearranging the terms.
Combining the above inequality with Equation (1), we have the required the result.
Lemma 2.
Suppose m t = β 1 m t − 1 + (1 − β 1 ) g t with m 0 = 0 and 0 ≤ β 1 < 1 .
We have
[Equation]
Proof.
If β 1 = 0 , the equality directly holds due to m t = g t .
Otherwise, 0 < β 1 < 1 .
For any θ >we have
[Equation]
The inequality follows from Cauchy–Schwarz and Young’s inequality.
In particular, let θ = 1 /β 1 − 1 .
Then we have
[Equation]
Dividing both sides by β t 1 , we get
[Equation]
m t − 1 (cid:107)β t − 1+ (1 − β 1 ) (cid:107) g t (cid:107)β t.
Note that m 0 = 0 .
Hence, (cid:107) m t (cid:107)β t≤ (1 − β 1 ) t (cid:88) i
= (cid:107) g
i (cid:107) 2 β − i 1 .
Then multiplying both sides by β t 1 we obtain (cid:107) m t (cid:107) 2 ≤ (1 − β 1 ) t (cid:88)
i
=
(cid:107) g
i (cid:107) 2 β t − i 1 .
Take the summation of above inequality over t = 1 , 2 , · · · , T , we have
T (cid:88)
[Equation]
(cid:88)
[Equation]
(cid:88)
[Equation]
(cid:88)
[Equation]
(cid:88)
[Equation]
(cid:107)
[Equation]
≤
[Equation]
(cid:88)
[Equation]
(cid:107)
[Equation]
The second inequality is due to the following fact of geometric series
[Equation]
We complete the proof.
B P ROOF OF T HEOREM
Proof.
First, we rewrite the update of A DAM in Algorithm 1 in the following recursion form:
[Equation]
where m 0 ,i
=
and v 0 ,i =
for all i ∈ [ d ] and ψ t = diag( v t ) .
We consider the setting where f t are linear functions and F = [ − 2 , 2] .
In particular, we deﬁne the following function sequence:
[Equation]
t
[Equation]
 
[Equation] [Equation]
for x < 0; 0 , for x > 1; − x, for 0 ≤ x ≤ 1 and t mod C = 1; 2 x, for 0 ≤ x ≤ 1 and t mod C = 2; 0 , otherwise where C ∈ N satisﬁes the following:
[Equation]
It is not hard to see that the condition hold for large constant C that depends on β 2 .
Since the problem is one-dimensional, we drop indices representing coordinates from all quantities in Algorithm 1.
For this function sequence, it is easy to see that any point satisfying x < 0 provides the minimum regret.
Without loss of generality, assume that the initial point is x 1 = 0 .
This can be assumed without any loss of generality because for any choice of initial point, we can always translate the coordinate system such that the initial point is x
1 = 0 in the new coordinate system and then choose the sequence of functions as above in the new coordinate system.
Consider the execution of A DAM algorithm for this sequence of functions with β 1 = 0 .
Note that since gradients of these functions are bounded, F has bounded D ∞ diameter and β 21 /β 2 < 1 as β 1 = 0 .
Hence, the conditions on the parameters required for A DAM are satisﬁed (Kingma & Lei Ba, 2015).
Our claim is that for any initial step size α , we have x t ≥ 0 for all t ∈ N .
To prove this, we resort to the principle of mathematical induction.
Suppose for some t ∈ N , we have x Ct +1 ≥ 0 .
Our aim is to prove that x i ≥ 0 for all i ∈ N ∩
[ Ct + 2 , Ct + C + 1] .
It is obvious that the conditions holds if x Ct +1 > 1 .
Now we assume x Ct +1 ≤ 1 .
We observe that the gradients have the following form:
[Equation]
From the ( Ct + 1) -th update of A DAM in Equation (2), we obtain:
[Equation]
We consider the following two cases: 1.
Suppose ˆ x Ct +2 > 1 , then x Ct +
=
Π F (ˆ x Ct +2 )
=
min(ˆ x Ct +2 , 2) > 1 (note that in one-dimension, Π F , √ V t =
Π F is the simple Euclidean projection).
It is easy to see that x
i = x
Ct +2 ≥ 0 for all the following i as all the following gradients will equal to 0 .
Suppose ˆ x Ct +2 ≤ 1 , then after the ( Ct + 2) -th update, we have:
[Equation]
which translates to x Ct +
=
ˆ x Ct +3 ≥ 0 .
The ﬁrst inequality follows from x Ct +2 =
ˆ x Ct +
and x Ct +1 ≥ 0 .
The last inequality is due to the following lower bound:
[Equation]
The second inequality follows from β 2 < 1 .
The last inequality follows from Equation (3).
Furthermore, since gradients equal to 0 when x i ≥ 0 and i mod C (cid:54)
= 1 or 2 , we have
[Equation]
Therefore, given x 1 = 0 , it holds for all t ∈ N by the principle of mathematical induction.
Thus, we have
C (cid:88) i =
f kC
[Equation]
i ( x kC
[Equation]
i ) −
C (cid:88) i =
f kC
+ i ( − 2) ≥ 0 − ( − 100 C ) = 100 C, where k ∈ N .
Therefore, for every C steps, A DAM suffers a regret of 100 C .
More speciﬁcally,
R T ≥ 100 CT/C = 100 T .
Thus, R T /T (cid:57) 0 as T → ∞ , which completes the proof.
C P ROOF OF T HEOREM
Theorem 2 generalizes the optimization setting used in Theorem 1.
We notice that the example proposed by Reddi et al.
(2018) in their Appendix B already satisﬁes the constraints listed in Theorem 2.
Here we provide the setting of the example for completeness.
Proof.
Consider the setting where f t are linear functions and F = [ − 1 , 1] .
In particular, we deﬁne the following function sequence:
[Equation]
where C ∈ N , C mod 2 = 0 satisﬁes the following:
[Equation]
where γ = β 1 / √ β 2 < 1 .
It is not hard to see that these conditions hold for large constant C that depends on β 1 and β 2 .
According to the proof given by Reddi et al.
(2018) in their Appendix B, in such a setting R T /T (cid:57) 0 as T → ∞ , which completes the proof.
D P ROOF OF T HEOREM
The example proposed by Reddi et al.
(2018) in their Appendix C already satisﬁes the constraints listed in Theorem 3.
Here we provide the setting of the example for completeness.
Proof.
Let δ be an arbitrary small positive constant.
Consider the following one dimensional stochastic optimization setting over the domain [ − 1 , 1] .
At each time step t , the function f t ( x ) is chosen as follows:
[Equation]
where C is a large constant that depends on β 1 , β 2 and δ .
The expected function is F ( x ) = δx .
Thus the optimal point over [ − 1 , 1] is x ∗ = − 1 .
The step taken by A DAM is
[Equation]
According to the proof given by Reddi et al.
(2018) in their Appendix C, there exists a large enough
C such that E [∆ t ] ≥ 0 , which then implies that the A DAM ’s step keep drifting away from the optimal solution x ∗ = − 1 .
Note that there is no limitation of the initial step size α by now.
Therefore, we complete the proof.
E P ROOF OF T HEOREM
Proof.
Let x ∗ =
arg min x ∈F (cid:80) Tt =1 f t ( x ) , which exists since F is closed and convex.
We begin with the following observation:
[Equation]
Using Lemma 1 with u 1 = x t +1 and u 2 = x ∗
[Equation]
we have the following:
[Equation]
Rearranging the above inequality, we have
[Equation]
The second inequality follows from simple application of Cauchy–Schwarz and Young’s inequality.
We now use the standard approach of bounding the regret at each step using convexity of the functions { f t } Tt =1 in the following manner:
[Equation]
The ﬁrst inequality is due to the convexity of functions { f t } Tt =1 .
The second inequality follows from the bound in Equation (4).
For further bounding this inequality, we need the following intermedia result.
Lemma 3.
For the parameter settings and conditions assumed in Theorem
[Equation]
we have
[Equation]
Proof.
By deﬁnition of η t
[Equation]
we have
[Equation]
[Table]
[Equation]
The second inequality is due to β 1 t ≤ β 1 < 1 .
The third inequality follows from Jensen inequality and the fourth inequality follows from Cauchy–Schwarz inequality.
The ﬁfth inequality follows from Lemma 2 and m 0 = 0 .
The last inequality is due to the following upper bound:
[Equation]
We complete the proof of this lemma.
We now return to the proof of Theorem 4.
Using the above lemma in Equation (5), we have
T (cid:88)
[Equation]
The second inequality use the fact that β 1 t ≤ β 1 < 1 .
In order to further simplify the bound in
Equation (6), we need to use telescopic sum.
We observe that, by deﬁnition of η t , we have
[Equation]
Using the D ∞ bound on the feasible region and making use of the above property in Equation (6), we have T
[Equation]
The equality follows from simple telescopic sum, which yields the desired result.
It is easy to see that the regret of A DA B OUND is upper bounded by O ( √ T ) .
[Equation]
) 4: m t = β 1 t m t − 1 + (1 − β 1 t ) g t 5: v t = β 2 v t − 1 + (1 − β 2 ) g 2 t 6: ˆ v t
=
max(ˆ v t − 1 , v t ) and V t = diag(ˆ v t ) 7: η = Clip( α/ √ V t , η l ( t ) , η u ( t )) and η t =
η/ √ t 8: x t
+1 =
Π F , diag( η − 1 t ) ( x t − η t (cid:12) m t ) 9: end for
Theorem 5.
Let { x t } and { v t } be the sequences obtained from Algorithm 3, β 1 = β 11 , β 1 t ≤ βfor all t ∈
[ T ] and β 1 / √ β 2 < 1 .
Suppose η l ( t + 1) ≥ η l ( t ) > 0 , η u ( t + 1) ≤ η u ( t ) , η l ( t ) → α ∗ as t → ∞ , η u ( t ) → α ∗ as t → ∞ , L ∞ =
η l (1) and R ∞ =
η u (1) .
Assume that (cid:107) x − y (cid:107) ∞ ≤ D ∞ for all x, y ∈ F and (cid:107)∇ f t ( x ) (cid:107) ≤ G 2 for all t ∈
[ T ] and x ∈ F .
For x t generated using the
A DA B OUND algorithm, we have the following bound on the regret
[Equation]
The regret of AMSB OUND has the same upper bound with that of A DA B OUND .
G E MPIRICAL S TUDY ON B OUND F UNCTIONS
Here we provide an empirical study on different kinds of bound functions.
We consider the following two key factors of the bound function: convergence speed and convergence target.
The former one affects how “fast” our algorithms transform from adaptive methods to S GD (M), while the latter one reﬂects the ﬁnal step size of S GD (M).
In particular, we consider the following bound functions:
[Equation]
where the above functions will converge to α ∗ and the larger β results in lower convergence speed.
[Figure]
We ﬁrst investigate the impact of convergence speed.
We conduct an experiment of A DA B OUND on
CIFAR-10 dataset with the ResNet-34 model
[Figure]
where β is chosen in { 1 − 110 , 1 − 150 , 1 − 1100 , 1 −500 , 1 − 1 1000 } and α ∗ is chosen from { 1 , 0 . 1 } .
The results are shown in Figure 5.
We can see that for a speciﬁc α ∗ , the performances with different β are almost the same .
It indicates that the convergence speed of bound functions does not affect the ﬁnal result to some extent.
We ﬁnd a β in [ β 1 , β 2 ] usually contributes to a strong performance across all models
[Figure]
The result of S GD M with α = 1 is not shown above as its performance is too poor (lower than 70% ) to be plotted together with other results in a single ﬁgure
[Figure]
Next, we investigate the impact of convergence target and the results are displayed in Figure 6.
We test S GD M and A DA B OUND with different α (or α ∗ ) with the ResNet-34 model, where α (or α ∗ ) is chosen in { 1 , 0 . 1 , 0 . 03 , 0 . 01 , 0 . 003 , 0 . 001 } and β = 0 .
The results show that S GD M is very sensitive to the hyperparameter.
The best value of the step size for S GD M is 0 .
and it has large performance gaps compared with other settings.
In contrast, A DA B OUND has stable performance in different ﬁnal step sizes, which illustrates that it is not sensitive to the convergence target.
We further directly compare the performance between S GD M and A DA B OUND with each α (or α ∗ ).
The results are shown in Figure 7.
We can see that A DA B OUND outperforms S GD M for all the step sizes.
Since the form of bound functions has minor impact on the performance of A DA B OUND , it is likely to beat S GD M even without carefully tuning the hyperparameters.
To summarize, the form of bound functions does not much inﬂuence the ﬁnal performance of the methods.
In other words, A DA B OUND is not sensitive to its hyperparameters.
Moreover, it can achieve a higher or similar performance to S GD M even if it is not carefully ﬁne-tuned.
Therefore, we can expect a better performance by using A DA B OUND regardless of the choice of bound functions.
H E MPIRICAL S TUDY ON T HE E VOLUTION OF L EARNING R ATES OVER T IME
Here we provide an empirical study on the evolution of learning rates of A DA B OUND over time.
We conduct an experiment using ResNet-34 model on CIFAR-10 dataset with the same settings in
Section 5.
We randomly choose two layers in the network.
For each layer, the learning rates of its parameters are recorded at each time step.
We pick the min/median/max values of the learning rates in each layer and plot them against epochs in Figure 8.
[Figure]
l e a r n i n g r a t e minmedianmax
We can see that the learning rates increase rapidly in the early stage of training, then after a few epochs its max/median values gradually decrease over time, and ﬁnally converge to the ﬁnal step size.
The increasing at the beginning is due to the property of the exponential moving average of φ t of A DAM , while the gradually decreasing indicates the transition from A DAM to S GD .