On the Convergence of Adam and Beyond

Sashank J. Reddi, Satyen Kale, Sanjiv Kumar

Introduction

Stochastic gradient descent (Sgd) is the dominant method to train deep networks today. This method iteratively updates the parameters of a model by moving them in the direction of the negative gradient of the loss evaluated on a minibatch. In particular, variants of Sgd that scale coordinates of the gradient by square roots of some form of averaging of the squared coordinates in the past gradients have been particularly successful, because they automatically adjust the learning rate on a per-feature basis. The first popular algorithm in this line of research is Adagrad (Duchi et al., 2011; McMahan & Streeter, 2010), which can achieve significantly better performance compared to vanilla Sgd when the gradients are sparse, or in general small.

Although Adagrad works well for sparse settings, its performance has been observed to deteriorate in settings where the loss functions are nonconvex and gradients are dense due to rapid decay of the learning rate in these settings since it uses all the past gradients in the update. This problem is especially exacerbated in high dimensional problems arising in deep learning. To tackle this issue, several variants of Adagrad, such as RMSprop (Tieleman & Hinton, 2012), Adam (Kingma & Ba, 2015), Adadelta (Zeiler, 2012), Nadam (Dozat, 2016), etc, have been proposed which mitigate the rapid decay of the learning rate using the exponential moving averages of squared past gradients, essentially limiting the reliance of the update to only the past few gradients. While these algorithms have been successfully employed in several practical applications, they have also been observed to not converge in some other settings. It has been typically observed that in these settings some minibatches provide large gradients but only quite rarely, and while these large gradients are quite informative, their influence dies out rather quickly due to the exponential averaging, thus leading to poor convergence.

In this paper, we analyze this situation in detail. We rigorously prove that the intuition conveyed in the above paragraph is indeed correct; that limiting the reliance of the update on essentially only the past few gradients can indeed cause significant convergence issues. In particular, we make the following key contributions:

We elucidate how the exponential moving average in the RMSprop and Adam algorithms can cause non-convergence by providing an example of simple convex optimization problem where RMSprop and Adam provably do not converge to an optimal solution. Our analysis easily extends to other algorithms using exponential moving averages such as Adadelta and Nadam as well, but we omit this for the sake of clarity. In fact, the analysis is flexible enough to extend to other algorithms that employ averaging squared gradients over essentially a fixed size window (for exponential moving averages, the influences of gradients beyond a fixed window size becomes negligibly small) in the immediate past. We omit the general analysis in this paper for the sake of clarity.

The above result indicates that in order to have guaranteed convergence the optimization algorithm must have “long-term memory” of past gradients. Specifically, we point out a problem with the proof of convergence of the Adam algorithm given by Kingma & Ba (2015). To resolve this issue, we propose new variants of Adam which rely on long-term memory of past gradients, but can be implemented in the same time and space requirements as the original Adam algorithm. We provide a convergence analysis for the new variants in the convex setting, based on the analysis of Kingma & Ba (2015), and show a data-dependent regret bound similar to the one in Adagrad.

We provide a preliminary empirical study of one of the variants we proposed and show that it either performs similarly, or better, on some commonly used problems in machine learning.

Preliminaries

Optimization setup.

Generic adaptive methods setup.

and αt=α/t\alpha_{t}=\alpha/\sqrt{t} for all t∈[T]t\in[T]. While the decreasing step size is required for convergence, such an aggressive decay of learning rate typically translates into poor empirical performance. The key idea of adaptive methods is to choose averaging functions appropriately so as to entail good convergence. For instance, the first adaptive method Adagrad (Duchi et al., 2011), which propelled the research on adaptive methods, uses the following averaging functions:

and step size αt=α/t\alpha_{t}=\alpha/\sqrt{t} for all t∈[T]t\in[T]. In contrast to a learning rate of α/t\alpha/\sqrt{t} in Sgd, such a setting effectively implies a modest learning rate decay of α/∑igi,j2\alpha/\sqrt{\sum_{i}g_{i,j}^{2}} for j∈[d]j\in[d]. When the gradients are sparse, this can potentially lead to huge gains in terms of convergence (see Duchi et al. (2011)). These gains have also been observed in practice for even few non-sparse settings.

Adaptive methods based on Exponential Moving Averages.

Exponential moving average variants of Adagrad are popular in the deep learning community. RMSprop, Adam, Nadam, and Adadelta are some prominent algorithms that fall in this category. The key difference is to use an exponential moving average as function ψt\psi_{t} instead of the simple average function used in Adagrad. AdamHere, for simplicity, we remove the debiasing step used in the version of Adam used in the original paper by Kingma & Ba (2015). However, our arguments also apply to the debiased version as well., a particularly popular variant, uses the following averaging functions:

for some β1,β2∈[0,1)\beta_{1},\beta_{2}\in[0,1). This update can alternatively be stated by the following simple recursion:

The Non-Convergence of Adam

With the problem setup in the previous section, we discuss fundamental flaw in the current exponential moving average methods like Adam. We show that Adam can fail to converge to an optimal solution even in simple one-dimensional convex settings. These examples of non-convergence contradict the claim of convergence in (Kingma & Ba, 2015), and the main issue lies in the following quantity of interest:

This quantity essentially measures the change in the inverse of learning rate of the adaptive method with respect to time. One key observation is that for Sgd and Adagrad, Γt⪰0\Gamma_{t}\succeq 0 for all t∈[T]t\in[T]. This simply follows from update rules of Sgd and Adagrad in the previous section. In particular, update rules for these algorithms lead to “non-increasing” learning rates. However, this is not necessarily the case for exponential moving average variants like Adam and RMSprop i.e., Γt\Gamma_{t} can potentially be indefinite for t∈[T]t\in[T] . We show that this violation of positive definiteness can lead to undesirable convergence behavior for Adam and RMSprop. Consider the following simple sequence of linear functions for F=\mathcal{F}=:

