A MORTIZED N ESTEROV ’ S M OMENTUM : R OBUST AND L IGHTWEIGHT M OMENTUM FOR D EEP L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Stochastic Gradient Descent (SGD) with Nesterov’s momentum is a widely used optimizer in deep learning, which is observed to have excellent generalization performance.
In this work, we propose Amortized Nesterov’s Momentum , which is a special variant of Nesterov’s momentum. Compared with Nesterov’s momentum, our new momentum has more robust iterates and higher efﬁciency.
Our empirical results show that it achieves faster early convergence and comparable ﬁnal generalization performance with little-to-no tuning.
Just like Nesterov’s method, the new schemes are also proved optimal in general convex setting. Our analysis sheds light on the understanding of the new variant.
I NTRODUCTION
In recent years, Gradient Descent (GD) (Cauchy, 1847) and its variants have been widely used to solve large scale machine learning problems.
Among them, Stochastic Gradient Descent (SGD) (Robbins & Monro, 1951), which replaces gradient with an unbiased stochastic gradient estimator, is a popular choice of optimizer especially for neural network training which requires lower precision.
Sutskever et al.
(2013) found that using SGD with Nesterov’s momentum (Nesterov, 1983; 2013b), which was originally designed to accelerate deterministic convex optimization, achieves substantial speedups for training neural networks.
This ﬁnding essentially turns SGD with Nesterov’s momentum into the benchmarking method of neural network design, especially for classiﬁcation tasks (He et al., 2016b;a; Zagoruyko & Komodakis, 2016; Huang et al., 2017).
It is observed that in these tasks, the momentum technique plays a key role in achieving good generalization performance.
Adaptive methods (Duchi et al., 2011; Kingma & Ba, 2015; Tieleman & Hinton, 2012; Reddi et al., 2018), which are also becoming increasingly popular in the deep learning community, diagonally scale the gradient to speed up training.
However, Wilson et al.
(2017) show that these methods always generalize poorly compared with SGD with momentum (both classical momentum (Polyak, 1964) and Nesterov’s momentum).
In this work, we introduce Amortized Nesterov’s Momentum , which is a special variant of Nesterov’s momentum. From users’ perspective, the new momentum has only one additional integer hyper-parameter m to choose, which we call the amortization length.
Learning rate and momentum parameter of this variant are strictly aligned with Nesterov’s momentum and by choosing m = 1 , it recovers Nesterov’s momentum. This paper conducts an extensive study based on both empirical evaluation and convex analysis to identify the beneﬁts of the new variant (or from users’ angle, to set m apart from 1 ). We list the advantages of Amortized Nesterov’s Momentum as follows: • Increasing m improves robustness 1 .
This is an interesting property since the new momentum not only provides acceleration, but also enhances the robustness. We provide an understanding of this property by analyzing the relation between convergence rate and m in the convex setting. • Increasing m reduces (amortized) iteration complexity. A suitably chosen m boosts the convergence rate in the early stage of training and produces comparable ﬁnal generalization performance.
• It is easy to tune m .
The performances of the methods are stable for a wide range of m and we prove that the methods converge for any valid choice of m in the convex setting.
• If m is not too large, the methods obtain the optimal convergence rate in general convex setting, just like Nesterov’s method.
The new variant does have some minor drawbacks: it requires one more memory buffer, which is acceptable in most cases, and it shows some undesired behaviors when working with learning rate schedulers, which can be addressed by a small modiﬁcation.
Considering these pros and cons, we believe that the proposed variant can beneﬁt many large-scale deep learning tasks.
Our high level idea is simple: the stochastic Nesterov’s momentum can be unreliable since it is provided only by the previous stochastic iterate.
The iterate potentially has large variance, which may lead to a false momentum that perturbs the training process.
We thus propose to use the stochastic
Nesterov’s momentum based on several past iterates, which provides robust acceleration.
In other words, instead of immediately using an iterate to provide momentum, we put the iterate into an “amortization plan” and use it later.
P RELIMINARIES : SGD AND N ESTEROV ’ S M OMENTUM
We start with a review of SGD and Nesterov’s momentum.
We discuss some subtleties in the implementation and evaluation, which contributes to the interpretation of our methods.
Notations In this paper, we use x ∈ R d to denote the vector of model parameters.
(cid:107)·(cid:107) and (cid:104)· , ·(cid:105) denote the standard Euclidean norm and inner product, respectively.
Scalar multiplication for v ∈ R d and β ∈ R is denoted as β · v .
f : R d → R denotes the loss function to be minimized and ∇ f ( x ) represents the gradient of f evaluated at x .
We denote the unbiased stochastic gradient estimator of ∇ f ( x ) as ∇ f i ( x ) with the random variable i independent of x (e.g., using mini-batch).
We use x 0 ∈ R d to denote the initial guess.
SGD SGD has the following simple iterative scheme, where γ ∈ R denotes the learning rate:
[Equation]
Nesterov’s momentum The original Nesterov’s accelerated gradient (with constant step) (Nesterov, 1983; 2013b) has the following scheme 2 ( y ∈ R d , η, β ∈ R and y
= x 0 ):
[Equation]
where we call β · ( y k +1 − y k ) the momentum.
By simply replacing ∇ f ( x k ) with ∇ f i k ( x k ) , we obtain the SGD with Nesterov’s momentum, which is widely used in deep learning.
To make this point clear, recall that the reformulation in Sutskever et al.
(scheme (2), also the Tensorﬂow (Abadi et al., 2016) version) and the PyTorch (Paszke et al., 2017) version (scheme (3)) have the following schemes ( v, v pt ∈ R d and v 0 = v pt 0 = 0 ): for k ≥ 0 ,
[Equation]
Here the notations are modiﬁed based on their equivalence to scheme (1).
It can be veriﬁed that schemes (2) and (3) are equivalent to (1) through v k = β − 1 · ( x k − y k ) and v ptk =
η − 1 β − 1 · ( y k − x k ) , respectively (see Defazio (2018) for other equivalent forms of scheme (1)).
Interestingly, both PyTorch and Tensorﬂow 3 track the values { x k } , which we refer to as M-SGD .
This choice allows a consistent implementation when wrapped in a generic optimization layer (Defazio, 2018).
However, the accelerated convergence rate (in the convex case) is built upon { y k } (Nesterov, 2013b) and { x k } may not possess such a theoretical improvement.
We use OM-SGD to refer to the Original M-SGD that outputs { y k } .
[Figure]
How to compare SGD and M-SGD?
For the choice of γ for SGD and ( η, β ) for M-SGD, Ma &
Yarats (2019) ﬁxed the effective learning rate 4 γ = η
(1 − β ) − 1 in their experiments.
Here we ﬁx γ = η , which is a common choice with theoretical reasons: In general smooth convex optimization, γ and η should be smaller than 1 /L in both deterministic (Nesterov, 2013b) and stochastic cases(Lan, 2012), where L is the smoothness constant.
From the interpretation in Allen-Zhu & Orecchia (2017), η represents the learning rate for the gradient descent “inside” Nesterov’s method.
We report the results of training ResNet34 (He et al., 2016b) on CIFAR-10 (Krizhevsky et al., 2009) as our basic case study in Figure 1.
In this paper, all the multiple runs start with the same initial guess x 0 .
Figure 1a shows that SGD is faster in the ﬁrst 60 epochs but is surpassed by M-SGD in the ﬁnal stage, which veriﬁes the importance of momentum for achieving high accuracy.
Figure 1b depicts the robustness of M-SGD and SGD, which is one of the evaluation metrics in this paper.
Train-batch loss vs. Full-batch loss In Figure 1c, train-batch loss stands for the average of batch losses forwarded in an epoch, which is commonly used to indicate the training process in deep learning.
Full-batch loss is the average loss over the entire training dataset evaluated at the end of each epoch.
In terms of optimizer evaluation, full-batch loss is much more informative than trainbatch loss as it reveals the robustness of an optimizer.
However, full-batch loss is too expensive to evaluate and thus we only measure it on small datasets.
On the other hand, test accuracy couples optimization and generalization, but since it is also evaluated at the end of the epoch, its convergence is similar to full-batch loss.
Considering the basic usage of momentum in deep learning, we mainly use test accuracy to evaluate optimizers.
We provide more discussion on this issue in Appendix C.2.
M-SGD vs. OM-SGD We also include OM-SGD in Figure 1a.
In comparison, the peak accuracies of M-SGD and OM-SGD are 94.680% ± 0.160% and 94.804% ± 0.124% with average deviations at 1.040% and 0.634%, respectively.
This difference can be explained following the interpretation in Hinton (2012) that { x k } are the points after “jump” and { y k } are the points after “correction”.
A MORTIZED N ESTEROV ’ S M OMENTUM
In this section, we formally introduce SGD with Amortized Nesterov’s Momentum (AM1-SGD) in
Algorithm 1 with the following remarks:
Options It can be veriﬁed that if m = 1 , AM1-SGD with Option I degenerates to M-SGD and
Option II corresponds to OM-SGD.
Just like the case for M-SGD and OM-SGD, the accelerated convergence rate is built upon Option II while Option I is easier to be implemented in a generic optimization layer 6 .
Intuitively, Option I is SGD with amortized momentum and Option II applies an m -iterations tail averaging on Option I.
[Figure]
[Figure]
Algorithm 1 AM1-
Input: Initial guess x 0 , learning rate η , momentum β , amortization length m , iteration number K .
Initialize: x ← x 0 , ˜ x ← x 0 , ˜ x + ← 0 { a running average } .
1: for k = 0 , . . . , K − 1 do 2: x ← x − η · ∇ f i k ( x ) . 3: ˜ x + ← ˜ x
+ + 1 m · x.
{+4: if ( k + 1) mod m = 
+}
then 5: x ← x + β · (˜ x + − ˜ x ) .
{ adding amortized momentum } 6: ˜ x ← ˜ x + , ˜ x + ← 0 .
7: end if 8: end for
Output: Option I: x , Option II: ˜ x .
* The symbol ‘ ← ’ denotes assignment.
Efﬁciency We can improve the efﬁciency of Algorithm 1 by maintaining a running scaled momentum ˜ v + (cid:44) m · (˜ x + − ˜ x ) instead of the running average ˜ x + , by replacing the following steps in
Algorithm 1:
Initialize:
[Equation]
[Equation]
Step 6:
[Equation]
Then, in one m -iterations loop, for each of the ﬁrst m − 1 iterations, AM1-SGD requires 1 vector addition and 1 scaled vector addition.
At the m -th iteration, it requires 1 vector addition, 1 scalarvector multiplication and 3 scaled vector additions.
In comparison, M-SGD (standard PyTorch) requires 1 vector addition, 1 (in-place) scalar-vector multiplication and 2 scaled vector additions per iteration.
Thus, as long as m > 2 , AM1-SGD has lower amortized cost than M-SGD.
For memory complexity, AM1-SGD requires one more auxiliary buffer than M-SGD.
Tuning m
We did a parameter sweep for the choice of m in our basic case study.
We plot the peak (mean) and the average deviation of test accuracies over 5 runs against m in Figure 2a.
Note that m =1 corresponds to the results of M-SGD and OM-SGD, which are already given in Figure 1.
From this empirical result, m introduces a trade-off between peak accuracy and robustness (the convergence behaviors can be found in Appendix A.1).
Figure 2a suggests that m = 5 is a good choice for this task.
For simplicity, and also as a recommended setting, we ﬁx m =5 for the rest of experiments in this paper.
A momentum that increases robustness To provide a stronger justiﬁcation, we ran 20 seeds with m = 5 in Figure 2b and the detailed data are given in Figure 3 & Table 1.
The results show that the amortized momentum signiﬁcantly increases the robustness.
Intuitively, the gap between Option
I and Option II can be understood as the effect of tail averaging.
However, the large gap between
Option I and SGD is somewhat mysterious: what Option I does is to inject a very large momentuminto SGD every m iterations. It turns out that this momentum not only provides acceleration, but 80 Epoch T e s t
A cc u r a c y
S T D %
Test Accuracy STD
SGD M-SGD AM1-SGD-I
AM1-SGD-II
METHOD
[Table]
Figure also helps the algorithm become more robust than SGD.
This observation basically differentiates
AM1-SGD from a simple interpolation in-between M-SGD and SGD.
Learning rate scheduler issue We observed that when we use schedulers with a large decay factor and the momentum β is too large for the task (e.g., 0 .
995 for the task of this section), there would be a performance drop after the learning rate reduction.
We believe that it is caused by the different cardinalities of iterates being averaged in ˜ x + , which leads to a false momentum.
This issue is resolved by restarting the algorithm after each learning rate reduction inspired by (O’donoghue & Candes, 2015). We include more discussion and evidence in Appendix A.4.
3. AM2-SGD: A VARIANT WITH IDENTICAL ITERATIONS Algorithm
Input: Initial guess x 0 , amortization length m , a point table φ = [ φ· · · φ m ] ∈ R d × m , learning rate η , momentum β , iteration number K .
Initialize: φ 0 j = x 0 , ∀ j ∈ [ m ] *.
{ j k | j k ∈ [ m ] } K − 1 k =0 is a sequence of uniformly random indexes.
If Option II is used, ¯ φ 0 = x 0 .
{ a running average for the point table φ } [Table] φ k [Table]
1 j k [-+
-]= [Table] k − [Table]
= φ kj
[Table] j (cid:54) =
j k ).
[Table] k + [Table]
k +1 j k + β · ( φ k +1 j k +1 − φ kj k )
[-{ adding amortized momentum } 4: if Option II then ¯ φ k +
 = ¯ φ k + 1 m · (cid:0)-][Table]
