Q UASI - HYPERBOLIC MOMENTUM AND A DAM FOR DEEP LEARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Momentum-based acceleration of stochastic gradient descent (SGD) is widely used in deep learning.
We propose the quasi-hyperbolic momentum algorithm (QHM) as an extremely simple alteration of momentum SGD, averaging a plain
SGD step with a momentum step.
We describe numerous connections to and identities with other algorithms, and we characterize the set of two-state optimization algorithms that QHM can recover.
Finally, we propose a QH variant of Adam called QHAdam, and we empirically demonstrate that our algorithms lead to signiﬁcantly improved training in a variety of settings, including a new state-of-theart result on WMT16 EN-DE.
We hope that these empirical results, combined with the conceptual and practical simplicity of QHM and QHAdam, will spur interest from both practitioners and researchers.
PyTorch code is immediately available.
I NTRODUCTION
Stochastic gradient descent (SGD) serves as the optimizer of choice for many recent advances in deep learning across domains (Krizhevsky et al., 2012;
He et al., 2016a; Gehring et al., 2017).
SGD for deep learning is typically augmented with either the “heavy ball” momentum technique of Polyak (1964) or the accelerated gradient of Nesterov (1983).
In the deterministic setting, these methods provably yield faster convergence in fairly general settings.
In the stochastic setting, these methods lose many theoretical advantages.
However, due to its implicit gradient averaging, momentum can confer the beneﬁt of variance reduction, applying less noisy parameter updates than plain SGD.
Recent work has explicitly shown the use of momentum as a variance reducer (Roux et al., 2018).
Algorithms Starting with gradient variance reduction as an informal and speculative motivation, we introduce the quasi-hyperbolic momentum (QHM) optimization algorithm in Section 3.
Put as simply as possible, QHM’s update rule is a weighted average of momentum’s and plain SGD’s update rule.
We later propose a similar variant of Adam (QHAdam) in Section 5.
Connecting the dots QHM is simple yet expressive.
In Section 4, we connect QHM with plain
SGD, momentum, Nesterov’s accelerated gradient, PID control algorithms (Recht, 2018;
An et al., 2018), synthesized Nesterov variants (Lessard et al., 2016), noise-robust momentum (Cyrus et al., 2018), Triple Momentum (Scoy et al., 2018), and least-squares acceleration of SGD (Kidambi et al., 2018).
Such connections yield reciprocal beneﬁts – these algorithms aid in analyzing QHM, and conversely QHM recovers many of these algorithms in a more efﬁcient and conceptually simpler manner.
We then characterize the set of optimization algorithms that QHM recovers.
Practical validation and considerations In Section 6, we empirically demonstrate that QHM and
QHAdam provide superior optimization in a variety of deep learning settings.
We provide both comprehensive parameter sweep analyses on smaller models and case studies on large real-world models.
We demonstrate improvements on strong (sometimes state-of-the-art) models simply by swapping out the vanilla algorithms with the QH counterpart.
Notably, taking the WMT16 EN-DE translation model of Ott et al.
(2018), we achieve a 40% improvement in stability, along with a new state-of-the-art result of 29.45 BLEU.
We then offer some practical tips for QHM and QHAdam.
Miscellany We provide errata for Kingma & Ba (2015), Recht (2018), and Kidambi et al.
We also offer evidence that momentum often yields negligible improvement over plain SGD.
We emphasize QHM and QHAdam’s efﬁciency and conceptual simplicity.
QHM has no extra overhead vs. Nesterov’s accelerated gradient, and QHAdam has very little overhead vs. Adam.
Also, both algorithms are easily understood as an interpolation between two other well-known algorithms, so they are accessible to practitioners and can be tuned starting with existing practical intuitions.
We believe that this contributes strongly to the algorithms’ practical promise.
P RELIMINARIES
We begin with notation and a brief review of stochastic gradient descent (SGD) and momentum.
Primitives In this paper, θ ∈ R p denotes a vector of model parameters.
L ( θ ) : R p
→ R denotes a loss function to be minimized via θ .
ˆ L ( θ ) :
R p
→ R denotes an approximator of the loss function (e.g. over a minibatch).
∇ L denotes the gradient of function L .
Unless otherwise speciﬁed, all vector operations are element-wise.
We use g, a, s, v, w ∈ R p as auxiliary buffers, and g is typically the “momentum buffer”.
θ , ˆ L ( · ) , and all buffers are subscriptable by t , the optimization step.
Optimization algorithms We consider optimization algorithms that perform a sequence of steps (indexed by t ), updating θ at each step towards minimizing L ( θ ) .
For brevity, we write algorithms as “update rules”, which describe the algorithm’s behavior during a single step t , rather than as full pseudocode.
Update rules take this basic form (optionally with one or more auxiliary steps):
[Equation]
Plain SGD The SGD algorithm, parameterized by learning rate α ∈ R , uses the update rule:
[Equation]
Momentum The momentum algorithm, parameterized by α ∈ R and β ∈ R , uses the update rule:
[Equation]
where g is commonly called the “momentum buffer”.
Note that β = 0 recovers plain SGD.
The exponential discount factor β controls how slowly the momentum buffer is updated.
In the stochastic setting, β also controls the variance of a normalized momentum buffer.
A common rule of thumb for momentum is β = 0 .
9 (Ruder, 2016).
In contrast to common formulations of momentum (Polyak, 1964; Sutskever et al., 2013), we normalize, or “dampen”, the momentum buffer g by (1 − β ) in (1).
This serves both to remove dependence of the update step magnitude on β , and to allow the interpretation of g as a weighted average of past gradients (and thus a gradient estimator).
Of course, this also shrinks the updates by a factor of 1 − β vs. common formulations; this is easily reversible with a corresponding increase to α .
A LGORITHM : Q UASI - HYPERBOLIC MOMENTUM (QHM)
In this section, we propose and discuss the quasi-hyperbolic momentum (QHM) algorithm.
QHM update rule
QHM, parameterized by α ∈ R , β ∈ R , and ν ∈ R , uses the update rule:
[Equation]
Section 7.1 provides a recommended rule of thumb ( ν = 0 .
7 and β = 0 .
Interpretation QHM introduces the immediate discount factor ν , encapsulating plain SGD ( ν = 0 ) and momentum ( ν = 1 ).
A self-evident interpretation of QHM is as a ν - weighted average of the momentum update step and the plain SGD update step .
QHM vs. momentum
Comparing (2) and (4), QHM may seem at ﬁrst glance identical to momentum with discount factor νβ .
Appendix A.8 analytically demonstrates that this is not the case.
We note that the expressive power of QHM intuitively comes from decoupling the momentum buffer’s discount factor ( β ) from the current gradient’s contribution to the update rule ( 1 − νβ ).
In contrast, momentum tightly couples the discount factor ( β ) and the current gradient’s contribution ( 1 − β ).
Variance reduction QHM is originally motivated by an informal and speculative variance reduction analysis; for brevity, we provide the full details in Appendix A.
In short, the square bracket term in (4) can be viewed as a gradient estimator (modulo initialization bias).
When ν = 1 , this is simply the momentum buffer g t
+1 .
Increasing β decreases the variance of the momentum buffer, but potentially at the cost of making it unusably “stale” (biased).
QHM allows for the mitigation of this staleness by upweighting the current, unbiased gradient (i.e. setting ν < 1 ).
Efﬁciency QHM, like momentum, requires 1 auxiliary buffer of memory.
It also requires 1 in-place scalar-vector multiplication and 3 scaled vector additions per update step.
C ONNECTIONS TO OTHER ALGORITHMS
We now present numerous connections between QHM and other optimization algorithms.
The common theme is that QHM recovers almost all of these algorithms, and thus is a highly interpretable and more efﬁcient implementation of these algorithms.
The ﬁrst few subsections present these connections, 4 Table 1 summarizes these connections, and Section 4.5 provides discussion.
4. N ESTEROV ’ S ACCELERATED GRADIENT
Nesterov (1983)’s accelerated gradient (NAG) can be viewed as a closely related cousin of momentum.
In fact, replacing the g t +1 term in (2) with [(1 − β ) · ∇ ˆ L t ( θ t ) + β · g t +1 ] yields NAG.
Connection with QHM It follows from (4) that QHM recovers NAG with ν = β .
This sheds light on the somewhat unintuitive NAG algorithm, providing a natural interpretation of NAG’s update rule as a β -weighted average between momentum and plain SGD.
Efﬁciency NAG’s compute/memory cost is equivalent to that of QHM.
4. PID CONTROL
Recht (2018) draws a strong connection between gradient-based optimization and PID control.
We regurgitate the excellent exposition (with minor modiﬁcations) in Appendix B.
Update rule A PID control optimizer, parameterized by k P , k
I , k D ∈ R , uses the update rule:
[Equation]
Connection with QHM We fully relate QHM and PID in Appendix C.3.
To summarize, PID is a superfamily of QHM.
Viewing β as a constant, QHM imposes a restriction on the ratio between k P and k D .
Viewing β as a free variable, however, QHM can recover nearly all PID coefﬁcients.
Efﬁciency Recht (2018) provides a transformation of variables that reduces the memory cost toauxiliary buffers, and the compute cost to 1 in-place scalar-vector multiplication and 4 scaled vector additions per update step.
This is still costlier than QHM.
.2 through Section 4.4, which are largely narrative.
Alternative PID setting In Appendix E, we brieﬂy discuss another PID setting by An et al.
and relate the resulting optimization algorithm to QHM.
In short, the setting is degenerate as the P,
I, and D terms are linearly dependent.
Thus, QHM can recover the resulting PID control optimizer.
4. S YNTHESIZED N ESTEROV V ARIANTS (SNV)
Section 6 of Lessard et al.
(2016) describes a “synthesized Nesterov variant” algorithm, which we call “SNV” for convenience.
This algorithm is used to analyze and improve optimizer robustness under “relative deterministic noise” (i.e. multiplicative noise of the gradient).
Update rule SNV, parameterized by γ, β 1 , β 2 ∈ R , uses the update rule:
[Equation]
Connection with QHM We fully relate QHM and SNV in Appendix C.4.
To summarize, QHM and SNV recover each other.
By extension, QHM recovers the Robust Momentum method, which is a speciﬁc parameterization of SNV (Cyrus et al., 2018).
Moreover, since Robust Momentum recovers the Triple Momentum of Scoy et al.
(2018), QHM also recovers Triple Momentum.
Efﬁciency SNV is costlier than QHM, requiring 2 auxiliary buffers and 5 scaled vector additions.
4. A CC SGD
Jain et al.
(2017) and Kidambi et al.
(2018) point out various failures of momentum and NAG in the setting of stochastic least squares optimization.
This motivates their proposal of the AccSGD algorithm, which yields faster convergence over momentum and NAG in certain least-squares regression settings.
Here, we discuss the formulation of Kidambi et al.
Update rule AccSGD, parameterized by δ > 0 , κ > 1 , ξ ≤ √ κ , and (cid:15) < 1 , uses the update rule:
[Equation]
Connection with QHM We fully relate QHM and AccSGD in Appendix C.5.
To summarize,
QHM recovers AccSGD.
In the reverse direction, AccSGD does not recover QHM; speciﬁcally, we disprove the claim in Kidambi et al.
(2018) that AccSGD recovers NAG.
Since QHM recovers NAG,
AccSGD cannot fully recover QHM.
Efﬁciency AccSGD, like QHM, requires 1 auxiliary buffer.
Computationally, AccSGD is costlier, requiring 2 in-place scalar-vector multiplications and 4 scaled vector additions per update step.
4. D ISCUSSION
Theoretical convergence results We note that various convergence results follow simply via these connections.
In the deterministic (full-batch) case, since QHM recovers Triple Momentum, QHM also recovers the global linear convergence rate of 1 − 1 / √ κ for strongly convex, smooth loss functions.
For ﬁrst-order methods, this is the fastest known global convergence rate for such functions.
In the stochastic (minibatch) case, QHM’s recovery of AccSGD gives QHM the same convergence results as in Kidambi et al.
(2018)’s least-squares regression setting, of O ( √ κ · log κ · log 1 (cid:15) ) iterations for (cid:15) -approximation of the minimal loss.
Unifying two-state optimization algorithms These connections demonstrate that many two-state optimization algorithms are functionally similar or equivalent to each other.
However, they are often implemented inefﬁciently and their parameterizations can be inaccessible to practitioners.
QHM yields a highly accessible and efﬁcient version of these algorithms.
[Table]
Momentum (Polyak,
[Table]
NAG (Nesterov, 1983)
[Table]
PID (Recht, 2018)
[Table]
(An et al., 2018)
[Table]
SNV (Lessard et al.,
[Table] [Table]
Robust M
[Table] [Table]
et al.
[Table] [Table]
Triple M. (Scoy et al., 2018)
[Table]
AccSGD (Kidambi et al.,
[Table] [Table]
In Appendix D, we characterize the set of two-state optimization algorithms recoverable by QHM.
Our hope here is to provide future work with a routine conversion to QHM so that they may leverage the accessibility and efﬁciency beneﬁts, as well as the many connections to other algorithms.
Many-state optimization algorithms Going beyond a single momentum buffer, it is possible to recover many-state algorithms by linearly combining many momentum buffers (with different discount factors) in the update rule.
However, we found in preliminary experiments that using multiple momentum buffers yields negligible value over using a single slow-decaying momentum buffer and setting an appropriate immediate discount – that is, using QHM with high β and appropriate ν .
We note that the Aggregated Momentum (AggMo) algorithm (Lucas et al., 2018) precisely performs this linear combination of multiple momentum buffers.
While AggMo takes a simple average of the buffers, an extended variant of AggMo allows for other linear combinations.
This extended AggMo can be viewed as a many-state generalization of two-state algorithms (including QHM), recovering them when two buffers are used.
Appendix H provides a supplemental discussion and empirical comparison of QHM and AggMo, corroborating our preliminary experiments’ ﬁndings
A LGORITHM : QHA DAM
The Adam optimizer (Kingma & Ba, 2015) has enabled many compelling results in deep learning (Xu et al., 2015; Vaswani et al., 2017; Yu et al., 2018).
We propose to replace both of Adam’s moment estimators with quasi-hyperbolic terms, and we name the resulting algorithm QHAdam.
QHAdam update rule
QHAdam, parameterized by α, (cid:15) ≥ 0 , β 1 , β 2 ∈ [0 , 1) , and ν 1 , ν 2 ∈ R , uses the update rule:
[Equation]
 
Note that only the last expression differs from vanilla Adam.
In fact, QHAdam recovers Adam when ν 1 = ν 2 = 1 .
Moreover, modulo bias correction, QHAdam recovers RMSProp (Hinton et al., 2012) when ν 1 = 0 and ν 2 = 1 , and NAdam (Dozat, 2016) when ν 1 = β 1 and ν 2 = 1 .
We note that
Adam has inspired many variants such as AMSGrad (Reddi et al., 2018) and AdamW (Loshchilov & Hutter, 2017), which can be analogously modiﬁed.
[Table]
Efﬁciency QHAdam incurs four extra scaled vector additions over Adam.
Practical notes We leave formal convergence analysis to future work.
However, a couple of informal points are worth mentioning.
Firstly
[Table]
ν 1 and β 1 can be reasoned about in a similar manner to QHM’s ν and β .
Secondly, when replacing Adam with QHAdam [Table] setting ν 2 = 1 and β 2 unchanged is usually reasonable if the original Adam training is stable.
Thirdly, when Adam training is not stable [Table] it is possible that setting ν 2 < 1 can improve stability by imposing a tighter step size bound – Appendix F elaborates, disproving the step size bound claimed in Kingma & Ba (2015)
[Table]
E XPERIMENTS
We perform two categories of experiments: parameter sweeps and case studies.
For brevity, all experimental settings are summarized in Table 2 and comprehensively detailed in Appendix I.
6. P ARAMETER SWEEPS
With parameter sweeps, we aim to comprehensively study the various parameterizations of the QH algorithms using relatively small models.
We train for 90 epochs with size-64 minibatches.
For
QHM, we initialize α = 1 and decay it 10-fold every 30 epochs.
The sweep grid for QHM (encapsulating various parameterizations of plain SGD, momentum, and NAG) is: ν ∈ { 0 , 0 . 25 , 0 . 5 , 0 . 6 , 0 . 7 , 0 . 8 , 0 .
9995 , 1 } β ∈ { 0 , 0 .
For QHAdam, we ﬁx α = 10 − 3 , (cid:15) =
10 − 8 , ν 2 = 1 , and β 2 = 0 .
999 , and sweep over ν 1 and β 1 .
“Default” ν and β values Motivated by the popular momentum/NAG “default” of β = 0 .
9 , we select a QH “default” of ν = 0 .
7 and β = 0 .
999 based on preliminary experimentation on the
MNIST dataset (LeCun, 1998) along with the intuitions from Appendix A.
In the following ﬁgures, we show these defaults along with the globally optimal parameterizations.
Results Fig.
1 presents selected results of these sweep experiments (full results in Appendix J).
Perhaps the most immediate observation is that the QH algorithms improve both training and validation metrics.
Even the hardcoded default ν = 0 .
7 and β = 0 .
999 handily outperforms the optimal parameterization of NAG or Adam in all settings.
In some settings, there remains a large gap between the QH and vanilla algorithms at the end of training.
In other settings, the gap shrinks to smaller levels.
However, even for these latter settings, the QH algorithm converges much faster, suggesting that a more aggressive learning rate schedule can signiﬁcantly reduce training time.
What about plain SGD?
We note that in most of these experiments, there is little difference between the performance of plain SGD and NAG (particularly when compared to QHM).
Although not shown in the ﬁgures, there is also little difference between plain SGD and momentum.
This indicates that the beneﬁt of momentum and NAG (in the common, unnormalized formulations) comes
[Figure]
in large part from the increase in effective step size.
We thus suspect that much of the folk wisdom about momentum’s beneﬁts for SGD should instead be folk wisdom about using sensible learning rates.
In contrast, QHM provides signiﬁcant beneﬁts without changing the effective step size.
6. C ASE STUDIES
With case studies, we apply the QH algorithms to diverse settings, with (currently or recently) stateof-the-art models.
Our case studies cover image recognition, language modeling, reinforcement learning, and neural machine translation.
Each case study features a baseline setting and a QH setting, which are identical modulo the optimizer used.
Results are presented in Fig.
2 and Table 3.
Image recognition (RN152-ImageNet-QHM)
We train a ResNet152 model (He et al., 2016a) on the ILSVRC2012 dataset (Russakovsky et al., 2015).
The baseline setting is nearly identical to the size-256 minibatch baseline in Goyal et al.
(2017), using NAG with β = 0 .
9 and a decaying learning rate schedule.
The QH setting swaps out NAG for QHM, with ν = 0 .
7 and β = 0 .
[Table]
Running 3 seeds, QHM plainly trains much faster than NAG
[Table]
and QHM converges to a marginally superior validation error as well.
Language modeling (FConvLM-WikiText103-QHM)
Deep learning for NLP often features “spiky” gradient distributions (e.g. encountering rare words).
We train a FConv language model (Dauphin et al., 2016) on the WikiText-103 dataset (Merity et al., 2016).
The baseline setting precisely follows the original paper, using NAG with β = 0 . 99 .
The QH setting swaps out NAG for
QHM, with ν = 0 .
98 and β = 0 .
We suspect that high β improves stability in the presense of spiky gradients, and
QHM’s ν allows the use of high β .
Running 10 seeds, QHM outperforms the NAG baseline on validation perplexity by half a point.
Reinforcement learning (TD3-MuJoCo-QHAdam)
Reinforcement learning presents a challenging task for gradient-based optimization, since the objective L is not stationary.
QH algorithms provide a natural way of upweighting the most recent gradient.
Here, we apply the TD3 algorithm (Fujimoto et al., 2018) to various MuJoCo environments (Todorov et al., 2012).
The baseline precisely follows Fujimoto et al.
(2018)’s setup, which uses Adam with β 1 = 0 .
9 and β 2 = 0 .
The QH setting swaps out Adam for QHAdam, with ν 1 = 0 .
9 and other parameters identical.
Running 10 seeds, QHAdam yields improvements in average reward on four environments out of seven tested, and virtually ties on another.
Neural machine translation (TF-WMT16ENDE-QHAdam)
Many state-of-the-art neural machine translation (NMT) models are fragile to train.
As in language modeling, the gradient distribution is often “spiky”; thus, Adam training often fails to converge due to a very small number of large parameter updates.
Here, we empirically demonstrate that QHAdam improves both performance and robustness by using ν 2 to control the maximum per-step update.
We train a large transformer model (Vaswani et al., 2017) on the WMT16 English-German dataset.
The baseline setting precisely follows the state-of-the-art setup of Ott et al.
(2018), using β 1 = 0 .
9 and β 2 = 0 .
98 for Adam.
The
QH setting swaps out Adam for QHAdam, with ν 1 = 0 .
8 , β 1 = 0 .
95 , ν 2 = 0 .
7 , and β 2 = 0 .
Running 10 seeds, the Adam baseline explodes on 4 seeds.
QHAdam is more robust, converging for all seeds.
Ultimately, QHAdam yields a new state-of-the-art-result of 29.45 BLEU.
Thus, we improve both the stability and performance of the state-of-the-art with a simple optimizer swap.
with marginal success
D ISCUSSION 7. P RACTICAL SUGGESTIONS
We offer some practical suggestions for deep learning practitioners, particularly those who default to momentum, NAG, or Adam with β = 0 .
9 as a rule of thumb:
• Consider using QHM or QHAdam, instead of momentum, NAG, or Adam.
• While QHM parameters should be tuned when feasible, a decent rule of thumb is to set ν = 0 .
7 and β = 0 .
QHAdam parameter selection is somewhat more situational, although as discussed in Section 5, ν 2 = 1 and β 2 unchanged is usually reasonable when replacing a stable Adam optimizer with QHAdam.
• Be mindful of learning rate differences between (unnormalized) momentum/NAG and QHM.
Convert learning rates from the former to the latter via multiplication by (1 − β ) − 1 .
For example, momentum/NAG with α = 0 .
1 and β = 0 .
9 should be replaced by QHM with α = 1 .
This conversion is unnecessary for Adam, as it already normalizes all buffers.
7. F UTURE WORK
This paper has only scratched the surface when it comes to empirical evaluation of QHM and
QHAdam.
Future work could apply the algorithms to other well-studied tasks and architectures, both to assess the extent of their performance gains in diverse domains, and to further develop insights into hyperparameter choice.
Effective hyperparameter autotuning methods can improve the practicality of any optimization algorithm.
Thus, a useful direction for future work is to create an effective ν, β adapter, possibly based on techniques such as YellowFin (Zhang et al., 2017) or via continuous-time optimal control analysis, as in Li et al.
Moreover, learning rate adaptation techniques such as Hypergradient
Descent (Baydin et al., 2018) can be applied to both QHM and QHAdam.
Future work could develop convergence results for QHAdam.
Convergence results for QHM in a reasonably general stochastic setting would also be appealing, although we are not aware of compelling analogous results for momentum or NAG.
Finally, momentum has been studied in the distributed, asynchronous setting, with some noting that the delays in asynchronous SGD are, in some sense, akin to adding momentum (Mitliagkas et al., 2016).
As a result, the optimal momentum constant β shrinks as more asynchronous workers are added to optimization.
It would be interesting to extend these results to QHM, especially to disentagle the implicit effects of asynchrony on ν and β .
7. C ONCLUSION
QHM and QHAdam are computationally cheap, intuitive to interpret, and simple to implement.
They can serve as excellent replacements for momentum/NAG and Adam in a variety of settings.
In particular, they enable the use of high exponential discount factors (i.e. β ) through the use of immediate discounting (i.e. ν ).
QHM recovers numerous other algorithms in an efﬁcient and accessible manner.
Parameter sweep experiments and case studies demonstrate that the QH algorithms can handily outpace their vanilla counterparts.
We hope that practitioners and researchers will ﬁnd these algorithms both practically useful and interesting as a subject of further study.
A PPENDICES
Organization This paper’s appendices are ordered as follows:
• Appendix A presents a view of momentum and QHM as discounted sums, and provides the original motivation for the development of QHM.
• Appendix B regurgitates Recht (2018)’s
excellent exposition of gradient-based optimization as PID control, with minor modiﬁcations.
• Appendix C presents analyses of various other algorithms, towards connecting them to QHM.
• Appendix D describes the set of all two-state optimization algorithms recovered by QHM.
• Appendix E brieﬂy discusses a PID control optimization setting by An et al.
• Appendix F derives a tight upper bound on the updates of Adam and QHAdam (consequently disproving the bound in Kingma & Ba (2015)), then discusses the implications on training stability.
• Appendix G provides miscellaneous derivations that do not cleanly ﬁt in other sections.
• Appendix H provides discussion and an empirical comparison of QHM and AggMo (Lucas et al., 2018).
• Appendix I comprehensively describes the setup of this paper’s parameter sweep and case study experiments.
• Appendix J comprehensively presents the results of this paper’s parameter sweep experiments.
A D ISCOUNTED SUM ESTIMATORS ( ORIGINAL VARIANCE REDUCTION MOTIVATION FOR QHM)
We now provide an interpretation of the momentum buffer as a discounted sum estimator, seeking to motivate the QHM algorithm from a variance reduction perspective.
A. D ISCOUNTED SUMS
For a discount function δ : N ≥
→ R and a sequence of vectors x 0 ...t ∈ R p , we deﬁne a discounted sum DS δ ( x 0 ...t ) as:
DS δ ( x 0 ...t ) =
t (cid:88) i = δ ( i ) · x t − i
When (cid:80) ti =
δ ( i ) =
1 for all t ≥ 0 , we call this a discounted sum average .
When (cid:80) ∞ i =
δ ( i ) = 1 , we call this a discounted sum average (modulo initialization bias) .
A. E XPONENTIAL DISCOUNTING AND EWMA
For β ∈ ( − 1 , 1) , we deﬁne the exponential discount function δ EXP ,β as: δ EXP ,β ( i ) =
(1 − β ) β i and the exponentially weighted moving average EWMA β ( x 0 ...t ) as:
EWMA β ( x 0 ...t ) =
DS δ EXP ,β ( x 0 ...t ) =
(1 − β ) · t (cid:88)
i =
β i · x t − i
The EWMA is a discounted sum average (modulo initialization bias), so it can be viewed as an estimator of the expectation of a random variable x if x 0 ...
t ∼ x .
Note that the momentum buffer g t from (1) is precisely an EWMA – speciﬁcally, g t =
EWMA β ( ∇ ˆ L 0 ...
t ( θ 0 ...t )) .
It is well known that the exponential discount function is the only time-consistent (commonly “memoryless”), discount function – i.e. for any i, τ ≥ 0 , the ratio d ( i + τ ) /d
( i ) depends only on τ .
This is precisely why the EWMA can be tracked with no auxiliary memory – for example, as in momentum’s update rule.
A. EWMA AS VARIANCE REDUCTION
We now provide the following fact about the covariance of the EWMA when x 0 ...t are random variables.
Fact A.1 (Limit covariance of EWMA) .
Assume that x 0 ...t are independent random vectors, each with the covariance matrix Σ .
Then:
[Equation]
Proof.
Corollary of Fact A.2.
This means that arbitrary variance reduction of the EWMA is possible by increasing β .
For example, β = 0 .
9 implies that the covariance is reduced to 119 · Σ , and β = 0 .
99 implies that the covariance is reduced to 1199 · Σ .
This provides an intuitive explanation of momentum as a variance reduction technique.
Assuming that the momentum buffer is normalized (and thus interpretable as an estimator of the gradient), applying momentum will reduce the variance of the update steps, with higher β leading to more variance reduction.
However, the ﬂip side is that higher β induces more bias (informally, “staleness”) in the momentum buffer with respect to the true gradient, as the momentum buffer becomes extremely slow to update.
Thus, the question arises: can we achieve variance reduction while guaranteeing that recent gradients contribute signiﬁcantly to the update step?
For this, we must introduce time-inconsistency.
A. (P URE ) HYPERBOLIC DISCOUNTING AND HWMA
Hyperbolic discounting, ﬁrst proposed by Chung & Hernstein (1961), is the classical timeinconsistent discount function in consumer choice.
It is commonly used to model individual behaviors such as impatience.
We consider its use in the setting of stochastic optimization (in place of the EWMA buffer of momentum).
For constants c, k > 0 , we deﬁne the hyperbolic discount function as:
[Equation]
and the hyperbolic weighted moving average HWMA c,k
( x 0 ...t ) as:
[Equation]
Note that the hyperbolic discount function is time-inconsistent, since:
[Equation]
depends on both i and τ .
Unlike the EWMA, the HWMA is not a discounted sum average – in fact, (cid:80) ∞ i =
δ H ,c,k ( i ) = ∞ holds regardless of choice of c or k .
Thus, to use an HWMA of gradients in an optimization algorithm, c (or the learning rate α ) must be decayed at a logarithmic rate.
More concerning, however, is the computational inefﬁciency of the HWMA; speciﬁcally, the sum must be recomputed from scratch at each iteration from all past gradients.
This is unacceptable for use in most practical applications.
However, in preliminary stochastic optimization experiments, we did observe a marked beneﬁt of
HWMA over EWMA (i.e. momentum), limiting the number of past gradients used for tractability.
This indicates that time-inconsistency might be a useful property to have in a stochastic optimizer.
A. Q UASI - HYPERBOLIC DISCOUNTING AND QHWMA
Quasi-hyperbolic discounting, proposed by Phelps & Pollak (1968) and popularized in consumer choice by Laibson (1997), seeks to qualitatively approximate the time-inconsistency of hyperbolic discounting by applying a discontinuous “upweighting” of the current step.
Its tractability has resulted in much wider adoption in consumer choice vs. pure hyperbolic discounting, and we ﬁnd that it is also more suited for use in practical optimization.
For constants ν ∈ R and β ∈ ( − 1 , 1) , we deﬁne the quasi-hyperbolic discount function as:
[Equation]
and the quasi-hyperbolic weighted moving average QHWMA ν,β ( x 0 ...t ) as:
[Equation]
The QHWMA, like the EWMA, is a discounted sum average (modulo initialization bias), so it can also be viewed as an estimator under the same assumptions.
When ν = 1 , the QHWMA is precisely the EWMA (with identical β ), and the quasi-hyperbolic discount function is precisely the exponential discount function (and thus time-consistent).
When ν (cid:54) = 1 , the quasi-hyperbolic discount function, like the hyperbolic discount function, is timeinconsistent since:
[Equation]
depends on both i and τ ; speciﬁcally, i =
yields a different ratio than i > 0 .
Note from (5) that the QHWMA is a ν -weighted average of the EWMA (with identical β ) and x 0 .
This means that the QHWMA can be easily computed online by simply keeping track of the EWMA, thus requiring no additional memory.
A. V ARIANCE OF QHWMA
We now characterize the variance of a QHWMA using this fact:
Fact A.2 (Limit covariance of QHWMA) .
Assume that x 0 ...t are independent random vectors, each with the covariance matrix Σ .
Then:
[Equation]
where ρ is deﬁned as:
[Equation]
Proof.
Provided in Appendix G. ρ is essentially a scaling factor for the covariance of the QHWMA.
It can be veriﬁed that ρ decreases (thus inducing variance reduction) with both increasing β and increasing ν .
A. M OTIVATING QHM
This leads to our motivation for QHM, which simply replaces the EWMA momentum buffer with a QHWMA.
Starting with any momentum parameterization ( ν = 1 and β ∈ (0 , 1) ), β can be increased towards variance reduction (i.e. lowering ρ ).
Then, ν can be decreased to make the QHWMA less biased as a gradient estimator, thus mitigating the aforementioned “staleness” problem.
Note, however, that since decreasing ν will also increase ρ , we cannot simply decrease ν to zero.
Speciﬁcally, any ν < 1 imposes a tight lower bound of (1 − ν ) 2 on ρ , regardless of choice of β .
A. M OMENTUM AND QHM UPDATE RULES
For completeness, we explicitly write the update rules for the momentum and QHM algorithms.
Momentum The momentum update rule is:
[Equation]
which can be efﬁciently written using an auxiliary buffer g t as:
[Equation]
QHM
The QHM update rule is:
[Equation]
which can be efﬁciently written using an auxiliary buffer g t as:
[Equation] [Equation]
, revisited
[Equation]
Section 3)
[Equation]
4, revisited
[Equation]
Section 3)
QHM vs. momentum
Comparing (2) and (4), QHM may seem at ﬁrst glance identical to momentum with discount factor νβ .
However, replacing the β in (6) with νβ yields:
[Equation]
ˆ
[Equation]
which plainly differs from (7) – most notably, in the exponential discount factor ( νβ ) for past gradients.
Thus, momentum with discount factor νβ does not recover QHM
[Equation]
A. R ELATED WORK IN VARIANCE REDUCTION
Section 4 presents numerous connections to other optimization algorithms that shed light on both deterministic and stochastic convergence properties of QHM.
However, we do not formally analyze the convergence properties of QHM from a variance reduction standpoint; this remains future work.
Here, we brieﬂy discuss other work in variance reduction.
Finite sums Recently, much effort has been devoted towards reducing the variance of the stochastic gradients used in optimization algorithms.
Perhaps the most widely-studied setting is the “ﬁnite sum”, or ofﬂine, stochastic optimization setting.
Methods analyzed in the ﬁnite-sum setting include SAG (Schmidt et al., 2013), SAGA (Defazio et al., 2014), SVRG (Johnson & Zhang, 2013),
FSVRG (Shang et al., 2017), Katyusha (Allen-Zhu, 2017), and others.
We do not comment in detail on the ﬁnite sum setting due to its limited practical applicability to large-scale deep learning; for a fuller discussion of such methods, see Kidambi et al.
Momentum as variance reduction Some work in variance reduction has drawn an explicit connection to momentum.
For example, Roux et al.
(2018) propose a method involving Bayesian updates of gradient estimates, which induces adaptive gradient averaging.
The authors note that this method boils down to momentum with an adaptive β .
B PID CONTROLLERS AND OPTIMIZATION
We follow Recht (2018) in describing the connection between PID control and gradient-based optimization.
Continuous PID We slightly adapt the setting from Aastr¨om & H¨agglund (1995).
t denotes time.
There is a setpoint (i.e. target state), r ( t ) , and a process variable (i.e. current state), y ( t ) .
The error of the system is deﬁned as e ( t ) def = r ( t ) − y ( t ) .
A “controller” outputs a control signal u ( t ) , usually towards the goal of making the error zero.
The controller’s choice of u ( t ) affects y ( t ) in some unspeciﬁed manner.
A PID controller, parameterized by k P , k I , and k D , uses the control function:
[Equation]
Here, the terms in the square brackets are typically referred to as the P, I, and D terms, respectively.
Discrete approximation In discrete time, the setpoint, process variable, and error are trivially discretized as r t , y t , and e t def = r t − y t , respectively.
The I term, which we label w t , is discretized as:
[Equation]
The D term, which we label v t , could be discretized as v t =
e t − e t − 1 (ﬁrst differences).
However, a low-pass ﬁlter is often applied to mitigate noise, thus resulting in:
[Equation]
We simplify exposition by considering e − 1 , w − 1 , and v − 1 to be 0 .
Finally, the PID control function (8) is trivially discretized as:
[Equation]
Optimization Recht (2018) relates optimization to PID control as follows:
[Equation]
That is, the process variable is the stochastic gradient, the controller’s goal is to make this gradient zero, and the controller achieves this by choosing the next step’s model parameters according to the update rule θ t +1 ← u t + θ 0 .
The update rule for a PID control optimizer is thus:
[Equation]
Recht demonstrates that PID in this setting encapsulates gradient descent, momentum, and NAG; for example, gradient descent is recovered when k P = k D = 0 and k I = α .
Intuition Finally, to provide some additional intuition, we can state the following fact about the D term ( v t ):
Fact B.1 (D term is gradient and momentum) .
v t can be written as:
[Equation]
Proof.
Provided in Appendix G.
Thus, the D term is simply a weighted sum of an EWMA of gradients (i.e. momentum buffer) and the current gradient, and a PID control optimizer’s output is simply a weighted sum of the momentum buffer, the current gradient, and the sum of all past gradients.
C C ONNECTIONS TO OTHER ALGORITHMS ( IN - DEPTH )
This appendix presents a deeper theoretical treatment of Section 4.2 through Section 4.4, deriving and discussing connections between QHM and various other optimization algorithms.
C. L INEAR OPERATOR ANALYSIS
Along the lines of Lessard et al.
, we consider optimizers as linear operators, interrupted by a nonlinear step (the gradient evaluation).
In this setting, optimizers have b internal state buffers, which we write as a stacked vector S t ∈ R b · p .
Optimizers accept the current optimizer state ( S t ) and gradient ( ∇ ˆ L t ( θ t ) ), and they produce the new optimizer state ( S t +1 ) and parameters ( θ t ) using a square matrix T ∈ R ( b +2) p
× ( b +2) p .
Update rule For convenience, we impose the restriction that the output θ t can only depend on the state S t .
Then, for analytical purposes, the optimizer can be written as the following update rule:
[Equation]
where 0 p denotes the size- p zero vector, ∅ denotes throwaway values, and [ vv. .
denotes vector stacking.
Coordinate-wise decomposition Since we only consider optimizers that act coordinate-wise (except for the gradient evaluation)
, we can write T as the Kronecker product of a coordinate-wise transition matrix A ∈ R ( b +2) ×
( b +2) and the identity matrix I p .
That is, T =
A ⊗ I p .
Then, for t > 0 , we can write θ t in terms of the initial state S 0 , { 1 ...b } and all past gradients, using the last row of various matrix powers of A :
[Equation]
C. QHM
The internal state of QHM includes two buffers: g t (momentum buffer) and θ t (model parameters).
The transition matrix T QHM , mapping from (cid:2) g t θ t ∇ ˆ L t ( θ t )
p (cid:3) (cid:124) to [ g t + θ t + 0 p θ t ] (cid:124) , is:
[Equation]
For n > 0 , routine computation yields the last row of the ( n + 1) -th matrix power:
[Equation]
Applying (10), the optimizer state θ t can be written as:
[Equation]
In the typical case of g 0 = 0 , we have:
[Equation]
C. PID
Recht (2018) draws a strong connection between gradient-based optimization and PID control.
We regurgitate the excellent exposition (with minor modiﬁcations) in Appendix B.
Update rule A PID control optimizer, parameterized by k P , k
I , k D ∈ R , uses the update rule:
[Equation]
Coordinate-wise decomposition
The internal state of a PID control optimizer includes four buffers: e t − 1 (P term), w t − 1 (I term), v t − 1 (D term), and θ 0 (initial parameters).
The transition matrix T PID , mapping from (cid:2) e t −w
[Equation]
−v
[Equation]
−θ
[Equation]
∇ ˆ L t ( θ
[Equation]
0 p (cid:3) (cid:124) to [ e t w t v t θ0 p θ
[Equation]
] (cid:124) , is:
[Equation]
 
[Equation]
−
[Equation] [Equation]
[Equation]
 
[Equation]
For n > 0 , routine computation yields the last row of the ( n + 1) -th matrix power:
[Equation]
where:
[Equation]
Applying (10)
[Equation]
the optimizer state θ t can be written as:
[Equation]
Relationship with QHM In the typical case of e − 1 = w − 1 = v −
= 0 p , we have:
[Equation]
Then, equating with (11), we have that QHM is PID with:
[Equation]
or that PID is QHM with:
[Equation]
Viewing β as a constant, the following restriction holds on the PID coefﬁcients that QHM can recover:
[Equation]
This restriction is looser than those for plain SGD (which has the additional restriction k P = k D = 0 ), momentum (which has the additional restriction k P /k
I =
k D /k P ), and NAG (which has the additional restriction k P /k
I = βk D /k P ).
Viewing β as a hyperparameter, QHM can recover all PID coefﬁcients except when k I =
(i.e. P,
D, or PD controller), or k P (cid:54) =
= k D (i.e. PI controller).
To summarize, PID is a superfamily of QHM.
Viewing β as a constant, QHM imposes a restriction on the ratio between k P and k D .
Viewing β as a free variable, however, QHM can recover nearly all PID coefﬁcients.
C. SNV
Section 6 of Lessard et al.
(2016) describes a “synthesized Nesterov variant” algorithm, which we call “SNV” for convenience.
This algorithm is used to analyze and improve optimizer robustness under “relative deterministic noise” (i.e. multiplicative noise of the gradient).
Update rule SNV, parameterized by γ, β 1 , β 2 ∈ R , uses the update rule:
[Equation]
←
[Equation]
L
[Equation] [Equation]
t )
+
[Equation] [Equation]
−
[Equation]
1 ) θ t +1 ← ξ t +1 + β 2 ( ξ t +1 − ξ t )
Coordinate-wise decomposition
The internal state of a SNV optimizer includes two buffers: ξ t and ξ t − 1 .
The transition matrix T SNV , mapping from (cid:2) ξ t ξ t −∇ ˆ L t ( θ t )
p (cid:3) (cid:124) to [ ξ t + ξ t 0 p θ t ] (cid:124) , is:
[Equation] [Equation]
For n > 0 , routine computation gives us the last row of the ( n + 1) -th matrix power:
[Equation]
where:
[Equation]
Applying (10), the optimizer state θ t can be written as:
[Equation]
Relationship with QHM Initialize ξ 0 =
ξ − 1 = θ 0 .
The optimizer state θ t is:
[Equation]
Then, equating with (11), we have that QHM is SNV with:
[Equation]
or that SNV is QHM with:
[Equation]
To summarize, QHM and SNV recover each other.
By extension, QHM recovers the Robust Momentum method, which is a speciﬁc parameterization of SNV (Cyrus et al., 2018).
Moreover, since
Robust Momentum recovers the Triple Momentum of Scoy et al.
(2018), QHM also recovers Triple
Momentum.
C. A CC SGD
Jain et al.
(2017) and Kidambi et al.
(2018) point out various failures of momentum and NAG in the setting of stochastic least squares optimization.
This motivates their proposal of the AccSGD algorithm, which yields faster convergence over momentum and NAG in certain least-squares regression settings.
Here, we discuss the formulation of Kidambi et al.
Update rule AccSGD, parameterized by δ > 0 , κ > 1 , ξ ≤ √ κ , and (cid:15) < 1 , uses the update rule:
[Equation]
Coordinate-wise decomposition
The internal state of an AccSGD optimizer includes two buffers: ¯ w t (a buffer) and w t (the iterate, identical to θ t ).
The transition matrix
T AccSGD , mapping from (cid:2) ¯ w t w t ∇
[Equation]
L t
[Equation]
θ t
[Equation]
0 p (cid:3) (cid:124) to [ ¯ w t + w t +
[Equation]
t ] (cid:124) , is:
A AccSGD
[Equation]

[Equation] [Equation]
 
[Equation]
For n > 0 , routine computation gives us the last row of the ( n + 1) -th matrix power:
[Equation]
where:
[Equation]
Applying (10), the optimizer state θ t can be written as:
[Equation]
Relationship with QHM Fix (cid:15) ∈ (0 , 1) , and initialize ¯ w 0 = w
= θ 0 .
The optimizer state θ t is:
[Equation]
Then, equating with (11), we have that QHM is AccSGD with:
[Equation]
or that AccSGD is QHM with:
[Equation]
AccSGD cannot recover NAG Based on the above analysis, NAG (i.e. ν = β ) is recovered when ξ = 12 (cid:15) (cid:16) 1 − (cid:15) + (cid:112) 4 κ + (1 − (cid:15) ) 2 (cid:17) .
This disproves the claim in Kidambi et al.
that
AccSGD recovers NAG when ξ = √ κ .
In fact, we demonstrate that AccSGD cannot recover NAG at all.
For (cid:15) ∈ (0 , 1) and the aforementioned value of ξ , we have that ξ > √ κ :
[Equation]
Since AccSGD requires that ξ ≤ √ κ and that (cid:15) ∈ (0 , 1) 20 , AccSGD cannot recover NAG.
To summarize, QHM recovers AccSGD.
In the reverse direction, AccSGD does not recover QHM; speciﬁcally, we disprove the claim in Kidambi et al.
(2018) that AccSGD recovers NAG.
Since
QHM recovers NAG, AccSGD cannot fully recover QHM.
D G ENERAL TWO - STATE OPTIMIZER
This appendix describes a generic two-state optimizer (“TSO”) where one of the states is the iterate ( θ t ) and the other is an auxiliary buffer ( a t ).
The optimizer is parameterized by h, k, l, m, q, z ∈ R , and the update rule is:
[Equation]
We can write this as a transition matrix T TSO ∈ R 3 × 3 :
[Equation]
To simplify further derivations we diagonalize T TSO as:
[Equation]
Relationship with QHM If ψ (cid:54) = 0 , φ (cid:54) = 0 , φ ≤ 1 , 12 ( h + q + φ ) = 1 , h − q + φ = 0 , and 1 − l = 12 ( h + q − φ ) , then QHM implements the TSO optimizer with:
[Equation]
Proof.
We can write down the unrolled TSO update rule for θ t , as follows:
[Equation]
Similarly, for QHM we can deﬁne a transition matrix T QHM ∈ R 3 × 3 that advances state (cid:2) g t θ t ∇
[Equation]
L t ( θ t ) (cid:3) as:
[Equation]
Thus, the unrolled update rule for QHM takes the following form:
[Equation]
Now we match the corresponding coefﬁcients in both of the update rules to establish dependencies:
[Equation]
By solving the ﬁrst equation we can establish values for α , β
[Equation]
and ν :
[Equation]
Per our assumption ( Λ TSO )
[Equation]
3 = 12 ( h + q + φ )
= 1 and h − q + φ =
[Equation]
we can recover the following relationships:
[Equation]
We can solve the second equation to ﬁnd g 0 :
[Equation]
Given that ( Λ TSO ) 3 , 3 = 1 and h − q + φ = 0 =
⇒ h − q − φ = − 2 φ , we can simplify:
[Equation]
as desired.
E A N ALTERNATIVE PID SETTING
We very brieﬂy comment on An et al.
(2018)’s PID control setting.
Update rule An et al.
(2018)’s PID control optimizer, parameterized by r, k D , β > 0 , uses the following update rule:
[Equation]
Discussion This setting departs somewhat from typical PID control, in that the signal u t controls the derivative of the controller’s output (i.e. θ t +1 − θ t ) rather than the output itself (i.e. θ t +1 − θ 0 ).
To avoid parameter blowup, this formulation necessitates the addition of exponential decay to the I term, with discount factor β .
The I term thus becomes the momentum buffer.
However, recall from Fact B.1 that the D term is a weighted sum of the momentum buffer and the P term.
It follows that the D term is a weighted sum of the P and I terms, and that this setting is degenerate (either “PI” or “PD”).
As a consequence, the proposed PID algorithm of An et al.
(2018) is less expressive than that of Recht (2018).
Speciﬁcally, applying Fact B.1 demonstrates a mapping into QHM:
[Equation]
Efﬁciency This PID control optimizer is costlier than QHM.
It requires 2 auxiliary buffers of memory.
Computationally, it requires 2 in-place scalar-vector multiplications and 5 scaled vector additions per update step.
F (QH)A DAM ’ S UPDATE BOUND
This appendix elaborates on Adam and QHAdam’s stability properties through the lens of a step size upper bound.
It is well known that the training process for deep learning models can often “explode” due to a very small number of large parameter updates.
With Adam, these large updates can occur if there exist parameters whose stochastic gradients are almost always near zero but incur rare “spikes”.
This is because the square root of the second moment estimate, used in normalizing the gradient for the update step, will be far below the magnitude of these spikes.
There are three main ways to address this instability:
• Firstly, one can simply decrease the learning rate α .
However, this may be undesirable due to slower training.
Secondly, one can increase the (cid:15) hyperparameter.
However, the appropriate setting of (cid:15) depends on the exact magnitudes of these gradient spikes, which is often unknown.
Setting (cid:15) too high effectively turns Adam into SGD.
Thus, setting (cid:15) often reduces to guesswork.
• Thirdly, one can clip gradients.
However, the appropriate magnitude of the gradient clipping also depends on the stochastic gradient distribution.
Thus, this solution also involves a fair amount of guesswork.
However, Adam does provide a useful guarantee – unlike SGD, Adam has an upper bound on the per-step update (Kingma & Ba, 2015).
This upper bound is independent of the gradient distribution (or even temporal correlation), depending only on the hyperparameters α , β 1 , and β 2 .
Thus, no matter the gradient distribution, Adam will restrict the magnitude of the per-step updates to some known constant.
Kingma & Ba (2015) intuitively describe this bound as “establishing a trust region around the current parameter value”.
We show that the step size upper bound claimed in Section 2.1 of Kingma & Ba (2015) is incorrect, by providing the correct tight bound for both Adam and QHAdam.
We then demonstrate that with QHAdam, one can lower the maximum per-step update (and thus improve stability) simply by lowering ν 2 to be below 1.
F. S ETTING
We make two simpliﬁcations.
Firstly, we ﬁx (cid:15) = 0 .
Secondly, we remove the bias correction of the moment estimators (i.e. we use g (cid:48) t +1 ← g t +1 and s (cid:48)
t +1 ← s t +1 ).
In this setting, QHAdam applies the following update rule:
[Equation]
where:
[Equation]
F. I MPLICIT UPDATE BOUND
We now bound QHAdam’s update (before scaling by α ) by a constant dependent only on β 1 , β 2 , ν 1 , and ν 2 :
Fact F.1 (QHAdam tight upper bound on update) .
Assume that ˜ s t +1 is nonzero at each coordinate and that 0 < β 1 < √ β 2 < 1 .
Then, the following per-coordinate tight upper bound holds:
[Equation]
Proof.
Firstly and without loss of generality, we can treat the gradients as single coordinates x i ∈ R .
That is, x i = ∇ ˆ L i ( θ i )
∈ R for i ∈ [0 , t ] .
We perform the following simpliﬁcation of (12) and (13): [Equation] We now wish to ﬁnd the values of x i that maximize ˜ g 2 t +1 ˜ s t +1 .
Applying (14) and (15), these values are characterized by the following ﬁrst-order conditions:
[Equation]
Since the quantity ˜ g 2 t +1 ˜ s t +1 is invariant to scalar multiplication of all x i , we can simplify (16) to:
[Equation]
Plugging the values of x i from (17) into (14) and (15) yields:
[Equation]
The desired result follows immediately
[Equation]
Limit case Consider the limit case of t → ∞ .
Then, the bound in Fact F.1 simpliﬁes to:
[Equation]
[Equation] For vanilla Adam (i
[Equation]
e. ν 1 = ν 2 = 1 ), (18) simpliﬁes further to:
[Equation]
Note that since the bound in (19) is tight, this result contradicts the claim in Section 2.1 of
Kingma & Ba (2015) that Adam’s per-coordinate step size is bounded above by α · max { 1 , (1 − β 1 ) / √ 1 − β 2 } .
In the following discussion, we use the correct bounds from (18) and (19).
F. D ISCUSSION
The recommended vanilla Adam setting of β 2 = 0 .
999 in Kingma & Ba (2015) makes the right-hand side of (19) to be large, and various work has employed Adam with a signiﬁcantly lower β 2 ;
e.g.
0.98 (Vaswani et al., 2017; Ott et al., 2018).
26 Decreasing β 2 is undesirable, often slowing down training.
Moving from Adam to QHAdam, an alternative solution is to decrease ν 2 to be below 1.
This decreases the right-hand side of (18), up to a point, and thus imposes a tighter constraint on the magnitudes of updates than the vanilla Adam setting of ν 2 = 1 .
Fig.
3 shows an example of this phenomenon using a ﬁxed ν 1 , β 1 , and β 2 .
G M ISCELLANEOUS DERIVATIONS
This appendix provides miscellaneous derivations that do not cleanly ﬁt elsewhere.
Fact A.2 (Limit covariance of QHWMA) .
Assume that x 0 ...t are independent random vectors, each with the covariance matrix Σ .
Then:
[Equation]
where ρ is deﬁned as:
[Equation]
Proof.
Due to the independence assumption
[Equation]
the covariance matrix of the QHWMA for t > 0 is simply:
[Equation]
The desired result follows immediately.
Fact B.1 (D term is gradient and momentum) .
v t can be written as:
[Equation]
Proof.
We expand v t as follows, recalling that v − 1 = 0 :
[Equation]
We then proceed by separating out the sum in (20), recalling that e − 1 = 0 :
[Equation]
The desired result follows by substituting e t =
−∇ ˆ L t ( θ t ) into (21).
H QHM AND A GGREGATED M OMENTUM
We perform a brief empirical comparison of QHM and Aggregated Momentum (AggMo), proposed by Lucas et al.
In short, we ﬁnd that for an autoencoder task, we can take the optimal parameterization of AggMo from an extensive parameter sweep, and from that we can construct a
QHM parameterization by hand which outperforms the optimal AggMo parameterization.
H. A LGORITHM : A GGREGATED M OMENTUM (A GG M O )
AggMo is a many-state optimizer that aggregates multiple momentum buffers in its update rule.
AggMo update rule The AggMo algorithm, parameterized by discount factors β ∈ R K and learning rate γ > 0 , uses the update rule:
[Equation]
i
[Equation] [Equation]
Intuitively, AggMo maintains K unnormalized momentum buffers with different discount factors and uses the average of these buffers in the update rule.
H. E MPIRICAL COMPARISON OF QHM AND A GG M O
Experimental setup: EMNIST autoencoders We perform the autoencoder experiments of Lucas et al.
(2018) using the authors’ implementation, 28 with two changes:
We replace the MNIST dataset (LeCun, 1998) with the richer digits subset of the EMNIST dataset (Cohen et al., 2017).
We hold out 10% of the training dataset for validation.
We change the minibatch size from 200 to 256 for computational efﬁciency.
Parameterizing AggMo Lucas et al.
(2018) conduct a sweep over parameterizations of AggMo.
Performing the same sweep, we ﬁnd that the best parameterization of AggMo uses discount factors β =
and learning rate γ = 0 .
We name this parameterization “AggMo-Best”.
Parameterizing QHM We now apply intuition to convert AggMo-
Best into a QHM parameterization, which we name “QHM-Converted”.
We calculate the effective step size α of AggMo-Best:
[Equation]
We round up and use α = 28 as the learning rate for QHM-Converted.
From Section 7.1, our rule of thumb for QHM is ν = 0 .
7 and β = 0 .
However, noting that this rule of thumb is toward replacing momentum/NAG with discount factor 0.9, and observing that the best NAG parameterization reported by Lucas et al.
(2018) uses discount factor 0.99, we instead use ν = 0 .
97 and β = 0 .
999 for QHM-Converted.
In summary, the parameterization of QHM-Converted is α = 28 , ν = 0 . 97 , and β = 0 . 999 , and no optimization or parameter sweeps on this task were performed to construct this parameterization.
Results Fig.
4 and Table 4 present the performance of AggMo-Best and QHM-Converted on the autoencoder task.
QHM-Converted outperforms AggMo-Best on the mean squared error (MSE) metric over the training, validation, and testing datasets.
[Table]
To recap, we take the optimal AggMo parameterization from an extensive sweep, we convert that parameterization by hand to one for QHM, and we ﬁnd that the latter outperforms the former on this autoencoder task.
These results indicate that using multiple momentum buffers with an arbitrary weighting scheme (i.e. AggMo with K > 2 ) provides negligible beneﬁt over using a single slow-decaying momentum buffer with an appropriate weight (i.e. QHM with high β and appropriate ν ).
Passive damping Lucas et al.
(2018) offer an interpretation of AggMo as passive damping for physical systems.
In this interpretation, fast-decaying momentum buffers “dampen” the oscillations of slow-decaying momentum buffers by providing velocity in an opposite direction.
In this context and considering these results, we conjecture that the current gradient already provides adequate damping for a slow-decaying momentum buffer, and that the damping provided by additional momentum buffers is of marginal value.
Extended AggMo Lucas et al.
(2018) propose an extension of AggMo which allows for alternate weighting schemes via separate per-buffer learning rates.
The learning rate becomes a vector γ ∈ R K and (23) becomes the following:
[Equation]
Lucas et al.
(2018) motivate this extension by the recovery of NAG.
In fact, we observe that this extension, with K = 2 and discount factors [0 , β ] , recovers QHM as well.
In independent preliminary experiments on different tasks, we found that various alternate weighting schemes of multiple momentum buffers (i.e. various parameterizations of extended AggMo with
K > 2 ) did not result in material improvements over the single momentum buffer.
However, this preliminary investigation was neither rigorous nor conclusive.
Lucas et al.
(2018) do not empirically explore these alternate weighting schemes, and it is unclear how to do so both comprehensively and efﬁciently, since the number of hyperparameters scales linearly with the number of momentum buffers K .
Toward improving the usability of extended AggMo, we suggest as future work to investigate theoretically grounded or empirically tractable methods to determine good weighting schemes for extended AggMo.
However, given the added costs and complexity of AggMo (both standard and extended), we surmise in the meantime that QHM may be preferable for most practical applications.
I F ULL DETAILS OF EXPERIMENTAL SETUP
Environment All experiments use Python 3.7 and PyTorch 0.4.
(Paszke et al., 2017).
Experiments are run on a mix of NVIDIA P100 and V100 GPUs, along with a mix of CUDA 9.0 and 9.2.
I. P ARAMETER SWEEP EXPERIMENTS
Common settings (all experiments)
Training occurs over 90 epochs (minibatch size 64).
The ﬁrst epoch uses linear warmup of the learning rate α (i.e. α starts from zero and grows to its “regular” value by the end of the epoch).
Each training run uses a single GPU.
Each parameterization is run 3 times with different seeds, and we report training loss, training toperror, and validation top-1 error.
Common settings (QHM experiments)
We use a step decay schedule for the learning rate: α ∈ { 1 , 0 . 1 , 0 . 01 } .
That is, the ﬁrst 30 epochs use α = 1 . 0 , the next 30 epochs use α = 0 . 1 , and the ﬁnal 30 epochs use α = 0 .
We sweep over ν and β using the following two-dimensional grid: ν
[Equation]
[Equation]
Note that this grid encapsulates numerous parameterizations of plain SGD, momentum, and NAG (speciﬁcally, all parameterizations with the β values enumerated above).
Common settings (QHAdam experiments)
We ﬁx α = 0 .
001 , β 2 = 0 .
999 , and (cid:15) =
10 − 8 , as suggested in Kingma & Ba (2015).
We also ﬁx ν 2 = 1 .
We sweep over ν 1 and β 1 using the same grid as for QHM’s ν and β .
I.1. E XPERIMENT : L OGISTIC -EMNIST-QHM
Model The model is multinomial logistic regression with pixel vector input.
Task
The task is digit recognition over the EMNIST dataset – speciﬁcally, the digits subset (Cohen et al., 2017).
Optimizer The model is optimized with QHM.
The optimization objective is cross-entropy loss, plus L2 regularization with coefﬁcient 12 · 10 − 4 .
I.1. E XPERIMENT
: L OGISTIC -EMNIST-QHA DAM
Model Same as in Logistic-EMNIST-QHM.
Task Same as in Logistic-EMNIST-QHM.
Optimizer The model is optimized with QHAdam.
The optimization objective is the same as in
Logistic-EMNIST-QHM.
I.1. E XPERIMENT : MLP-EMNIST-QHM
Model The model is a multilayer perceptron (speciﬁcally, 3 layer feed forward network) with pixel vector input.
The hidden layer sizes are 200, 100, and 50 units, and all hidden units are tanh nonlinearities.
The ﬁnal layer is followed by softmax.
Task Same as in Logistic-EMNIST-QHM.
Optimizer Same as in Logistic-EMNIST-QHM.
I.1. E XPERIMENT : MLP-EMNIST-QHA DAM
Model Same as in MLP-EMNIST-QHM.
Task Same as in MLP-EMNIST-QHM.
Optimizer Same as in Logistic-EMNIST-QHAdam.
I.1. E XPERIMENT : RN18-CIFAR10-QHM
Model The model is a 18-layer convolutional residual network with preactivations (He et al., 2016b).
Task
The task is image recognition on the CIFAR-10 dataset (Krizhevsky, 2009).
Optimizer The model is optimized with QHM.
The optimization objective is cross-entropy loss, plus L2 regularization with coefﬁcient 12 · (5 · 10 − 4 ) .
Other details The implementation generally follows Liu (2017).
Data augmentation includes horizontal ﬂipping at random, as well as random 32-pixel crops with 4-pixel padding.
For batch normalization (Ioffe & Szegedy, 2015), we use online calculation of moments with 0 .
99 exponential decay.
I.1. E XPERIMENT : RN50-I MAGE N ET -QHM
Model The model is a 50-layer convolutional residual network (He et al., 2016a).
Task
The task is image recognition on the ILSVRC2012 (“ImageNet”) 1000-class dataset
(Russakovsky et al., 2015).
Optimizer The model is optimized with QHM.
The optimization objective is cross-entropy loss, plus L2 regularization with coefﬁcient 12 · 10 − 4 .
Other details The implementation generally follows Paszke et al.
Data augmentation includes horizontal ﬂipping at random, as well as random 224-pixel crops.
Validation is performed on 224-pixel center crops.
For batch normalization, we use online calculation of moments with 0 .exponential decay.
The model is trained with half-precision ﬂoating point.
I. C ASE STUDIES I.2. E
XPERIMENT :
RN152-I MAGE N ET -QHM
Model The model is a 152-layer convolutional residual network (He et al., 2016a).
Task Same as in RN50-ImageNet-QHM.
Optimizer (baseline)
We use the baseline conﬁguration (NAG with size-256 minibatches) described in Goyal et al.
Speciﬁcally, the learning rate schedule is α = 0 .
1 for the ﬁrstepochs, α = 0 .
01 for the next 30 epochs, α = 0 .
001 for the next 20 epochs, and α = 0 .
for the ﬁnal 10 epochs.
The optimization objective is cross-entropy loss, plus L2 regularization with coefﬁcient 12 · 10 − 4 .
The only departure from Goyal et al.
(2017) is that we employ a ﬁrst-epoch linear warmup of α (as in the parameter sweep experiments).
Optimizer (QHM)
The non-baseline optimizer is QHM with ν = 0 .
7 and β = 0 .
Following
Section 7.1, we increase the learning rate ( α ) 10-fold.
All other details are identical to the baseline.
Evaluation For each optimizer, we run 3 seeds and report validation top-1 error.
Other details See RN50-ImageNet-QHM for implementation details.
I.2. E XPERIMENT : FC ONV LM-W IKI T EXT 103-QHM
Model The model is the GCNN-14 variant of the gated convolutional language model described in
Dauphin et al.
Dataset The task is language modeling on the WikiText-103 language dataset (Merity et al., 2016).
Optimizer (baseline) For the baseline, we use the conﬁguration described in Dauphin et al.
Speciﬁcally, the model is optimized with 60 epochs of NAG ( β = 0 . 99 ).
We initialize the learning rate to α = 1 . 0 , and we halve it when validation loss begins to increase.
The optimization objective is adaptive cross-entropy, plus direct weight decay with coefﬁcient 5 · 10 − 6 .
We also clip gradient norm with maximum norm of 0.1.
Optimizer (QHM)
The non-baseline optimizer is QHM with ν = 0 .
98 and β = 0 .
Following
Section 7.1, we increase the initial learning rate ( α ) 100-fold.
All other details are identical to the baseline.
Evaluation For each optimizer, we run 10 seeds and report validation perplexity.
Other details The implementation is exactly that of fairseq-py (Gehring et al., 2017).
We train each model on 8 GPUs with half-precision ﬂoating point.
I.2. E XPERIMENT : TD3-M U J O C O -QHA DAM
Model We use the Twin Delayed Deep Deterministic Policy Gradients (TD3) algorithm (Fujimoto et al., 2018) for actor/critic learning.
Both the actor and the critic are represented as multilayer perceptrons.
Task We use a suite of MuJoCo continuous control tasks (Todorov et al., 2012).
In particular, we perform evaluation on the following environments: HalfCheetah, Hopper, Walker2d, Ant, Reacher,
InvertedPendulum, and InvertedDoublePendulum.
Optimizer (baseline) For the baseline, we use Adam with the default parameters ( α = 0 .
001 , β 1 = 0 .
9 , β 2 = 0 .
999 , and (cid:15) =
10 − 8 ) as in Fujimoto et al.
We train for 10 6 iterations.
Optimizer (QHAdam)
The non-baseline optimizer is QHAdam.
We set ν 1 = 0 .
9 , ν 2 = 1 , and otherwise leave the baseline setting unchanged.
Evaluation For each optimizer, we run 10 seeds.
For each seed, we report average reward (onepisodes) every 5000 iterations of training, following Fujimoto et al.
Other details We use Fujimoto et al.
(2018)’s open-sourced implementation 30 , along with version 2 of OpenAI Gym (Brockman et al., 2016).
I.2. E XPERIMENT : TF-WMT16ENDE-QHA DAM
Model We use a Transformer-based model (Vaswani et al., 2017) described in Ott et al.
Task We train our models on a ﬁltered version of the WMT16 English-German machine translation dataset as in Vaswani et al.
(2017), and evaluate on newstest14 for English-German.
Our evaluation setup is identical to the one in Ott et al.
Optimizer (baseline) For the baseline, we use Adam ( β 1 = 0 .
9 , β 2 = 0 .
98 , and (cid:15) =
10 − 8 ) as in
Ott et al.
(2018), training over 70 epochs.
We use the same learning rate schedule as in Vaswani et al.
(2017) and Ott et al.
Speciﬁcally, we increase the learning rate from 10 − 7 to 10 − 3 linearly for 4000 steps, then decay it proportionally to the inverse square root of the number of steps.
We optimize the label smoothed cross-entropy loss as in Vaswani et al.
(2017), with label smoothing of 0.1.
Optimizer (QHAdam)
We use QHAdam ( ν 1 = 0 .
8 , β 1 = 0 .
95 , ν 2 = 0 .
7 , β 2 = 0 .
98 , and (cid:15) =
10 − 8 ) as a non-baseline optimizer.
The other settings are identical to the baseline.
Evaluation For each optimizer, we run 10 seeds and report validation perplexity and validation
BLEU scores.
We observe that 4 seeds for the baseline Adam optimizer “explode” (fail to converge).
Thus, we only consider the 6 best seeds for each optimizer.
Other details
We use Ott et al.
(2018)’s open-sourced implementation in fairseq-py (Gehring et al., 2017).
We train each model on 8 GPUs with half-precision ﬂoating point.
Note that Ott et al.
(2018) uses 128 GPUs; to eliminate this discrepancy and precisely reproduce the training environment, we accumulate gradients over 16 minibatches before each optimization step.
J F ULL PARAMETER SWEEP RESULTS
Fig.
5 shows summary graphs for all parameter sweep experiments.
These summary graphs display selected parameterizations and optimal parameterizations of both the vanilla and QH algorithms.
Full details of experimental settings can be found in Appendix
I
[Figure]
Since each experimental setting contains nearly 200 parameterizations with 3 seeds each
[Figure]
we cannot fully present the data with graphs or tables.
Thus
[Figure]
we provide data ﬁles describing all runs in CSV format at https://tinyurl.com/2018qhdata .
[Figure] [Figure]