where C>2C>2. For this function sequence, it is easy to see that the point x=−1x=-1 provides the minimum regret. Suppose β1=0\beta_{1}=0 and β2=1/(1+C2)\beta_{2}=1/(1+C^{2}). We show that Adam converges to a highly suboptimal solution of x=+1x=+1 for this setting. Intuitively, the reasoning is as follows. The algorithm obtains the large gradient CC once every 3 steps, and while the other 2 steps it observes the gradient −1-1, which moves the algorithm in the wrong direction. The large gradient CC is unable to counteract this effect since it is scaled down by a factor of almost CC for the given value of β2\beta_{2}, and hence the algorithm converges to 11 rather than −1-1. We formalize this intuition in the result below.

There is an online convex optimization problem where Adam has non-zero average regret i.e., RT/T↛0R_{T}/T\nrightarrow 0 as T→∞T\rightarrow\infty.

We relegate all proofs to the appendix. A few remarks are in order. One might wonder if adding a small constant in the denominator of the update helps in circumventing this problem i.e., the update for Adam in Algorithm 1 of x^t+1\hat{x}_{t+1} is modified as follows:

The algorithm in (Kingma & Ba, 2015) uses such an update in practice, although their analysis does not. In practice, selection of the ϵ\epsilon parameter appears to be critical for the performance of the algorithm. However, we show that for any constant ϵ>0\epsilon>0, there exists an online optimization setting where, again, Adam has non-zero average regret asymptotically (see Theorem 6 in Section F of the appendix).

The above examples of non-convergence are catastrophic insofar that Adam and RMSprop converge to a point that is worst amongst all points in the set $.Notethataboveexamplealsoholdsforconstantstepsize. Note that above example also holds for constant step size\alpha_{t}=\alpha.AlsonotethatclassicSgdandAdagraddonotsufferfromthisproblemandforthesealgorithms,averageregretasymptoticallygoesto0.Thisproblemisespeciallyaggravatedinhighdimensionalsettingsandwhenthevarianceofthegradientswithrespecttotimeislarge.Thisexamplealsoprovidesintuitionforwhylarge. Also note that classic Sgd and Adagrad do not suffer from this problem and for these algorithms, average regret asymptotically goes to 0. This problem is especially aggravated in high dimensional settings and when the variance of the gradients with respect to time is large. This example also provides intuition for why large\beta_{2}isadvisablewhileusingAdamalgorithm,andindeedinpracticeusinglargeis advisable while using Adam algorithm, and indeed in practice using large\beta_{2}helps.Howeverthefollowingresultshowsthatforanyconstanthelps. However the following result shows that for any constant\beta_{1}andand\beta_{2}withwith\beta_{1}<\sqrt{\beta_{2}}$, we can design an example where Adam has non-zero average rate asymptotically.

For any constant β1,β2∈[0,1)\beta_{1},\beta_{2}\in[0,1) such that β1<β2\beta_{1}<\sqrt{\beta_{2}}, there is an online convex optimization problem where Adam has non-zero average regret i.e., RT/T↛0R_{T}/T\nrightarrow 0 as T→∞T\rightarrow\infty.

The above results show that with constant β1\beta_{1} and β2\beta_{2}, momentum or regularization via ϵ\epsilon will not help in convergence of the algorithm to the optimal solution. Note that the condition β1<β2\beta_{1}<\sqrt{\beta_{2}} is benign and is typically satisfied in the parameter settings used in practice. Furthermore, such condition is assumed in convergence proof of Kingma & Ba (2015). We can strengthen this result by providing a similar example of non-convergence even in the easier stochastic optimization setting:

For any constant β1,β2∈[0,1)\beta_{1},\beta_{2}\in[0,1) such that β1<β2\beta_{1}<\sqrt{\beta_{2}}, there is a stochastic convex optimization problem for which Adam does not converge to the optimal solution.

These results have important consequences insofar that one has to use “problem-dependent” ϵ,β1\epsilon,\beta_{1} and β2\beta_{2} in order to avoid bad convergence behavior. In high-dimensional problems, this typically amounts to using, unlike the update in Equation (3), a different ϵ,β1\epsilon,\beta_{1} and β2\beta_{2} for each dimension. However, this defeats the purpose of adaptive methods since it requires tuning a large set of parameters. We would also like to emphasize that while the example of non-convergence is carefully constructed to demonstrate the problems in Adam, it is not unrealistic to imagine scenarios where such an issue can at the very least slow down convergence.

We end this section with the following important remark. While the results stated above use constant β1\beta_{1} and β2\beta_{2}, the analysis of Adam in (Kingma & Ba, 2015) actually relies on decreasing β1\beta_{1} over time. It is quite easy to extend our examples to the case where β1\beta_{1} is decreased over time, since the critical parameter is β2\beta_{2} rather than β1\beta_{1}, and as long as β2\beta_{2} is bounded away from 11, our analysis goes through. Thus for the sake of clarity, in this paper we only prove non-convergence of Adam in the setting where β1\beta_{1} is held constant.

A New Exponential Moving Average Variant: AMSGrad

In this section, we develop a new principled exponential moving average variant and provide its convergence analysis. Our aim is to devise a new strategy with guaranteed convergence while preserving the practical benefits of Adam and RMSprop. To understand the design of our algorithms, let us revisit the quantity Γt\Gamma_{t} in (2). For Adam and RMSprop, this quantity can potentially be negative. The proof in the original paper of Adam erroneously assumes that Γt\Gamma_{t} is positive semi-definite and is hence, incorrect (refer to Appendix D for more details). For the first part, we modify these algorithms to satisfy this additional constraint. Later on, we also explore an alternative approach where Γt\Gamma_{t} can be made positive semi-definite by using values of β1\beta_{1} and β2\beta_{2} that change with tt.