[-φ k +
-][Table]
[Table] − [Table]
recommended
[Table] x K , Option II: ¯ φ K .
* [ m ] denotes the set { 1 , . . .
, m } .
While enjoying an improved efﬁciency, AM1-SGD does not have identical iterations 8 , which to some extent limits its extensibility to other settings (e.g., asynchronous setting).
In this section, we propose a variant of Amortized Nesterov’s Momentum (AM2-SGD, Algorithm 2) to address this problem.
To show the characteristics of AM2-SGD, we make the following remarks:
Trading memory for extensibility In expectation, the point table φ stores the most recent m iterations and thus the output ¯ φ K is an m -iterations tail average, which connects to AM1-SGD.
The relation between AM1-SGD and AM2-SGD resembles that of SVRG (Johnson & Zhang, 2013) and
SAGA (Defazio et al., 2014), the most popular methods in ﬁnite-sum convex optimization: to reuse the information from several past iterates, we can either maintain a “snapshot” that aggregates the information or keep the iterates in a table.
Options and convergence As in the case of AM1-SGD, if m = 1 , AM2-SGD with Option I corresponds to M-SGD and Option II is OM-SGD.
In our preliminary experiments, the convergence of AM2-SGD is similar to AM1-SGD and it also has the learning rate scheduler issue.
In our preliminary experiments (can be found in Appendix A), we observed that Option I is consistently worse than Option II and it does not seem to beneﬁt from increasing m .
Thus, we do not recommend using Option I.
We also set m = 5 for AM2-SGD for its evaluation due to the similarity.
Additional randomness { j k } In our implementation, at each iteration, we sample an index in [ m ] as j k +1 and obtain the stored index j k .
We observed that with Option I, AM2-SGD has much larger deviations than AM1-SGD, which we believe is caused by the additional random indexes { j k } .
C ONVERGENCE R ESULTS
The original Nesterov’s accelerated gradient is famous for its optimal convergence rates for solving convex problems.
In this section, we analyze the convergence rates for AM1-SGD and AM2-SGD in the convex case, which explicitly model the effect of amortization (i.e., m ).
While these rates do not hold for deep learning problems in general, they help us understand the observed convergence behaviors of the proposed methods, especially on how they differ from M-SGD ( m = 1 ). Moreover, the analysis also provides intuition on tuning m . Since the original Nesterov’s method is deterministic (Nesterov, 1983; 2013b), we follow the setting of its stochastic variants (Lan, 2012; Ghadimi & Lan, 2012), in which Nesterov’s acceleration also achieves the optimal rates.
We consider the following convex composite problem (Beck & Teboulle, 2009; Nesterov, 2013a):
[Equation]
where X ⊆ R
d is a non-empty closed convex set and h is a proper convex function with its proximal operator prox αh ( · ) 9 available.
We impose the following assumptions on the regularity of f and the stochastic oracle ∇ f i (identical to the ones in Ghadimi & Lan (2012) with µ = 0 ):
Assumptions.
For some L ≥ 0 , M ≥ 0 , σ ≥ 0 , [Equation] y − x (cid:107) , ∀ x, y ∈ X.(b) E i [ ∇ f i ( x )]
=
∇ f ( x ) , ∀ x ∈ X. (c) E i (cid:2) (cid:107)∇ f i ( x ) − ∇ f ( x ) (cid:107) 2 (cid:3) ≤ σ 2 , ∀ x ∈ X. The notation E i k [ · ] is E [ · | ( i 0 , . . , i k − 1 )] for a random process i 0 , i 1 , . . . . These assumptions cover several important classes of convex problems.
For example, (a) covers the cases of f being
L -smooth ( M = 0 ) or L 0 -Lipschitz continuous ( M = 2 L 0 , L = 0 ) convex functions and if σ =in (c) , the assumptions cover several classes of deterministic convex programming problems.
We denote x (cid:63) ∈ X as a solution to problem (4) and x 0 ∈ X as the initial guess.
Unlike its usage in deep learning, the momentum parameter β is always a variable in general convex analysis.
For the simplicity of analysis, we reformulate AM1-SGD
(Algorithm 1) and AM2-SGD (Algorithm 2) into the following schemes 11 ( z ∈ X, α ∈ R ):
AM1-SGD (reformulated, proximal)
Initialize: ˜ x 0 =
z
= x 0 , S
= K/m .
1: for s = 0 , . . .
, S − 1 do 2: for j = 0 , . . .
, m − 1 do 3: k = sm + j .
4: x k =
(1 − β s ) ·
z k + β s · ˜ x s .
z k +1 = prox
α s h { z k − α s ·∇ f i k
( x k ) } .
6: ( x k +
=
(1 − β s ) ·
z k +1 + β s · ˜ x s . )
7: end for 8: ˜ x s [-+
-]+
[Equation]
= [Equation] m (cid:80) mj
=1 x sm + j .
9: end for
Output: ˜ x S .
AM2-SGD reformulated, proximal)
Initialize: z 0 =
φ 0 j = x 0 , ∀ j ∈ [ m ] .
1: for k = 0 , . . .
, K − 1 do 2:
Sample j k uniformly in [ m ] .
3: x j k k
=
(1 − β k ) ·
z k + β k · φ kj k .
z k +1 = prox
α k h { z k − α k ·∇ f i k ( x j k k ) } .
5: φ k +1 j k
=
1 − β k ) ·
z k +1 + β k · φ kj k .
6: end for
Output: ¯ φ K = 1 m (cid:80) mj
=1 φ Kj .
We show in Appendix B.1 that when h ≡ 0 and β is a constant, the reformulated schemes AM1SGD and AM2-SGD are equivalent to Algorithm 1 and Algorithm 2 through α s = η (1 − β s ) − 1 and
When M > 0 , f is not necessarily differentiable and we keep using the notation ∇ f ( x ) to denote an arbitrary subgradient of f at x for consistency.
For simplicity, we assume K is divisible by m .
[Figure]
F u ll - B a t c h T r a i n
L o ss
[Figure]
SGD M-SGD AM1-SGD-I AM1-SGD-II    80 Epoch 0.
F u ll - B a t c h T r a i n
L o ss S T
D [Figure] [Figure]
II
METHOD
Avg. STD SGD 0.
M-SGD 0.
AM1-SGD-I 0.
AM1-SGD-II 0. α k = η (1 − β k ) − 1 . These reformulations are basically how Nesterov’s momentum was migrated into deep learning (Sutskever et al., 2013).
Then we establish the convergence rates for AM1-SGD and AM2-SGD as follows. All the proofs in this paper are given in Appendix B.2.
Theorem 1.
For the reformulated AM1-SGD, suppose we choose[-β s = s s + 
 and α s =-]
