RMSprop converges with proper hyper-parameter

1 INTRODUCTION . RMSprop ( Tieleman & Hinton , 2012 ) remains one of the most popular algorithms for machine learning applications . As a non-momentum version of a more general algorithm Adam , RMSprop ’ s good empirical performance has been well acknowledged by practitioners in generative adversarial networks ( GANs ) ( Seward et al. , 2018 ; Yazıcı et al. , 2019 ; Karnewar & Wang , 2020 ; JolicoeurMartineau , 2019 ) , reinforcement learning ( Mnih et al. , 2016 ) , etc . In spite of its prevalence , however , Reddi et al . ( 2018 ) discovered that RMSprop ( as well as the more general version Adam ) can diverge even for simple convex functions . To fix the algorithm , the authors of Reddi et al . ( 2018 ) proposed a new variant called AMSGrad , which is guaranteed to converge under certain conditions . Since then , it has been an active area of research to design provably convergent variants of RMSprop . These variants include AdaFom ( Chen et al. , 2019 ) , Adabound ( Luo et al. , 2019 ) , Nostalgic Adam ( Huang et al. , 2019 ) , Yogi ( Zaheer et al. , 2018 ) , and many more . Despite the variants , the vanilla RMSprop indeed works well in practice , and after proper hyper-parameter tuning , the non-convergence issue has not been commonly observed . Why is there a large gap between theory and practice ? Is this because the real-world problems are likely to be “ nice ” , or is it because the theoretical analysis of RMSprop does not match how it is used in practice ? With the above questions in mind , we revisited the counter-example of Reddi et al . ( 2018 ) , and found an interesting phenomenon . One counter-example of Reddi et al . ( 2018 ) is the following : ft ( x ) = { Cx , for t mod C = 1 −x , otherwise ( 1 ) where x ∈ [ −1 , 1 ] . They proved the divergence under the condition β2 ≤ min { C− 4 C−2 , 1− ( 9 2C ) 2 } , where β2 is the second order momentum coefficient in Algorithm 1 ( the algorithm is presented later ) . For instance , when C = 10 , then the algorithm diverges if β2 < 0.3 . Reddi et al . ( 2018 ) mentioned ∗IOE , University of Michigan , naichens @ umich.edu . Part of the work was done when Naichen Shi was working with Prof. Ruoyu Sun as an intern . †ISE , University of Illinois at Urbana-Champaign . dawei2 @ illinois.edu ‡ECE , University of Minnesota - Twin Cities , mhong @ umn.edu . §University of Illinois at Urbana-Champaign . ruoyus @ illinois.edu . Corresponding author : Ruoyu Sun . that “ this explains why large β2 is advisable while using Adam algorithm ” , but they did not analyze whether large β2 leads to convergence in their example . We ran simulation for problem ( 1 ) with different β2 and found there is always a threshold of β2 above which RMSprop converges , see Figure 1 . For instance , when C = 10 , the transition point of β2 is roughly 0.955 : the algorithm converges if β2 > 0.956 but diverges if β2 < 0.955 . In general , there is a curve of phase transition from divergence to convergence , and such a curve slopes upward , which means the transition point is closer to 1 if C becomes larger . Based on this observation , we make the following conjecture : Conjecture : RMSprop converges if β2 is large enough . Before further discussion , we introduce the following assumption . Assumption 1.1. f ( x ) = ∑n−1 j=0 fj ( x ) , and n−1∑ j=0 ‖∇fj ( x ) ‖22 ≤ D1 ‖∇f ( x ) ‖ 2 2 +D0 . ( 2 ) We divide optimization problems into 2 classes : realizable problems where D0 = 0 and non-realizable problems where D0 > 0 . When D0 = 0 , the assumption ( 1.1 ) becomes∑n−1 j=0 ‖∇fj ( x ) ‖ 2 2 ≤ D1 ‖∇f ( x ) ‖ 2 2 , which is called “ strong growth condition ” ( SGC ) ( Vaswani et al. , 2019 ) . It requires the norm of the stochastic gradient to be proportional to the batch gradient norm . When ‖∇f ( x ) ‖ = 0 , under SGC we have ‖∇fj ( x ) ‖ = 0 for all j . For linear regression problems , SGC holds if the linear model can fit all data . More specifically , for the problem minx ‖Ax‖2 = ∑n j=1 ( aTj x ) 2 where A is an n by n matrix and aTj is the j-th row vector of A , SGC holds with D1 ≤ λmax ( ∑n i=1 aia T i aia T i ) /λmin ( ATA ) ( Raj & Bach , 2020 ) . SGC can be viewed as a simple condition that models overparameterized neural networks capable of interpolating all data points ( Vaswani et al. , 2019 ) . Therefore , in this work we use the terminology “ realizable problems ” to refer to the problems that satisfy SGC . 1.1 MAIN CONTRIBUTIONS . In an attempt to resolve the conjecture , we delve into RMSprop ’ s convergence issues and obtain a series of theoretical and empirical results . Our contributions are summarized below : • We find that RMSprop ’ s convergence is contingent on the choice of β2 . For general optimization problems , there are two types of hyper-parameters : problem-dependent hyperparameters such as step size in GD , and universal constants such as momentum coefficient in heavy ball method 1 . Our result reveals that β2 is closer to the first type . • We prove that RMSprop converges to stationary point for realizable problems ( interpolation regime ) , and to some bounded region for non-realizable problems . Combining with the divergence example of RMSprop , this indicates the existence of a phase transition from divergence to convergence dependent on β2 . Note that when we say “ convergence ” , in a weak sense it means the sequence converges to a bounded region for non-realizable case ; and in a strong sense it means the sequence converges to stationary points for realizable case . • To our best knowledge , we are the first to prove the convergence of RMSprop and some of Adam without any form of assumption about the boundedness of the gradient norm . This is important for showing the transition : with added assumptions on bounded gradients , the gradients can not diverge , while the counter-example shows that the gradient can . 2 PRELIMINARIES . We consider a finite-sum problem : min x∈Rd f ( x ) = n−1∑ j=0 fj ( x ) . ( 3 ) In neural network training , fj usually represents the loss contributed by the j-th sample batch . We present randomly shuffled Adam in Algorithm 1 . RMSProp is the special case of Adam with β1 = 0 . In this work , we mainly focus on RMSprop ; nevertheless , we will present a result for a special case of Adam with small β1 . Algorithm 1 Randomly Shuffled Adam Initialize m1 , −1 = 11−β1∇f ( x0 ) and v1 , −1 = 1 1−β2 maxj { ∇fj ( x0 ) ◦ ∇fj ( x0 ) } . for k = 1→∞ do Sample { τk,0 , τk,1 , · · · , τk , n−1 } as a random permutation of { 0 , 1 , 2 , · · · , n− 1 } for i = 0→ n− 1 do mk , i = β1mk , i−1 + ( 1− β1 ) ∇fτk , i vk , i = β2vk , i−1 + ( 1− β2 ) ∇fτk , i ◦ ∇fτk , i xk , i+1 = xk , i − ηk∗n√vk , i+ ◦ml , k , i end for Break if certain stopping criterion is satisfied . xk+1,0 = xk , n , vk+1 , −1 = vk , n−1 , mk+1 , −1 = mk , n−1 end for return x In Algorithm 1 , x denotes the optimization variable , m denotes the first order momentum and v denotes the second order momentum . Specifically , we denote xk , i , mk , i , vk , i ∈ Rd as the value of x , m , v at the k-th outer loop and i-th inner loop , respectively . We denote∇fj as the gradient of fj and let ◦ be the component-wise multiplication . The division of two vectors is component-wise as well . Moreover , we denote ηt as the step-size and β1 , β2 as the hyper-parameters in the algorithm . When n = 1 , we obtain full batch Adam . We replaced the bias correction step in ( Kingma & Ba , 2015 ) with a special initialization on m1 , −1 and v1 , −1 . This initialization can also correct the bias , but has cleaner results . Since the effect of initialization or bias correction becomes more and more negligible as the training progresses , RMSprop with zero initialization or our initialization will have the same asymptotic behavior . We put our results for the original version of RMSprop in the appendix . 1Rigorously speaking , for the best convergence rate , the momentum coefficient should also be problemdependent ; but just for achieving convergence , it can be problem independent . As for hyper-parameters , we choose ηt = η1√t and fix β2 to be a constant that is independent of the iteration count . We allow to be an arbitrary non-negative constant ; in particular , our result holds even for = 0 . The constant is added in practice for numerical stability , and is typically chosen to be 10−6 or even 10−8 . It is much smaller than√vk , i ( which is roughly the size of gradient norm ) . 2.1 RELATED WORK . As discussed earlier , one line of research focuses on variants of RMSprop and Adam that can be proved to converge . These works usually modify the update rule of vt. For instance , AMSGrad ( Reddi et al. , 2018 ) , AdaFom ( Chen et al. , 2019 ) explicitly make vt non-decreasing . Nostalgic Adam ( Huang et al. , 2019 ) and the algorithms analyzed in Zou et al . ( 2019 ) and Chen et al . ( 2019 ) use iteration-dependent β2t ( and/or β1t ) to let vt weigh more on past gradients . Some works add new modifications into RMSprop and Adam ; for instance , Zhou et al . ( 2019 ) mitigate the bias in update direction by using a different estimate of vt , Dozat ( 2016 ) combine Adam with Nesterov momentum , and Liu et al . ( 2020a ) employ a warm-up technique . Besides modifying the algorithm , a few attempts have been made to address the non-convergence issues of the original versions , but they often rely on extra assumptions . A number of works ( Zaheer et al. , 2018 ; De et al. , 2019 ; Défossez et al. , 2020 ) prove the convergence of Adam under these additional assumptions . One representative work along this line , Défossez et al . ( 2020 ) , establishes a clean convergence result and also provides some insights on the momentum mechanisms by improving the dependence of the iteration complexity on 1− β1 . However , these works assume to be relatively large compared to √vk , i . The issue is that such a choice essentially transforms RMSprop back to SGD since the effective step size is primarily controlled by , in lieu of √vk , i . This is in contrary to the spirit of RMSprop , which is to use adaptive step size to accelerate convergence . A few other works do not need the assumption of , but they have other assumptions . De et al . ( 2018 ) analyze deterministic and stochastic RMSprop , but they utilize a rather unrealistic assumption that the sign of all noisy gradients are the same , i.e. , sign ( ∇fp ( x ) ) = sign ( ∇fq ( x ) ) for all p , q. Chen et al . ( 2019 ) describe a few quantities based on the iterates , and prove that if they grow in a certain speed as the iterates go , the algorithm converges . The drawback is that the condition can not be checked a priori . Besides the assumptions mentioned above , all the aforementioned works require the gradient to be bounded . In general , removing boundedness assumptions ( of any kind , including bounded gradient , bounded iterates , etc . ) is not necessarily easy . Thus , such results are appreciated even for basic SGD . For instance , Bertsekas & Tsitsiklis ( 2000 ) presents a nice discussion of various results on inexact GD without involving conventional bounded assumptions , and claims “ bounded-assumption-free ” as one of the main contributions of their work . Very recently , we notice another work ( Liu et al. , 2020b ) which removes the bounded gradient assumption for SGDM ( SGD with momentum ) and obtains satisfactory rates . Nevertheless , we are not aware of an existing result on RMSprop that does not require bounded gradient assumption . We will explain later why removing this bounded gradient assumption is particularly important for our paper . 3 THE raison d ’ être FOR β2 Figure 1 clearly demonstrates the important role of β2 in the convergence of RMSprop . Specifically , a sufficiently large β2 is critical for RMSprop ’ s convergence . Indeed , some recent works ( Reddi et al. , 2018 ; Zhou et al. , 2019 ) have also made similar arguments , but they focus on understanding one part of the phenomenon , that is , small β2 leads to divergence . Our goal in this work is to complete the other part of the story by showing that , sufficiently large β2 guarantees convergence . The formal result will be provided in Sec . 4 . To understand the function of β2 , we first discuss why RMSprop diverges . It is known that the stochastic noise due to mini-batch will distort the gradient direction , leading to possible divergence , but in standard SGD , the distortion in multiple iterations is eliminated since the stochastic gradient is an unbiased estimate of the gradient . For RMSprop , at a given iteration the scaling constant 1/ √ v in the update direction may cause larger gradient distortion than the standard SGD . The distortion can be so significant that the average updating direction falls outside the dual cone of the true gradient . To illustrate this , consider the extreme case that β2 = 0 and = 0 ( i.e. , signSGD ) and the special example ( 1 ) . When applying signSGD to solve ( 1 ) , in each epoch which consists of C iterations , one iteration will move x left followed by C − 1 iterations that move x right . Since all step sizes are the same in one epoch , the accumulated effect of one epoch makes x move in the ascending direction , instead of the descending direction . Then why does large β2 help ? Intuitively , a large β2 can control the distortion on update directions . In the extreme case that β2 = 1 and = 0 , RMSprop reduces to SGD where the distortion of multiple iterations can be mitigated , leading to convergence . We suspect that β2 does not need to be exactly 1 , and a large β2 is enough to control the distortion . Our experiment in Figure 1 confirms that , at least for the counter-example of Reddi et al . ( 2018 ) , there is an interval β2 ∈ [ c , 1 ] such that RMSprop converges . What was initially not clear is whether the counter-example of Reddi et al . ( 2018 ) is a very special case or the convergence of large-β2-RMSprop holds for all problems . We found the real situation is somewhat more tricky . For non-realizable problems , we discovered an example for which RMSprop can not converge to the minimum for a wide range of β2 < 1 , but unlike the small-β2-case the iterates converge to a small ball around the minimum . This motivates us to distinguish three convergentsituations : divergence , convergence to a small region , convergence to critical points . What we can prove for the general problem is ( see Theorem 4.3 ) : for small β2 , RMSprop can diverge ; for large β2 , RMSprop must converge to a small region whose size depends on β2 . Then why do we observe the convergence to a single point in the experiment for ( 1 ) ? We suspect this is because the problem ( 1 ) is realizable , and conjecture that the property of “ convergence to critical points ” holds for all realizable problems . We indeed prove this conjecture ( see Corollary 4.1 ) : large-β2-RMSprop converges to critical points if the problem satisfies SGC . We summarize our findings about the convergence properties of RMSprop in Table 1 . Note that our results do not conflict with Theorem 3 in Reddi et al . ( 2018 ) which claims that “ for any constant β1 and β2 there exists a divergent example ” since here we choose β2 to be problemdependent , just like one chooses a step size < 2/L for GD where L is a problem dependent parameter . Another remark is that though β2 could be close to 1 , RMSprop still retains the ability to adapt v to gradient square norm as long as β2 < 1 , because new gradient signals are added for each iteration and the impact of previous signals decays exponentially . It is the adaptive ability that distinguishes RMSprop from SGD . Proving the theoretical advantage of RMSprop over SGD ( i.e. , choosing β2 < 1 is better than β2 = 1 ) is a very intriguing question ; in general , the theoretical advantage of adaptive gradient methods ( including RMSprop and AdaGrad ) over SGD is a long standing question . in this work , we focus on the fundamental problem of convergence , instead of the more challenging question of justifying the advantage of RMSprop .

Summary: This work revisits a famous counterexample on the convergence of Adam (originally presented in Reddi 2018). The authors show that, if the EMA parameter beta2 in RMSprop and Adam is chosen high enough, then both methods converge to a bounded region in the stochastic setting. In addition, the authors provide some results for the full-batch case. Crucially, and differently from many other papers on the topic, the gradients are not assumed to be bounded and the beta2 hyperparameter is not chosen to increase to 1.