AMSGrad uses a smaller learning rate in comparison to Adam and yet incorporates the intuition of slowly decaying the effect of past gradients on the learning rate as long as Γt\Gamma_{t} is positive semi-definite. Algorithm 2 presents the pseudocode for the algorithm. The key difference of AMSGrad with Adam is that it maintains the maximum of all vtv_{t} until the present time step and uses this maximum value for normalizing the running average of the gradient instead of vtv_{t} in Adam. By doing this, AMSGrad results in a non-increasing step size and avoids the pitfalls of Adam and RMSprop i.e., Γt⪰0\Gamma_{t}\succeq 0 for all t∈[T]t\in[T] even with constant β2\beta_{2}. Also, in Algorithm 2, one typically uses a constant β1t\beta_{1t} in practice (although, the proof requires a decreasing schedule for proving convergence of the algorithm).

To gain more intuition for the updates of AMSGrad, it is instructive to compare its update with Adam and Adagrad. Suppose at particular time step tt and coordinate i∈[d]i\in[d], we have vt−1,i>gt,i2>0v_{t-1,i}>g_{t,i}^{2}>0, then Adam aggressively increases the learning rate, however, as we have seen in the previous section, this can be detrimental to the overall performance of the algorithm. On the other hand, Adagrad slightly decreases the learning rate, which often leads to poor performance in practice since such an accumulation of gradients over a large time period can significantly decrease the learning rate. In contrast, AMSGrad neither increases nor decreases the learning rate and furthermore, decreases vtv_{t} which can potentially lead to non-decreasing learning rate even if gradient is large in the future iterations. For rest of the paper, we use g1:t=[g1…gt]g_{1:t}=[g_{1}\dots g_{t}] to denote the matrix obtained by concatenating the gradient sequence. We prove the following key result for AMSGrad.

Let {xt}\{x_{t}\} and {vt}\{v_{t}\} be the sequences obtained from Algorithm 2, αt=α/t\alpha_{t}=\alpha/\sqrt{t}, β1=β11\beta_{1}=\beta_{11}, β1t≤β1\beta_{1t}\leq\beta_{1} for all t∈[T]t\in[T] and γ=β1/β2<1\gamma=\beta_{1}/\sqrt{\beta_{2}}<1. Assume that F\mathcal{F} has bounded diameter D∞D_{\infty} and ∥∇ft(x)∥∞≤G∞\|\nabla f_{t}(x)\|_{\infty}\leq G_{\infty} for all t∈[T]t\in[T] and x∈Fx\in\mathcal{F}. For xtx_{t} generated using the AMSGrad (Algorithm 2), we have the following bound on the regret

The following result falls as an immediate corollary of the above result.

Suppose β1t=β1λt−1\beta_{1t}=\beta_{1}\lambda^{t-1} in Theorem 4, then we have

The above bound can be considerably better than O(dT)O(\sqrt{dT}) regret of Sgd when ∑i=1dv^T,i1/2≪d\sum_{i=1}^{d}\hat{v}_{T,i}^{1/2}\ll\sqrt{d} and ∑i=1d∥g1:T,i∥2≪dT\sum_{i=1}^{d}\|g_{1:T,i}\|_{2}\ll\sqrt{dT} (Duchi et al., 2011). Furthermore, in Theorem 4, one can use a much more modest momentum decay of β1t=β1/t\beta_{1t}=\beta_{1}/t and still ensure a regret of O(T)O(\sqrt{T}). We would also like to point out that one could consider taking a simple average of all the previous values of vtv_{t} instead of their maximum. The resulting algorithm is very similar to Adagrad except for normalization with smoothed gradients rather than actual gradients and can be shown to have similar convergence as Adagrad.

Experiments

In this section, we present empirical results on both synthetic and real-world datasets. For our experiments, we study the problem of multiclass classification using logistic regression and neural networks, representing convex and nonconvex settings, respectively.

Synthetic Experiments: To demonstrate the convergence issue of Adam, we first consider the following simple convex setting inspired from our examples of non-convergence:

with the constraint set F=\mathcal{F}=. We first observe that, similar to the examples of non-convergence we have considered, the optimal solution is x=−1x=-1; thus, for convergence, we expect the algorithms to converge to x=−1x=-1. For this sequence of functions, we investigate the regret and the value of the iterate xtx_{t} for Adam and AMSGrad. To enable fair comparison, we set β1=0.9\beta_{1}=0.9 and β2=0.99\beta_{2}=0.99 for Adam and AMSGrad algorithm, which are typically the parameters settings used for Adam in practice. Figure 1 shows the average regret (Rt/tR_{t}/t) and value of the iterate (xtx_{t}) for this problem. We first note that the average regret of Adam does not converge to with increasing tt. Furthermore, its iterates xtx_{t} converge to x=1x=1, which unfortunately has the largest regret amongst all points in the domain. On the other hand, the average regret of AMSGrad converges to and its iterate converges to the optimal solution. Figure 1 also shows the stochastic optimization setting:

Similar to the aforementioned online setting, the optimal solution for this problem is x=−1x=-1. Again, we see that the iterate xtx_{t} of Adam converges to the highly suboptimal solution x=1x=1.