[Equation]
and
[Equation]
Then,
(a) The output ˜ x S satisﬁes
[Equation]
(b) If the variance has a “light tail”,
i
e., E i (cid:104) exp (cid:110) (cid:107)∇ f i ( x ) −∇ f ( x ) (cid:107) 2 /σ 2 (cid:111)(cid:105) ≤ exp { 1 } , ∀ x ∈ X , and X is compact, denoting D X (cid:44) max x ∈ X (cid:107) x − x (cid:63) (cid:107) , for any Λ ≥ 0 , we have
[Equation]
1 −
[Equation]
Remarks: (a) Regarding K 0 ( m ) , its minimum is obtained at either m = 1 or m = K .
Note that for AM1-SGD, m is strictly constrained in { 1 , . . .
, K } .
It can be veriﬁed that when m = K , AM1-SGD becomes the modiﬁed mirror descent SA (Lan, 2012), or under the Euclidean setting, the SGD that outputs the average of the whole history, which is rarely used in practice.
In this case, the convergence rate in Theorem 1a becomes the corresponding O ( L/K + ( σ + M ) / √ K ) (cf.
Theorem 1 in Lan (2012)).
Thus, we can regard AM1-SGD as a smooth transition between AC-SA and the modiﬁed mirror descent SA.
(b) The additional compactness and “light tail” assumptions are similarly required in Nemirovski et al.
; Lan (2012); Ghadimi & Lan (2012).
Recently, Juditsky et al.
(2019) established similar bounds under weaker assumptions by truncating the gradient.
However, as indicated by the authors, their technique cannot be used for accelerated algorithms due to the accumulation of bias.
Understandings: Theorem 1a gives the expected performance in terms of full-batch loss F (˜ x ) −
F ( x (cid:63) ) , from which the trade-off of m is clear: Increasing m improves the dependence on variance σ but deteriorates the O ( L/K 2 ) term (i.e., the acceleration). Based on this trade-off, we can understand the empirical results in Figure 2b: the faster convergence in the early stage could be the result of a better control on σ and the slightly lowered peak accuracy is possibly caused by the reduced acceleration effect. Theorem 1b provides the probability of the full-batch loss deviating from its expected performance (i.e., K 0 ( m ) ). It is clear that increasing m leads to smaller deviations with the same probability, which sheds light on the understanding of the increased robustness observed in Figure 2.
Since the theorem is built on the full-batch loss, we did an experiments based on this metric in Figure 4 & Table 2.
Here we choose training a smaller ResNet18 with pre-activation (He et al., 2016a) on CIFAR-10 as the case study (the test accuracy is reported in Appendix A.5).
For AM2-SGD, we only give the expected convergence results as follows.
Theorem 2.
For the reformulated AM2-SGD, if we choose β k = k/m k
[Equation]
and α k = [Equation] with
[Equation]
the output ¯ φ K satisﬁes
[Equation]
Remark: In comparison with Theorem 1a, Theorem 2 has an additional term F ( x 0 ) − F ( x (cid:63) ) in the upper bound, which is inevitable.
This difference comes from different restrictions on the choice of m .
For AM2-SGD, m ≥ 1 is the only requirement.
Since it is impossible to let m (cid:29) K to obtain an improved rate, this additional term is inevitable.
As a sanity check, we can let m → ∞ to obtain a point table with almost all x 0 , and then the upper bound becomes exactly F ( x 0 ) − F ( x (cid:63) ) .
In some cases, there exists an optimal choice of m > 1 in Theorem 2.
However, the optimal choice could be messy and thus we omit the discussion here.
Understanding: Comparing the rates, we see that when using the same m , AM2-SGD has slightly better dependence on σ , which is related to the observation in Figure 5 that AM2-SGD is always slightly faster than AM1-SGD.
This difference is suggesting that randomly incorporating past iterates beyond m iterations helps.
If m = O (1) , Theorems 1 and 2 establish the optimal O ( L/K 2 + ( σ + M ) / √ K ) rate in the convex setting (see Lan (2012) for optimality), which veriﬁes AM1-SGD and AM2-SGD as variants of the Nesterov’s method (Nesterov, 1983; 2013b).
From the above analysis, the effect of m can be understood as trading acceleration for variance control.
However, since both acceleration and variance control boost the convergence speed, the reduced ﬁnal performance observed in the CIFAR experiments may not always be the case as will be shown in Figure 5 and Table 3. Connections with Katyusha Our original inspiration of AM1-SGD comes from the construction of Katyusha (Allen-Zhu, 2018), the recent breakthrough in ﬁnite-sum convex optimization, which uses a previously calculated “snapshot” point to provide momentum, i.e., Katyusha momentum.
AM1-SGD also uses an aggregated point to provide momentum and it shares many structural similarities with Katyusha.
We refer the interested readers to Appendix B.3.
P ERFORMANCE E VALUATION
In this section, we evaluate AM1-SGD and AM2-SGD on more deep learning tasks. Our goal is to show their potentials of serving as alternatives for M-SGD. Regarding the options: for AM1-SGD,
Option I is a nice choice, which has slightly better ﬁnal performance as shown in Table 1; for AM2SGD, Option I is not recommended as mentioned before.
Here we choose to evaluate Option II for both methods for consistency, which also corresponds to the analysis in Section 4. AM1-SGD and AM2-SGD use exactly the same values for ( η, β ) as M-SGD, which was tuned to optimize the performance of M-SGD. We set m = 5 for AM1-SGD and AM2-SGD.
We trained ResNet50 and ResNet152 (He et al., 2016b) on the ILSVRC2012 dataset (“ImageNet”)
(Russakovsky et al., 2015) shown in Figure 5b.
For this task, we used 0 .
1 initial learning rate and 0 .
9 momentum for all methods, which is a typical choice.
We performed a restart after each learning rate reduction as discussed in Appendix A.4.
We believe that this helps the training process and also does not incur any additional overhead.
We report the peak accuracy in Table 3.
We also did a language model experiment on Penn Treebank dataset (Marcus et al., 1993).
We used the LSTM (Hochreiter & Schmidhuber, 1997) model deﬁned in Merity et al.
and followed the experimental setup in its released code.
We only changed the learning rate and momentum in [Figure] [Table] the setup.
The baseline is SGD+ASGD 12 (Polyak & Juditsky, 1992) with constant learning rateas used in Merity et al.
For the choice of ( η, β ) , following Lucas et al.
(2019), we chose β = 0 .
and used the scheduler that reduces the learning rate by half when the validation loss has not decreased for 15 epochs.
We swept η from { 5 , 2 . 5 , 1 , 0 . 1 , 0 . 01 } and found that η = 2 . 5 resulted in the lowest validation perplexity for M-SGD.
We thus ran AM1-SGD and AM2-SGD with this ( η, β ) and m = 5 .
Due to the small decay factor, we did not restart AM1-SGD and AM2-SGD after learning rate reductions.
The validation perplexity curve is plotted in Figure 5a.
We report validation perplexity and test perplexity in Table 3.
This experiment is directly comparable with the one in Lucas et al.
Extra results are provided in the appendices for interested readers: the robustness when using large β (Appendix A.2), a CIFAR-100 experiment (Appendix A.6) and comparison with classical momentum (Polyak, 1964), AggMo (Lucas et al., 2019) and QHM (Ma & Yarats, 2019)
(Appendix A.3).
C ONCLUSIONS
We presented Amortized Nesterov’s Momentum, which is a special variant of Nesterov’s momentum that utilizes several past iterates to provide the momentum.
Based on this idea, we designed two different realizations, namely, AM1-SGD and AM2-SGD.
Both of them are simple to implement with little-to-no additional tuning overhead over M-SGD.
Our empirical results demonstrate that switching to AM1-SGD and AM2-SGD produces faster early convergence and comparable ﬁnal generalization performance.
AM1-SGD is lightweight and has more robust iterates than M-SGD, and thus can serve as a favorable alternative to M-SGD in large-scale deep learning tasks.
AM2-SGD could be favorable for more restrictive tasks (e.g., asynchronous training) due to its extensibility and good performance. Both the methods are proved optimal in the convex case, just like M-SGD. Based on the intuition convex analysis, the for variance , which provides for the hyper-parameter tuning
Appendices A Extra Experimental Results
A.1 The effect of m on convergence . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.2 Robustness on large momentum parameters . .
A.3 Comparison with other momentum . . . . . . . . . . . . . . . . . . . . . . . . . .
A.4 Issues with learning rate schedulers . . . . . . . . . . . . . . . . . . . . . . . . .
A.5 Test accuracy results of Figure 4 & Table 2 . . .
A.6 CIFAR-100 experiment . . .
A.7 A sanity check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B Missing parts in Section
B.1 The reformulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.2 Proofs of Theorem 1 and Theorem 2 . . . . . . . . . . . . . . . . . . . . . . . . .
B.2. Proof of Lemma 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.2. Proof of Theorem 1a . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.2. Proof of Theorem 1b . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.2. Proof of Theorem
[Table]
.3 Connections between AM1-SGD and
C Miscellanies
[Table] [Table] [Table]
D Experimental Setup
D. [Table]
[Table] [Table]
A E XTRA E XPERIMENTAL R ESULTS
In this appendix, we provide more experimental results to further evaluate the Amortized Nesterov’s
Momentum.
Table 4 shows the detailed data of the parameter sweep experiments, where the convergence curves of these results are given in Appendix A.1.
In Appendix A.2, we compare the robustness of AM1-SGD and M-SGD on large momentum parameters.
In Appendix A.3, we empirically compare the Amortized Nesterov’s Momentum with classical momentum (Polyak, 1964), aggregated momentum (Lucas et al., 2019) and quasi-hyperbolic momentum (Ma & Yarats, 2019).
We discuss the issues with learning rate schedulers in Appendix A.4.
We report the test accuracy results of the ResNet18 experiment (in Section 4) in Appendix A.5.
A CIFAR-100 experiment is provided in Appendix A.6.
We also provide a sanity check for our implementation in Appendix A.
[Table]
[Table]
562% ± 0.154% 0.441%
AM1-SGD
Option I, m =94.426% ± 0.170% 0.399%
AM1-SGD
Option I, m =94.338% ± 0.078% 0.429%
OM-SGD
AM1-SGD
(Opt. II, m = 1 ) 94.804% ± 0.124% 0.634%
AM1-SGD
Option II, m =94.710% ± 0.160% 0.411%
AM1-SGD
Option II, m =94.602% ± 0.083% 0.265%
AM1-SGD
Option II, m =94.514% ± 0.103% 0.282%
AM1-SGD
Option II, m =94.470% ± 0.188% 0.293%
AM1-SGD
Option II, m =94.404% ± 0.107% 0.306%
AM1-SGD
Option II, m =94.282% ± 0.176% 0.344%
AM2-SGD
Option I, m = 1 , sanity check 94.712% ± 0.178% 0.822%
AM2-SGD
Option I, m =94.592% ± 0.103% 0.591%
AM2-SGD
Option I, m =94.506% ± 0.117% 0.737%
AM2-SGD
Option I, m =94.318% ± 0.088% 0.741%
AM2-SGD
Option II, m =94.706% ± 0.059% 0.263%
AM2-SGD
Option II, m =94.554% ± 0.203% 0.280%
AM2-SGD
Option II, m =94.420% ± 0.144% 0.246%
A. T HE EFFECT OF m ON CONVERGENCE
We show in Figure 6 how m affects the convergence of test accuracy.
The results show that increasing m speeds up the convergence in the early stage.
While for AM1-SGD the convergences of
Option I and Option II are similar, AM2-SGD with Option II is consistently better than with Option
I in this experiment.
It seems that AM2-SGD with Option I does not beneﬁt from increasing m and the algorithm is not robust.
Thus, we do not recommend using Option I for AM2-SGD.
[Figure]
A. R OBUSTNESS ON LARGE MOMENTUM PARAMETERS
We compare the robustness of M-SGD and AM1-SGD when β is large in Figure 7 & Table 5.
For fair comparison, AM1-SGD uses Option I. As we can see, the STD error of M-SGD scales up signiﬁcantly when β is larger and the performance is more affected by a large β compared with
AM1-SGD.
[Figure]
[Table]
A. C OMPARISON WITH OTHER MOMENTUM
[Figure]
[Table]
[Figure]
[Table]
color.
In this section, we compare AM1-SGD (Option I) with classical momentum (Polyak, 1964), AggMo (Lucas et al., 2019) and QHM (Ma & Yarats, 2019) in our basic case study (training ResNet34 on
CIFAR-10).
Since we are not aware of what makes a fair comparison with these methods (e.g., it is not clear what is the effective learning rate for AM1-SGD), we compare them based on the default hyper-parameter settings suggested by their papers.
Classical Momentum The SGD with classical momentum (CM-SGD) that is widely used in deep learning has the following scheme (standard PyTorch) ( v cm ∈ R d , v cm [Equation]
[Equation]
CM-SGD with its typical hyper-parameter settings ( η 0 = 0 .
1 , β = 0 .
9 ) is observed to achieve similar generalization performance as M-SGD.
However, CM-SGD is more unstable and prone to oscillations (Lucas et al., 2019), which makes it less robust than M-SGD as shown in Table 6.
Aggregated Momentum (AggMo) AggMo combines multiple momentum buffers, which is inspired by the passive damping from physics literature (Lucas et al., 2019).
AggMo uses the following update rules (for t = 1 , . .
, T , v ( t )
∈ R d , v ( t )
= 0 ):
[Equation]
We used the exponential hyper-parameter setting recommended in the original work with the scalefactor a = 0 .
1 ﬁxed, β ( t ) =
1 − a t − 1 , for t = 1 , . . .
, T and choosing T in { 2 , 3 , 4 } .
We found that
T = 2 gave the best performance in this experiment.
As shown in Figure 8 & Table 6, with the help of passive damping, AggMo is more stable and robust compared with CM-SGD.
Quasi-hyperbolic Momentum (QHM) Ma & Yarats (2019) introduce the immediate discount factor ν ∈ R for the momentum scheme, which results in the QHM update rules ( α ∈ R , v qh ∈
R d , v qh 0 = 0 ):
[Equation]
Here we used the recommended hyper-parameter setting for QHM ( α 0 = 1 . 0 , β = 0 .
999 , ν = 0 .
Figure 8 shows that AM1-SGD, AggMo and QHM achieve faster convergence in the early stage while CM-SGD has the highest peak accuracy.
In terms of robustness, huge gaps are observed when comparing AM1-SGD with the remaining methods in Table 6.
Note that AM1-SGD is more efﬁcient than both QHM and AggMo, and is as efﬁcient as CM-SGD.
We also plot the convergence of train-batch loss for all the methods in Figure 9.
Despite of showing worse generalization performance, both QHM and AggMo perform better on reducing the trainbatch loss in this experiment, which is consistent with the results reported in Ma & Yarats (2019);
Lucas et al.
[Figure]
A. I SSUES WITH LEARNING RATE SCHEDULERS
[Figure] [Figure]
Cosine annealing scheduler (without restarts), η 0 = 0 .
1 , β = 0 .
We show in Figure 10 that when β is large for the task, using step learning rate scheduler with decay factor 10 , a performance drop is observed after each reduction.
Both
Option I and Option II have this issue and the curves are basically identical.
Here we only use Option II.
We ﬁx this issue by performing a restart after each learning rate reduction (labeled with ‘+’).
We plot the train-batch loss here because we ﬁnd the phenomenon is clearer in this way.
If β = 0 .
9 , there is no observable performance drop in this experiment.
For smooth-changing schedulers such as the cosine annealing scheduler (Loshchilov & Hutter, 2016), the amortized momentum works well as shown in Figure 11.
A. T EST ACCURACY RESULTS OF F IGURE 4 & T ABLE
We report the test accuracy results of the experiments in Section 4 in Figure 12 & Table 7.
These results are reminiscent of the ResNet34 experiments (Figure 3 & Table 1).
[Figure]
METHOD
PEAK ACCURACY
Avg.
[Table]
A. CIFAR-100 EXPERIMENT
We report the results of training DenseNet121 (Huang et al., 2017) on CIFAR-100 in Figure 13, which shows that both AM1-SGD and AM2-SGD perform well before the ﬁnal learning rate reduction.
However, the peak accuracies are lowered around 0 .
6% compared with M-SGD.
We also notice that SGD reduces the train-batch loss at an incredibly fast rate and the losses it reaches are consistently lower than other methods in the entire 300 epochs.
However, this performance is not reﬂected in the convergence of test accuracy.
We believe that this phenomenon suggests that
the
DenseNet model is actually “overﬁtting” M-SGD (since in the ResNet experiments, M-SGD always achieves a lower train loss than SGD after the ﬁnal learning rate reduction)
[Figure]
A. A SANITY CHECK
When m = 1 , both AM1-SGD and AM2-SGD are equivalent to M-SGD
[Figure]
we plot their convergence in Figure 14 as a sanity check (the detailed data is given in Table 4)
[Figure]
SGD- { Option } - { m } ’.
We observed that when m = 1 , both AM1-SGD and AM2-SGD have a lower STD error than
M-SGD.
We believe that it is because they both maintain the iterates without scaling, which is numerically more stable than M-SGD (M-SGD in standard PyTorch maintains a scaled buffer, i.e., v ptk =
η − 1 β − 1 · ( y k − x k ) ).
B M ISSING PARTS IN S ECTIONB. T HE REFORMULATIONS
When h ≡ 0 and β is a constant, we do the reformulations by eliminating the sequence { z k } .
For the reformulated AM2-SGD,
[Equation]
The reformulated AM2-SGD
[Equation]
Eliminate { z k }
[Equation]
Algorithm
For the reformulated AM1-SGD, when h ≡ 0 , the inner loops are basically SGD,
[Equation]
[Equation]
Eliminate { z k
[Equation]
At the end of each inner loop (i.e., when ( k + 1) mod m = 0 ), we have x
[Equation]
s +
[Equation]
m
[Equation]
s , while at the beginning of the next inner loop,
[Equation]
which means that we need to set x k +1 ← x k +1 + β · (˜ x s +1 − ˜ x s ) (reassign the value of x k +1 ).
We also give the reformulation of M-SGD (scheme (1)) to the Auslender & Teboulle (2006) scheme for reference:
[Equation]
Auslender & Teboulle (2006)
[Equation]
Eliminate { z k }
[Equation]
Nesterov (1983; 2013b)
AC-SA (in the Euclidean case) maps to the Auslender & Teboulle (2006) scheme through (in the original notations)
[Equation]
Intuition for the Auslender & Teboulle (2006) scheme can be found in Remark 2 in Lan (2012).
B. P ROOFS OF T HEOREM 1 AND T HEOREM
The reformulated schemes are copied here for reference:
AM1-SGD (reformulated, proximal)
Initialize: ˜ x 0 =
{+z 
+}
= x 0 , S = K/m . 1: for s = 0 , . . . , S − 1 do 2: for j = 0 , . . .
, m − 1 do 3: k = sm + j . [Equation] [Equation] ˜ x
[Equation]
[Equation]
prox
[Equation]
{+6: ( x k +
+}
=
(1 − β [Equation] · z [Equation]
+
[Equation] + β [Equation] ˜ x s . )
7: end for 8: ˜ x s +1 =
[Equation] mj =1 x sm + [Equation] 9: end for
Output: ˜ x S .
AM2-SGD (reformulated, proximal)
Initialize: z 0 =
φ 0 j = x 0 , ∀ j ∈ [ m ] .
1: for k = 0 , . . .
, K − 1 do 2:
Sample j k uniformly in [ m ] .
3: x j k k
=
(1 − β k ) ·
z k + β k · φ kj k .
z k +1 = prox
α k h { z k − α k ·∇ f i
[Equation]
( x j k
[Equation]
[Equation]
5: φ k +1 j k
=
1 − β k ) ·
z k +1 + β k · φ kj k .
6: end for
Output: ¯ φ K = 1 m (cid:80) mj
=1 φ Kj . Comparing the reformulated schemes, we see that their iterations can be generalized as follows: [Equation] This type of scheme is ﬁrst proposed in Auslender & Teboulle (2006), which represents one of the simplest variants of the Nesterov’s methods (see Tseng (2008) for other variants).
The scheme is then modiﬁed into various settings (Hu et al., 2009; Lan, 2012; Ghadimi & Lan, 2012; 2016; Zhou et al., 2019; Lan et al., 2019) to achieve acceleration.
The following lemma serves as a cornerstone for the convergence proofs of AM1-SGD and AM2-SGD.
Lemma 1.
If α (1 − β ) < 1 /L , the update scheme (6) satisﬁes the following recursion:
[Equation]
B.2. P ROOF OF L EMMA
This Lemma is similarly provided in Lan (2012);
Ghadimi & Lan (2012)
under a more general setting that allows non-Euclidean norms in the assumptions, we give a proof here for completeness.
Based on the convexity (Assumption (a))
[Equation]
we have
[Equation]
We upper bound the terms on the right side one-by-one.
For R 0 ,
[Equation]
where ( (cid:63) ) uses the relation between x and z , i.e., (1 − β ) · ( x − z )
=
β · ( y − x ) .
For R 2 , based on Assumption (a), we have
[Equation]
Then, noting that x − y + =
(1 − β ) · ( z − z + )
, we can arrange the above inequality as
[Equation]
Using Young’s inequality with ζ >
[Equation]
we obtain
[Equation]
For R 3 , based on the optimality condition of prox αh { z − α · ∇ f i ( x ) } and denoting ∂h ( z + ) as a subgradient of h at z + , we have for any u ∈ X ,
[Equation]
Choosing u
= x (cid:63) ,
[Equation] [Equation]
where ( (cid:63) ) follows from (cid:107) a + b (cid:107)
= (cid:107) a (cid:107) 2 + (cid:107) b (cid:107) 2 + 2 (cid:104) a, b (cid:105) .
Finally, by upper bounding (7) using (8), (9), (10), we conclude that f [Equation] +
[Equation]
After simpliﬁcation,
[Equation]
Note that with the convexity of h and y + = (1 − β ) · z + + β · y , we have
[Equation]
Using the above inequality and choosing ζ = α − 1 − L (1 − β ) > 0 ⇒ α (1 − β ) < 1 /L , we can arrange (11) as
[Equation]
B.2. P ROOF OF T HEOREM 1 A
Using Assumption (c)
[Equation]
Lemma 1 with
[Equation]
12) and taking expectation [Equation] if α s (1 − β s ) < 1 /L [Equation]
we have
[Equation]
Summing the above inequality from k = sm
[Equation]
. . . , sm + m − 1 , we obtain
[Equation]
Using the deﬁnition of ˜ x s +1 and convexity,
[Equation]
It can be veriﬁed that with the choices β s = ss +2 and α s = [Equation] s )
[Equation]
the following holds for s ≥ 0 ,
[Equation]
Thus
[Equation]
by telescoping (13) from s = S −
[Equation]
[Equation] [Equation]
we obtain
[Equation]
and thus,
[Equation]
where ( a ) follows from λ 1 ≤ 23 and ( b ) holds because 0 ≤ x (cid:55)→ ( x +2) 2 is non-decreasing and thus
S
[Equation]
1 (cid:88)
[Equation]
Denoting
[Equation]
and based on the choice of λ 1 = min (cid:8) 23 , λ ∗ 1 (cid:9) , if λ ∗ 1 ≤ 23 , we have
[Equation]
If λ ∗ 1 > 2 3 ,
[Equation]
Thus, we conclude that
[Equation]
Substituting S = K/m completes the proof.
B.2. P ROOF OF T HEOREM 1 B
In order to prove Theorem 1b, we need the following known result for the martingale difference (cf.
Lemma 2 in Lan et al.
Lemma 2.
With N > 0 , let ξ 0 , ξ 1 , . . .
, ξ N − 1 be a sequence of i.i.d.
random variables, for t = 0 , . .
, N − 1 , σ t > 0 be a deterministic number and ψ t = ψ t ( ξ 0 , . . . , ξ t ) be a deterministic measurable function such that E ξ t [ ψ t ] =
a.s. and E ξ t (cid:2) exp { ψ 2 t /σ 2 t } (cid:3) ≤ exp { 1 } a.s.. Then for any Λ ≥ 0 ,
Prob
[Equation]
To start with, using Lemma 1 with the parameter mapping (12), we have
[Equation]
Summing the above inequality from k = sm, . .
, sm + m − 1 and using the choice α s =
[Equation]
with λ 1 ≤ 23 , we obtain
[Equation]
With our parameter choices
[Equation]
the relations in (14) hold and thus we can telescope the above inequality from s =
S − 1 , . .
. , 0 , α
[Equation]
[Equation]
Denoting V 2 k (cid:44) (cid:107)∇ f ( x k ) − ∇ f i k ( x k ) (cid:107) 2 , ¯ α = (cid:80) K − 1 k =
α 2 (cid:98) k/m (cid:99) =
m (cid:80) S − 1 s =
α 2 s , for R 4 , by Jensen’s inequality, we have
[Equation]
where ( (cid:63) ) uses the additional assumption E i k (cid:2) exp (cid:8) V 2 k /σ 2 (cid:9)(cid:3) ≤ exp { 1 } .
Then, based on Markov’s inequality, we have for any Λ ≥ 0 , Prob
[Equation]
Prob [Equation] For R 5 , since we have E i k (cid:2) α (cid:98) k/m (cid:99) (cid:104)∇ f ( x k ) − ∇ f i k ( x k ) , z k − x (cid:63) (cid:105) (cid:3) = 0 and
E i k
[Equation]
, which is based on the “light tail” assumption, using Lemma 2, we obtain
Prob
[Equation]
Combining (15), (16) and (17), based on the parameter setting (cf.
and using the notation
[Equation]
+ 1) 2 √ m (cid:118)(cid:117)(cid:117)(cid:116)
S − 1 (cid:88) s =
α 2 s , we conclude that
[Equation]
For R 6 , using the choice of α s and λ 1 , we obtain
[Equation]
which completes the proof
[Equation]
B.2. P ROOF OF T HEOREM
Using Assumption (c) [Equation] Lemma 1 with
[Equation]
α = α
[Equation]
β = β k , and taking expectation, if α k (1 − β k ) < 1 /L , we have
[Equation]
Note that
[Equation]
Dividing both sides of (18) by m and then adding
[Equation]
to both sides
[Equation]
we obtain
[Equation]
It can be veriﬁed that with our parameters choice: β k = k/mk/m +2 and α k =
[Equation]
) , the following holds for k ≥ 0 ,
[Equation]
Then, we can telescope (19) from k = K − 1 , . . . , 0 , which results in
[Equation]
Using the deﬁnition of ¯ φ K and convexity
[Equation]
we obtain [Equation] where ( a ) uses λ 2 ≤ 23 , ( b ) follows from simple integration arguments and that Km + 2 ≤ 2 (cid:0) K − 1 m + 2 (cid:1) since K ≥ 1 , m ≥ 1 . Based on the choice of λ 2 = min
[Equation]
(20) can be further upper bounded as
[Equation]
B. C ONNECTIONS BETWEEN AM1-SGD AND K ATYUSHA
The discussion in this section aims to shed light on the understanding of the experimental results, which also shows some interesting relations between AM1-SGD and Katyusha.
The high level idea of Katyusha momentum is that it works as a “magnet” inside an epoch of SVRG updates, which “stabilizes” the iterates so as to make Nesterov’s momentum effective (Allen-Zhu, 2018).
In theory, the key effect of Katyusha momentum is that it allows the tightest possible variance bound for the stochastic gradient estimator of SVRG (cf.
Lemma 2.4 and its comments in AllenZhu (2018)).
In this sense, we can interpret Katyusha momentum as a variance reducer that further reduces the variance of SVRG.
Below we show the similarity between the construction of Katyusha and AM1-SGD, based on which we conjecture that the amortized momentum can also reduce the variance of SGD (and thus increase the robustness).
However, in theory, following a similar analysis of Katyusha, we cannot guarantee a reduction of σ in the worst case.
Deriving AM1-SGD from Katyusha Katyusha has the following scheme (non-proximal, in the original notations, σ is the strong convexity parameter, cf.
Algorithm 1 with Option I in Allen-Zhu (2018)) 13 :
Initialize: (cid:101) x 0 =[-y 
-]
[Equation]
[-z 
-][Equation]
0 , η = 13 L [Equation] ω = 1 + ασ .
1: for s = 0 , . . .
, S − 1 do 2:
Compute and store ∇ f ( (cid:101) x s ) .
3: for j = 0 , [Equation]
. . , m [Equation] 1 do 4:
[Equation]
[Equation] [Equation] x s ) .
7: z k +1 =
z k − α · (cid:101) ∇ k .
8: y {+[Equation] +
+}
= x
k − η · (cid:101) ∇ k .
9: end for 10: (cid:101) x
s +
=
(cid:16)(cid:80) m
− 1 j =0 ω j (cid:17) − 1 · (cid:80) m − 1 j =0 ω j · y sm + j +1 .
11: end for
Output: (cid:101) x S .
We can eliminate the sequence { z k } in this scheme.
Note that in the parameter setting of Katyusha, we have η = ατ [Equation] and thus [Equation]
Hence
[Equation]
the inner loops can be written as
[Equation]
which is the Nesterov’s scheme (scheme (1)).
At the end of each inner loop (when k = sm + m − 1 ),
[Equation]
while at the beginning of the next inner loop,
[Equation]
{+x s +
 + (1 − τ 1 − τ 2 ) · y ( s +1) m ,+} which means that we need to set x ( s +1) m ← x ( s +1) m
+ τ 2 · ( (cid:101) x s +1 − (cid:101) x s ) (reassign the value of x ( s +1) m ).
Then, the following is an equivalent scheme of Katyusha:
Initialize: (cid:101) x 0 = y
= x 0 , η = 13 L , ω = 1 + ασ.
1: for s = 0 , . . .
, S − 1 do 2: for j = 0 , . . .
, m − 1 do 3: k = sm + j.
4: y k +
= x
k − η · (cid:101) ∇ k .
5: x k +
=
y k +
+ (1 − τ 1 − τ 2 ) · ( y k +1 − y k ) .
6: end for 7: (cid:101) x
s +
=
(cid:16)(cid:80) m
− 1 j =0 ω j (cid:17) − 1 · (cid:80) m − 1 j =0 ω j · y sm + j +1 . 8: x ( s +1) m ← x ( s +1) m + τ 2 · ( (cid:101) x s +1 − (cid:101) x s ) . 9: end for
Output: (cid:101) x S .
Now it is clear that the inner loops use Nesterov’s momentum and the Katyusha momentum is injected for every m iterations.
If we replace the SVRG estimator (cid:101) ∇ k with ∇ f i k
( x k ) , set 1 − τ 1 − τ 2 = 0 , which is to eliminate Nesterov’s momentum, and use a uniform average for (cid:101)
x s +1 , the above scheme becomes exactly AM1-SGD (Algorithm 1).
If we only replace the SVRG estimator (cid:101) ∇ k , the scheme can be regarded as adding amortized momentum to M-SGD.
This scheme requires tuning the ratio of Nesterov’s momentum and amortized momentum.
In our preliminary experiments, after suitable tuning, we observed some performance improvement.
However, this scheme increases the complexity, which we do not consider it worthwhile.
A recent work (Zhou et al., 2018) shows that when 1 − τ 1 − τ 2 = 0 , which is to solely use Katyusha momentum, one can still derive optimal rates and the algorithm is greatly simpliﬁed.
Their proposed algorithm (i.e., MiG) is structurally more similar to AM1-SGD.
C M ISCELLANIES C. C OMPARISON OF SGD AND M-SGD
Ma & Yarats (2019) normalize the momentum buffer of M-SGD, which results in the following formulation ( α ∈ R , v qh
[Equation]
d , v qh 0 = 0 ):
[Equation]
This scheme is equivalent to the PyTorch formulation (scheme (3)) through v ptk =
(1 − β ) − 1 · v qhk and η = α (1 − β ) .
Based on this formulation, α is understood as the effective learning rate (i.e., the vector it scales has the same cardinality as a gradient) and the experiments in Ma & Yarats (2019) were conducted with ﬁxed α = 1 .
Their results indicate that when using the same effective learning rate, M-SGD and SGD achieve similar performance and thus they suspect that the beneﬁt of momentum basically comes from using sensible learning rates.
Here we provide some intuition on their results based on convex analysis.
For simplicity, we consider deterministic smooth convex optimization.
In theory, to obtain the optimal convergence rate, the effective learning rate α is set to a very large O ( k/L ) , which can be derived from Theorem 1 or Theorem 2 by setting σ = 0 , M = 0 , m = (then λ 1 or λ 2 is always 23 since the other term is ∞ ).
If we ﬁx α = 23 L for both methods, GD has an O (1 /K ) convergence rate (cf.
Theorem 2.1. in Nesterov (2013b)).
For the Nesterov’s method, if we use β k = k k +2 , it has the convergence rate (applying Lemma 1):
[Equation]
[Figure] Thus, in this case, both GD and the Nesterov’s method yield an O (1 /K ) rate, and thus we expect them to have similar performance.
This analysis suggests that the acceleration effect basically comes from choosing a large effective learning rate, which corresponds to the observations in Ma & Yarats (2019).
However, what is special about the Nesterov’s method is that it ﬁnds a legal way to adopt a large α that breaks the 1 /L limitation.
If GD uses the same large α , we would expect it to be unstable and potentially diverge.
In this sense, Nesterov’s momentum can be understood as a “stabilizer”.
In our basic case study (ResNet34 on CIFAR-10), if we align the effective learning rate and set γ = 1 . 0 for SGD, the peak accuracy is improved but the performance is highly unstable and not robust, which is 2 .
205% average STD of test accuracy over 5 runs.
The signiﬁcance of QHM (Ma & Yarats, 2019) is that with suitable tuning, it achieves much faster convergence without changing the effective learning rate.
Our work focuses on the robustness and our intuition is rooted in convex analysis, which are basically why we set γ = η .
C. T RAINING EVALUATION
Due to the mechanism of back-propagation, evaluating train-batch loss basically incurs no overhead.
It can be efﬁciently used to indicate the training progress.
However, it can only be treated as a coarse approximation to the full-batch loss as shown in Figure 1c.
If batch normalization (Ioffe & Szegedy, 2015) or dropout (Srivastava et al., 2014) is used in training, the model changes during the training phase, which makes train-batch loss less accurate.
More importantly, train-batch loss is always observed to be statistically stable, which omits many important characteristics of an optimizer such as robustness, oscillations, etc.
We include a comparison of train-batch loss and full-batch loss on training ResNet18 with pre-activation on CIFAR-10 (the experiment in Section 4) in Figure 15.
We also notice that for different optimizers, even if their convergences on train-batch loss are indistinguishable, their convergences on test accuracy can vary greatly.
We show two examples in Figure 16, where the ImageNet experiment is from Section 5 and the CIFAR-10 experiment is from Table 4 with m = 10 .
D E XPERIMENTAL S ETUP
All of our experiments were conducted using PyTorch (Paszke et al., 2017) library.
D. C LASSIFICATION S ETUP
CIFAR-10 & CIFAR-100 Our implementation (e.g., ResNet and DenseNet implementations, data pre-processing) generally follows the repository https://github.com/kuangliu/ pytorch-cifar .
All the CIFAR experiments in this paper used a single GPU in a mix of
RTX2080Ti, TITAN Xp and TITAN
V.
The batch size is ﬁxed to 128 .
We used cross-entropy loss with 0 .
weight decay and used batch normalization (Ioffe & Szegedy, 2015).
Data augmentation includes random 32 -pixel crops with a padding of 4 -pixel and random horizontal ﬂips with [Figure]
5 probability.
We used step (or multi-step) learning rate scheduler with a decay factor 10 .
For the
CIFAR-10 experiments, we trained 90 epochs and decayed the learning rate every 30 epochs.
For the CIFAR-100 experiments, we trained 300 epochs and decayed the learning rate at 150 epoch and 225 epoch following the settings in DenseNet (Huang et al., 2017).
ImageNet In the ImageNet experiments, we tried both ResNet50 and ResNet152 (He et al., 2016b).
The training strategy is the same as the PyTorch’s ofﬁcial repository https://github.
com/pytorch/examples/tree/master/imagenet , which uses a batch size of 256 .
The learning rate starts at 0 .
1 and decays by a factor of 10 every 30 epochs.
Also, we applied weight decay with 0 .
0001 decay rate to the model during the training.
For the data augmentation, we applied random 224 -pixel crops and random horizontal ﬂips with 0 .
5 probability.
Here, we run all experiments across 8 NVIDIA P100 GPUs for 90 epochs.
D. L ANGUAGE M ODEL S ETUP
We followed the implementation in the repository https://github.com/salesforce/ awd-lstm-lm and trained word level Penn Treebank with LSTM without ﬁne-tuning or continuous cache pointer augmentation for 750 epochs.
The experiments were conducted on a single
RTX2080Ti.
We used the default hyper-parameter tuning except for learning rate and momentum:
The LSTM has 3 layers containing 1150 hidden units each, embedding size is 400 , gradient clipping has a maximum norm 0 .
25 , batch size is 80 , using variable sequence length, dropout for the layers has probability 0 . 4 , dropout for the RNN layers has probability 0 .
3 , dropout for the input embedding layer has probability 0 .
65 , dropout to remove words from embedding layer has probability 0 .
1 , weight drop (Merity et al., 2017) has probability 0 .
5 , the amount of (cid:96) 2 -regularization on the RNN activation is 2 . 0 , the amount of slowness regularization applied on the RNN activation is 1 .
and all weights receive a weight decay of 0 . 0000012 .