Logistic Regression: To investigate the performance of the algorithm on convex problems, we compare AMSGrad with Adam on logistic regression problem. We use MNIST dataset for this experiment, the classification is based on 784 dimensional image vector to one of the 10 class labels. The step size parameter αt\alpha_{t} is set to α/t\alpha/\sqrt{t} for both Adam and AMSGrad in for our experiments, consistent with the theory. We use a minibatch version of these algorithms with minibatch size set to 128128. We set β1=0.9\beta_{1}=0.9 and β2\beta_{2} is chosen from the set {0.99,0.999}\{0.99,0.999\}, but they are fixed throughout the experiment. The parameters α\alpha and β2\beta_{2} are chosen by grid search. We report the train and test loss with respect to iterations in Figure 2. We can see that AMSGrad performs better than Adam with respect to both train and test loss. We also observed that AMSGrad is relatively more robust to parameter changes in comparison to Adam.

Neural Networks: For our first experiment, we trained a simple 1-hidden fully connected layer neural network for the multiclass classification problem on MNIST. Similar to the previous experiment, we use β1=0.9\beta_{1}=0.9 and β2\beta_{2} is chosen from {0.99,0.999}\{0.99,0.999\}. We use a fully connected 100 rectified linear units (ReLU) as the hidden layer for this experiment. Furthermore, we use constant αt=α\alpha_{t}=\alpha throughout all our experiments on neural networks. Such a parameter setting choice of Adam is consistent with the ones typically used in the deep learning community for training neural networks. A grid search is used to determine parameters that provides the best performance for the algorithm.

Finally, we consider the multiclass classification problem on the standard CIFAR-10 dataset, which consists of 60,000 labeled examples of 32×3232\times 32 images. We use Cifarnet, a convolutional neural network (CNN) with several layers of convolution, pooling and non-linear units, for training a multiclass classifer for this problem. In particular, this architecture has 2 convolutional layers with 64 channels and kernel size of 6×66\times 6 followed by 2 fully connected layers of size 384 and 192. The network uses 2×22\times 2 max pooling and layer response normalization between the convolutional layers (Krizhevsky et al., 2012). A dropout layer with keep probability of 0.5 is applied in between the fully connected layers (Srivastava et al., 2014). The minibatch size is also set to 128 similar to previous experiments. The results for this problem are reported in Figure 2. The parameters for Adam and AMSGrad are selected in a way similar to the previous experiments. We can see that AMSGrad performs considerably better than Adam on train loss and accuracy. Furthermore, this performance gain also translates into good performance on test loss.

An alternative approach is to use an increasing schedule of β2\beta_{2} in Adam. This approach, unlike Algorithm 2 does not require changing the structure of Adam but rather uses a non-constant β1\beta_{1} and β2\beta_{2}. The pseudocode for the algorithm, AdamNc, is provided in the appendix (Algorithm 3). We show that by appropriate selection of β1t\beta_{1t} and β2t\beta_{2t}, we can achieve good convergence rates.

Let {xt}\{x_{t}\} and {vt}\{v_{t}\} be the sequences obtained from Algorithm 3, αt=α/t\alpha_{t}=\alpha/\sqrt{t}, β1=β11\beta_{1}=\beta_{11} and β1t≤β1\beta_{1t}\leq\beta_{1} for all t∈[T]t\in[T]. Assume that F\mathcal{F} has bounded diameter D∞D_{\infty} and ∥∇ft(x)∥∞≤G∞\|\nabla f_{t}(x)\|_{\infty}\leq G_{\infty} for all t∈[T]t\in[T] and x∈Fx\in\mathcal{F}. Furthermore, let {β2t}\{\beta_{2t}\} be such that the following conditions are satisfied:

1αT∑j=1tΠk=1t−jβ2(t−k+1)(1−β2j)gj,i2≥1ζ∑j=1tgj,i2\frac{1}{\alpha_{T}}\sqrt{\sum_{j=1}^{t}\Pi_{k=1}^{t-j}\beta_{2(t-k+1)}(1-\beta_{2j})g_{j,i}^{2}}\geq\frac{1}{\zeta}\sqrt{\sum_{j=1}^{t}g_{j,i}^{2}} for some ζ>0\zeta>0 and all t∈[T]t\in[T], j∈[d]j\in[d].

vt,i1/2αt≥vt−1,i1/2αt−1\frac{v_{t,i}^{1/2}}{\alpha_{t}}\geq\frac{v_{t-1,i}^{1/2}}{\alpha_{t-1}} for all t∈{2,⋯ ,T}t\in\{2,\cdots,T\} and i∈[d]i\in[d].

Then for xtx_{t} generated using the AdamNc (Algorithm 3), we have the following bound on the regret

The above result assumes selection of {(αt,β2t)}\{(\alpha_{t},\beta_{2t})\} such that Γt⪰0\Gamma_{t}\succeq 0 for all t∈{2,⋯ ,T}t\in\{2,\cdots,T\}. However, one can generalize the result to deal with the case where this constraint is violated as long as the violation is not too large or frequent. Following is an immediate consequence of the above result.

Suppose β1t=β1λt−1\beta_{1t}=\beta_{1}\lambda^{t-1} and β2t=1−1/t\beta_{2t}=1-1/t in Theorem 5, then we have

The above corollary follows from a trivial fact that vt,i=∑j=1tgj,i2/tv_{t,i}=\sum_{j=1}^{t}g_{j,i}^{2}/t for all i∈[d]i\in[d] when β2t=1−1/t\beta_{2t}=1-1/t. This corollary is interesting insofar that such a parameter setting effectively yields a momentum based variant of Adagrad. Similar to Adagrad, the regret is data-dependent and can be considerably better than O(dT)O(\sqrt{dT}) regret of Sgd when ∑i=1d∥g1:T,i∥2≪dT\sum_{i=1}^{d}\|g_{1:T,i}\|_{2}\ll\sqrt{dT} (Duchi et al., 2011). It is easy to generalize this result for setting similar settings of β2t\beta_{2t}. Similar to Corollary 1, one can use a more modest decay of β1t=β1/t\beta_{1t}=\beta_{1}/t and still ensure a data-dependent regret of O(T)O(\sqrt{T}).

Discussion

In this paper, we study exponential moving variants of Adagrad and identify an important flaw in these algorithms which can lead to undesirable convergence behavior. We demonstrate these problems through carefully constructed examples where RMSprop and Adam converge to highly suboptimal solutions. In general, any algorithm that relies on an essentially fixed sized window of past gradients to scale the gradient updates will suffer from this problem.

We proposed fixes to this problem by slightly modifying the algorithms, essentially endowing the algorithms with a long-term memory of past gradients. These fixes retain the good practical performance of the original algorithms, and in some cases actually show improvements.

The primary goal of this paper is to highlight the problems with popular exponential moving average variants of Adagrad from a theoretical perspective. RMSprop and Adam have been immensely successful in development of several state-of-the-art solutions for a wide range of problems. Thus, it is important to understand their behavior in a rigorous manner and be aware of potential pitfalls while using them in practice. We believe this paper is a first step in this direction and suggests good design principles for faster and better stochastic optimization.

References

Appendix

Appendix A Proof of Theorem 1

We consider the setting where ftf_{t} are linear functions and F=\mathcal{F}=. In particular, we define the following function sequence:

where C≥2C\geq 2. For this function sequence, it is easy to see that the point x=−1x=-1 provides the minimum regret. Without loss of generality, assume that the initial point is x1=1x_{1}=1. This can be assumed without any loss of generality because for any choice of initial point, we can always translate the coordinate system such that the initial point is x1=1x_{1}=1 in the new coordinate system and then choose the sequence of functions as above in the new coordinate system. Also, since the problem is one-dimensional, we drop indices representing coordinates from all quantities in Algorithm 1. Consider the execution of Adam algorithm for this sequence of functions with

where α<1−β2\alpha<\sqrt{1-\beta_{2}}. Note that since gradients of these functions are bounded, F\mathcal{F} has bounded L∞L_{\infty} diameter and β12/β2<1\beta_{1}^{2}/\sqrt{\beta_{2}}<1. Hence, the conditions on the parameters required for Adam are satisfied (refer to (Kingma & Ba, 2015) for more details).

From (3t+1)th(3t+1)^{\text{th}} update of Adam in Equation (1), we obtain

The equality follows from the induction hypothesis. We observe the following:

The second inequality follows from the step size choice that α<1−β2\alpha<\sqrt{1-\beta_{2}}. Therefore, we have 0<x^3t+2<10<\hat{x}_{3t+2}<1 and hence x3t+2=x^3t+2>0x_{3t+2}=\hat{x}_{3t+2}>0. Furthermore, after the (3t+2)th(3t+2)^{\text{th}} and (3t+3)th(3t+3)^{\text{th}} updates of Adam in Equation (1), we have the following:

Since x3t+2>0x_{3t+2}>0, it is easy to see that x3t+3>0x_{3t+3}>0. To complete the proof, we need to show that x3t+4=1x_{3t+4}=1. In order to prove this claim, we show that x^3t+4≥1\hat{x}_{3t+4}\geq 1, which readily translates to x3t+4=1x_{3t+4}=1 because x3t+4=ΠF(x^3t+4)x_{3t+4}=\Pi_{\mathcal{F}}(\hat{x}_{3t+4}) and F=\mathcal{F}= here ΠF\Pi_{\mathcal{F}} is the simple Euclidean projection (note that in one-dimension, ΠF,Vt=ΠF\Pi_{\mathcal{F},\sqrt{V_{t}}}=\Pi_{\mathcal{F}}). We observe the following:

The above equality is due to the fact that x^3t+3>0\hat{x}_{3t+3}>0 and property of projection operation onto the set F=\mathcal{F}=. We consider the following two cases:

Suppose x^3t+3≥1\hat{x}_{3t+3}\geq 1, then it is easy to see from the above equality that x^3t+4>1\hat{x}_{3t+4}>1.

Suppose x^3t+3<1\hat{x}_{3t+3}<1, then we have the following:

The third equality is due to the fact that x3t+2=x^3t+2x_{3t+2}=\hat{x}_{3t+2}. Thus, to prove x^3t+4>1\hat{x}_{3t+4}>1, it is enough to the prove:

We have the following bound on term T1T_{1} from Equation (4):

Furthermore, we lower bound T2T_{2} in the following manner:

for the choice of β2=1/(1+C2)\beta_{2}=1/(1+C^{2}). Therefore, we have T2≥T1T_{2}\geq T_{1} and hence, x^3t+4≥1\hat{x}_{3t+4}\geq 1.

Therefore, for every 3 steps, Adam suffers a regret of at least 2C−42C-4. More specifically, RT≥(2C−4)T/3R_{T}\geq(2C-4)T/3. Since C≥2C\geq 2, this regret can be very large and furthermore, RT/T↛0R_{T}/T\nrightarrow 0 as T→∞T\rightarrow\infty, which completes the proof. ∎

Appendix B Proof of Theorem 2

The proof generalizes the optimization setting used in Theorem 1. Throughout the proof, we assume β1<β2\beta_{1}<\sqrt{\beta_{2}}, which is also a condition (Kingma & Ba, 2015) assume in their paper. In this proof, we consider the setting where ftf_{t} are linear functions and F=\mathcal{F}=. In particular, we define the following function sequence:

where γ=β1/β2<1\gamma=\beta_{1}/\sqrt{\beta_{2}}<1. It is not hard to see that these conditions hold for large constant CC that depends on β1\beta_{1} and β2\beta_{2}. Since the problem is one-dimensional, we drop indices representing coordinates from all quantities in Algorithm 1. For this function sequence, it is easy to see that the point x=−1x=-1 provides the minimum regret since C≥2C\geq 2. Furthermore, the gradients have the following form:

If mkC≤0m_{kC}\leq 0, it can be easily shown that mkC+C≤0m_{kC+C}\leq 0 for our selection of CC in Equation (7) by using the principle of mathematical induction. With this observation we continue to the main part of the proof. Let T′T^{\prime} be such that t+C≤τ2tt+C\leq\tau^{2}t for all t≥T′t\geq T^{\prime} where τ≤3/2\tau\leq 3/2. All our analysis focuses on iterations t≥T′t\geq T^{\prime}. Note that any regret before T′T^{\prime} is just a constant because T′T^{\prime} is independent of TT and thus, the average regret is negligible as T→∞T\rightarrow\infty. Consider an iterate at time step tt of the form kCkC after T′T^{\prime}. Our claim is that

for some ct>0c_{t}>0. To see this, consider the updates of Adam for the particular sequence of functions we considered are:

For i∈{2,⋯ ,C}i\in\{2,\cdots,C\}, we use the following notation:

Note that if δt+j≥0\delta_{t+j}\geq 0 for some j∈{1,⋯ ,C−1}j\in\{1,\cdots,C-1\} then δt+l≥0\delta_{t+l}\geq 0 for all l∈{j,⋯ ,C−1}l\in\{j,\cdots,C-1\}. This follows from the fact that the gradient is negative for all time steps i∈{2,⋯ ,C}i\in\{2,\cdots,C\}. Using Lemma 6 for {xt+1,⋯ ,xt+C}\{x_{t+1},\cdots,x_{t+C}\} and {δt,⋯ ,δt+C−1}\{\delta_{t},\cdots,\delta_{t+C-1}\}, we have the following:

Let i′=C/2i^{\prime}=C/2. In order to prove our claim in Equation (10), we need to prove the following:

The first equality follows from the definition of mt+i+1m_{t+i+1}. The first inequality follows from the fact that mt≤0m_{t}\leq 0 when t mod C=0t\bmod C=0 (see Equation (9) and arguments based on it). The second inequality follows from the definition of τ\tau that t+C≤τ2tt+C\leq\tau^{2}t for all t≥T′t\geq T^{\prime}. The third inequality is due to the fact that vt+i−1≥(1−β2)β2i−2C2v_{t+i-1}\geq(1-\beta_{2})\beta_{2}^{i-2}C^{2}. The last inequality follows from our choice of CC. The fourth inequality is due to the following upper bound that applies for all i′≤i≤Ci^{\prime}\leq i\leq C:

The first inequality follows from online problem setting for the counter-example i.e., gradient is CC once every CC iterations and −1-1 for the rest. The last inequality follows from the fact that β2i′−1C2≤1\beta_{2}^{i^{\prime}-1}C^{2}\leq 1 and β2C≤β2\beta_{2}^{C}\leq\beta_{2}. Furthermore, from the above inequality, we have

Note that from our choice of CC, it is easy to see that λ≥0\lambda\geq 0. Also, observe that λ\lambda is independent of tt. Thus, xt+C≥min⁡{1,xt+λ/t}x_{t+C}\geq\min\{1,x_{t}+\lambda/\sqrt{t}\}. From this fact, we also see the following:

If xt=1x_{t}=1, then xt+C=1x_{t+C}=1 for all t≥T′t\geq T^{\prime} such that t mod C=0t\bmod C=0.

There exists constant T1′≥T′T_{1}^{\prime}\geq T^{\prime} such that xT1′=1x_{T_{1}^{\prime}}=1 where T1′ mod C=0T_{1}^{\prime}\bmod C=0.

The first point simply follows from the relation xt+C≥min⁡{1,xt+λ/t}x_{t+C}\geq\min\{1,x_{t}+\lambda/\sqrt{t}\}. The second point is due to divergent nature of the sum ∑t=t′∞1/t\sum_{t=t^{\prime}}^{\infty}1/\sqrt{t}. Therefore, we have

where kC≥T1′kC\geq T_{1}^{\prime}. Thus, when t≥T1′t\geq T_{1}^{\prime}, for every C steps, Adam suffers a regret of at least 22. More specifically, RT≥2(T−T1′)/CR_{T}\geq 2(T-T_{1}^{\prime})/C. Thus, RT/T↛0R_{T}/T\nrightarrow 0 as T→∞T\rightarrow\infty, which completes the proof. ∎

Appendix C Proof of Theorem 3

Let δ\delta be an arbitrary small positive constant, and CC be a large enough constant chosen as a function of β1,β2,δ\beta_{1},\beta_{2},\delta that will be determined in the proof.

Consider the following one dimensional stochastic optimization setting over the domain $.Ateachtimestep. At each time stept,thefunction, the functionf_{t}(x)$ is chosen i.i.d. as follows:

The expected function is F(x)=δxF(x)=\delta x; thus the optimum point over $isisx^{\star}=-1.Ateachtimestep. At each time steptthegradientthe gradientg_{t}equalsequalsCwithprobabilitywith probabilitypandand-1withprobabilitywith probability1-p$. Thus, the step taken by Adam is

We will bound the expectation of the terms T1T_{1}, T2T_{2} and T3T_{3} above separately.

Let EE denote the event that for every i=t−1,t−2,…,max⁡{t−k,1}i=t-1,t-2,\ldots,\max\{t-k,1\}, gi=−1g_{i}=-1. Note that Pr⁡[E]≥1−kp\Pr[E]\geq 1-kp. Assuming EE happens, we can bound mt−1m_{t-1} as follows:

With probability at most kpkp, the event EE doesn’t happen. In this case, we bound T2T_{2} as follows. We first bound mt−1m_{t-1} in terms of vt−1v_{t-1} using the Cauchy-Schwarz inequality as follows:

Thus, vt−1≥mt−12/A2v_{t-1}\geq m_{t-1}^{2}/A^{2}. Thus, we have

The last inequality follows by using the facts vt−1=(1−β2)∑i=1t−1β2t−1−igi2v_{t-1}=(1-\beta_{2})\sum_{i=1}^{t-1}\beta_{2}^{t-1-i}g_{i}^{2}, and the random variables g12,g22,…,gt−12g_{1}^{2},g_{2}^{2},\ldots,g_{t-1}^{2} are i.i.d., and so

It is evident that for CC large enough (as a function of δ,β1,β2\delta,\beta_{1},\beta_{2}), the above expression can be made non-negative. ∎

Appendix D Proof of Theorem 4

The proof of Theorem 4 presented below is along the lines of the Theorem 4.1 in (Kingma & Ba, 2015) which provides a claim of convergence for Adam. As our examples showing non-convergence of Adam indicate, the proof in (Kingma & Ba, 2015) has problems. The main issue in their proof is the incorrect assumption that Γt\Gamma_{t} defined in their equation (3) is positive semidefinite, and we also identified problems in lemmas 10.3 and 10.4 in their paper. The following proof fixes these issues and provides a proof of convergence for AMSGrad.

Furthermore, ΠF,V^t(x∗)=x∗\Pi_{\mathcal{F},\sqrt{\hat{V}_{t}}}(x^{*})=x^{*} for all x∗∈Fx^{*}\in\mathcal{F}. In this proof, we will use xi∗x_{i}^{*} to denote the ithi^{\text{th}} coordinate of x∗x^{*}. Using Lemma 4 with u1=xt+1u_{1}=x_{t+1} and u2=x∗u_{2}=x^{*}, we have the following:

Rearranging the above inequality, we have

The second inequality follows from simple application of Cauchy-Schwarz and Young’s inequality. We now use the standard approach of bounding the regret at each step using convexity of the function ftf_{t} in the following manner:

The first inequality is due to convexity of function ftf_{t}. The second inequality follows from the bound in Equation (D) and the fact that v^t−1,i≤v^t,i\hat{v}_{t-1,i}\leq\hat{v}_{t,i}. For further bounding this inequality, we need the following intermediate result.

For the parameter settings and conditions assumed in Theorem 4, we have

The first inequality follows from the definition of v^T,i\hat{v}_{T,i}, which is maximum of all vT,iv_{T,i} until the current time step. The second inequality follows from the update rule of Algorithm 2. We further bound the above inequality in the following manner:

The first inequality follows from Cauchy-Schwarz inequality. The second inequality is due to the fact that β1k≤β1\beta_{1k}\leq\beta_{1} for all k∈[T]k\in[T]. The third inequality follows from the inequality ∑j=1Tβ1T−j≤1/(1−β1)\sum_{j=1}^{T}\beta_{1}^{T-j}\leq 1/(1-\beta_{1}). By using similar upper bounds for all time steps, the quantity in Equation (17) can further be bounded as follows:

The third inequality follows from the fact that ∑j=tTγj−t≤1/(1−γ)\sum_{j=t}^{T}\gamma^{j-t}\leq 1/(1-\gamma). The fourth inequality is due to simple application of Cauchy-Schwarz inequality. The final inequality is due to the following bound on harmonic sum: ∑t=1T1/t≤(1+log⁡T)\sum_{t=1}^{T}1/t\leq(1+\log T). This completes the proof of the lemma. ∎

We now return to the proof of Theorem 4. Using the above lemma in Equation (16)For the sake of clarity, we provide more details of the proof here compared to the original version. Also, the original proof had a missing constant factor of 21−β1\tfrac{2}{1-\beta_{1}} in the regret bound, which has been addressed here. , we have:

The second inequality uses the fact that β1t≤β1\beta_{1t}\leq\beta_{1}, and the observations that v^t,i1/2αt≥v^t−1,i1/2αt−1\tfrac{\hat{v}_{t,i}^{1/2}}{\alpha_{t}}\geq\tfrac{\hat{v}_{t-1,i}^{1/2}}{\alpha_{t-1}} and

In order to further simplify the bound in Equation (18), we need to use telescopic sum. Using the above fact and L∞L_{\infty} bound on the feasible region and making use of the above property in Equation (18), we have:

The equality follows from simple telescopic sum, which yields the desired result. One important point to note here is that the regret of AMSGrad can be bounded by O(G∞T)O(G_{\infty}\sqrt{T}). This can be easily seen from the proof of the aforementioned lemma where in the analysis the term ∑t=1T∣gt,i∣/t\sum_{t=1}^{T}|g_{t,i}|/\sqrt{t} can also be bounded by O(G∞T)O(G_{\infty}\sqrt{T}). Thus, the regret of AMSGrad is upper bounded by minimum of O(G∞T)O(G_{\infty}\sqrt{T}) and the bound in the Theorem 4 and therefore, the worst case dependence of regret on TT in our case is O(T)O(\sqrt{T}). ∎

Appendix E Proof of Theorem 5

Using similar argument to proof of Theorem 4 until Equation (D), we have the following

The second inequality follows from simple application of Cauchy-Schwarz and Young’s inequality. We now use the standard approach of bounding the regret at each step using convexity of the function ftf_{t} in the following manner:

The inequalities follow due to convexity of function ftf_{t} and the fact that vt,i1/2αt≥vt−1,i1/2αt−1\tfrac{v_{t,i}^{1/2}}{\alpha_{t}}\geq\tfrac{v_{t-1,i}^{1/2}}{\alpha_{t-1}} . For further bounding this inequality, we need the following intermediate result.

For the parameter settings and conditions assumed in Theorem 5, we have

The first inequality follows from the update rule of Algorithm 2. We further bound the above inequality in the following manner:

The first inequality follows from Cauchy-Schwarz inequality. The second inequality is due to the fact that β1k≤β1\beta_{1k}\leq\beta_{1} for all k∈[T]k\in[T]. The third inequality follows from the inequality ∑j=1Tβ1T−j≤1/(1−β1)\sum_{j=1}^{T}\beta_{1}^{T-j}\leq 1/(1-\beta_{1}). Using similar argument for all time steps, the quantity in Equation (21) can be bounded as follows:

The final inequality is due to Lemma 5. This completes the proof of the lemma. ∎

Using the above lemma in Equation (20) , we have:

The first inequality and second inequality use the fact that β1t≤β1\beta_{1t}\leq\beta_{1} and argument similar to that in Theorem 4. Furthermore, from the theorem statement, we know that that {(αt.β2t)}\{(\alpha_{t}.\beta_{2t})\} are selected such that the following holds:

Using the L∞L_{\infty} bound on the feasible region and making use of the above property in Equation (22), we have:

The equality follows from simple telescopic sum, which yields the desired result. ∎

Appendix F Proof of Theorem 6

For any ϵ>0\epsilon>0, Adam with the modified update in Equation (3) and with parameter setting such that all the conditions in (Kingma & Ba, 2015) are satisfied can have non-zero average regret i.e., RT/T↛0R_{T}/T\nrightarrow 0 as T→∞T\rightarrow\infty for convex {fi}i=1∞\{f_{i}\}_{i=1}^{\infty} with bounded gradients on a feasible set F\mathcal{F} having bounded D∞D_{\infty} diameter.

Let us first consider the case where ϵ=1\epsilon=1 (in fact, the same setting works for any ϵ≤1\epsilon\leq 1). The general ϵ\epsilon case can be proved by simply rescaling the sequence of functions by a factor of ϵ\sqrt{\epsilon}. We show that the same optimization setting in Theorem 1 where ftf_{t} are linear functions and F=\mathcal{F}=, hence, we only discuss the details that differ from the proof of Theorem 1. In particular, we define the following function sequence:

where C≥2C\geq 2. Similar to the proof of Theorem 1, we assume that the initial point is x1=1x_{1}=1 and the parameters are:

The last inequality follows by simply dropping v3tv_{3t} term and using the relation that α<1−β2\alpha<\sqrt{1-\beta_{2}}. Therefore, we have 0<x^3t+2<10<\hat{x}_{3t+2}<1 and hence x3t+2=x^3t+2>0x_{3t+2}=\hat{x}_{3t+2}>0. Furthermore, after the (3t+2)th(3t+2)^{\text{th}} and (3t+3)th(3t+3)^{\text{th}} updates of Adam in Equation (1), we have the following:

Since x3t+2>0x_{3t+2}>0, it is easy to see that x3t+3>0x_{3t+3}>0. To complete the proof, we need to show that x3t+4=1x_{3t+4}=1. The only change here from the proof of Theorem 1 is that we need to show the following:

Therefore, for every 3 steps, Adam suffers a regret of at least 2C−42C-4. More specifically, RT≥(2C−4)T/3R_{T}\geq(2C-4)T/3. Since C≥2C\geq 2, this regret can be very large and furthermore, RT/T↛0R_{T}/T\nrightarrow 0 as T→∞T\rightarrow\infty, which completes the proof of the case where ϵ=1\epsilon=1. For the general ϵ\epsilon case, we consider the following sequence of functions:

The functions are essentially rescaled in a manner so that the resultant updates of Adam correspond to the one in the optimization setting described above. Using essentially the same argument as above, it is easy to show that the regret RT≥(2C−4)ϵT/3R_{T}\geq(2C-4)\sqrt{\epsilon}T/3 and thus, the average regret is non-zero asymptotically, which completes the proof. ∎

Appendix G Auxiliary Lemma

We provide the proof here for completeness. Since u1=min⁡x∈F∥Q1/2(x−z1)∥u_{1}=\min_{x\in\mathcal{F}}\|Q^{1/2}(x-z_{1})\| and u2=min⁡x∈F∥Q1/2(x−z2)∥u_{2}=\min_{x\in\mathcal{F}}\|Q^{1/2}(x-z_{2})\| and from the property of projection operator we have the following:

Combining the above inequalities, we have

The above inequality can be obtained from the fact that ⟨(u2−u1)−(z2−z1),Q((u2−u1)−(z2−z1))⟩≥0\langle(u_{2}-u_{1})-(z_{2}-z_{1}),Q((u_{2}-u_{1})-(z_{2}-z_{1}))\rangle\geq 0 as Q∈S+dQ\in\mathcal{S}_{+}^{d} and rearranging the terms. Combining the above inequality with Equation (24), we have the required result. ∎

For any non-negative real numbers y1,⋯ ,yty_{1},\cdots,y_{t}, the following holds:

for all the t∈[T]t\in[T], y1∈Fy_{1}\in\mathcal{F} and furthermore, there exists i∈[T]i\in[T] such that δj≤0\delta_{j}\leq 0 for all j≤ij\leq i and δj>0\delta_{j}>0 for all j>ij>i. Then we have,

It is first easy to see that yi+1≥y1+∑j=1iδjy_{i+1}\geq y_{1}+\sum_{j=1}^{i}\delta_{j} since δj≤0\delta_{j}\leq 0 for all j≤ij\leq i. Furthermore, also observe that yT+1≥min⁡{b,yi+1+∑j=i+1Tδj}y_{T+1}\geq\min\{b,y_{i+1}+\sum_{j=i+1}^{T}\delta_{j}\} since δj≥0\delta_{j}\geq 0 for all j>ij>i. Combining the above two inequalities gives us the desired result. ∎