An Exponential Learning Rate Schedule for Deep Learning
Zhiyuan Li, Sanjeev Arora
Introduction
Batch Normalization (BN) offers significant benefits in optimization and generalization across architectures, and has become ubiquitous. Usually best performance is attained by adding weight decay and momentum in addition to BN.
Usually weight decay is thought to improve generalization by controlling the norm of the parameters. However, it is fallacious to try to separately think of optimization and generalization because we are dealing with a nonconvex objective with multiple optima. Even slight changes to the training surely lead to a different trajectory in the loss landscape, potentially ending up at a different solution! One needs trajectory analysis to have a hope of reasoning about the effects of such changes.
In the presence of BN and other normalization schemes, including GroupNorm, LayerNorm, and InstanceNorm, the optimization objective is scale invariant to the parameters, which means rescaling parameters would not change the prediction, except the parameters that compute the output which do not have BN. However, Hoffer et al. (2018b) shows that fixing the output layer randomly doesn’t harm the performance of the network. So the trainable parameters satisfy scale invariance.(See more in Appendix C) The current paper introduces new modes of analysis for such settings. This rigorous analysis yields the surprising conclusion that the original learning rate (LR) schedule and weight decay(WD) can be folded into a new exponential schedule for learning rate: in each iteration multiplying it by for some that depends upon the momentum and weight decay rate.
The above theorem requires that the product of learning rate and weight decay factor, , is small than , which is almost always satisfied in practice. The rigorous and most general version of above theorem is Theorem 2.12, which deals with multi-phase LR schedule, momentum and weight decay.
There are other recently discovered exotic LR schedules, e.g. Triangular LR schedule(Smith, 2017) and Cosine LR schedule(Loshchilov & Hutter, 2016), and our exponential LR schedule is an extreme example of LR schedules that become possible in presence of BN. Such an exponential increase in learning rate seems absurd at first sight and to the best of our knowledge, no deep learning success has been reported using such an idea before. It does highlight the above-mentioned viewpoint that in deep learning, optimization and regularization are not easily separated. Of course, the exponent trumps the effect of initial lr very fast (See Figure 3), which explains why training with BN and WD is not sensitive to the scale of initialization, since with BN, tuning the scale of initialization is equivalent to tuning the initial LR while fixing the product of LR and WD, (See Lemma 2.7).
Note that it is customary in BN to switch to a lower LR upon reaching a plateau in the validation loss. According to the analysis in the above theorem, this corresponds to an exponential growth with a smaller exponent, except for a transient effect when a correction term is needed for the two processes to be equivalent (see discussion around Theorem 2.12).
Thus the final training algorithm is roughly as follows: Start from a convenient LR like , and grow it at an exponential rate with a suitable exponent. When validation loss plateaus, switch to an exponential growth of LR with a lower exponent. Repeat the procedure until the training loss saturates.
In Section 3, we demonstrate on a toy example how weight decay and normalization are inseparably involved in the optimization process. With either weight decay or normalization alone, SGD will achieve zero training error. But with both turned on, SGD fails to converge to global minimum.
In Section 5, we experimentally verify our theoretical findings on CNNs and ResNets. We also construct better exponential LR schedules by incorporating the Cosine LR schedule on CIFAR10, which opens the possibility of even more general theory of rate schedule tuning towards better performance.
There have been other theoretical analyses of training models with scale-invariance. (Cho & Lee, 2017) proposed to run Riemanian gradient descent on Grassmann manifold since the weight matrix is scaling invariant to the loss function. observed that the effective stepsize is proportional to . (Arora et al., 2019) show the gradient is always perpendicular to the current parameter vector which has the effect that norm of each scale invariant parameter group increases monotonically, which has an auto-tuning effect. (Wu et al., 2018) proposes a new adaptive learning rate schedule motivated by scale-invariance property of Weight Normalization.
Previous work for understanding Batch Normalization. (Santurkar et al., 2018) suggested that the success of BNhas does not derive from reduction in Internal Covariate Shift, but by making landscape smoother. (Kohler et al., 2018) essentially shows linear model with BN could achieve exponential convergence rate assuming gaussian inputs, but their analysis is for a variant of GD with an inner optimization loop rather than GD itself. (Bjorck et al., 2018) observe that the higher learning rates enabled by BN empirically improves generalization. (Arora et al., 2019) prove that with certain mild assumption, (S)GD with BN finds approximate first order stationary point with any fixed learning rate. None of the above analyses incorporated weight decay, but (Zhang et al., 2019; Hoffer et al., 2018a; van Laarhoven, 2017; Page, ; Wu, ) argued qualitatively that weight decay makes parameters have smaller norms, and thus the effective learning rate, is larger. They described experiments showing this effect but didn’t have a closed form theoretical analysis like ours. None of the above analyses deals with momentum rigorously.
2 Preliminaries and Notations
For batch , network parameter , we denote the network by and the loss function at iteration by . When there’s no ambiguity, we also use for convenience.
Implementations of SGD with Momentum/Nesterov comes with subtle variations in literature. We adopt the variant from Sutskever et al. (2013), also the default in PyTorch (Paszke et al., 2017). regularization (a.k.a. Weight Decay) is another common trick used in deep learning. Combining them together, we get the one of the mostly used optimization algorithms below.
[SGD with Momentum and Weight Decay] At iteration , with randomly sampled batch , update the parameters and momentum as following:
where is the learning rate at epoch , is the momentum coefficient, and is the factor of weight decay. Usually, is initialized to be .
For ease of analysis, we will use the following equivalent of Definition 1.2.
where and must be chosen in a way such that is satisfied, e.g. when , and could be arbitrary.
A key source of intuition is the following simple lemma about scale-invariant networks Arora et al. (2019). The first property ensures GD (with momentum) always increases the norm of the weight.(See Lemma B.1 in Appendix B) and the second property says that the gradients are smaller for parameteres with larger norm, thus stabilizing the trajectory from diverging to infinity.
Deriving Exponential Learning Rate Schedule
As a warm-up in Section 2.1 we show that if momentum is turned off then Fixed LR + Fixed WD can be translated to an equivalent Exponential LR. In Section 2.2 we give a more general analysis on the equivalence between Fixed LR + Fixed WD + Fixed Momentum Factor and Exponential LR + Fixed Momentum Factor. While interesting, this still does completely apply to real-life deep learning where reaching full accuracy usually requires multiple phases in training where LR is fixed within a phase and reduced by some factor from one phase to the next. Section 2.3 shows how to interpret such a multi-phase LR schedule + WD + Momentum as a certain multi-phase exponential LR schedule with Momentum.
We use notation of Section 1.2 and assume LR is fixed over iterations, i.e. , and (momentum factor) is set as . We also use to denote WD factor and to denote the initial parameters.
The intuition should be clear from Lemma 1.3, which says that shrinking parameter weights by factor (where ) amounts to making the gradient times larger without changing its direction. Thus in order to restore the ratio between original parameter and its update (LRGradient), the easiest way would be scaling LR by . This suggests that scaling the parameter by at each step is equivalent to scaling the LR by .
To prove this formally we use the following formalism. We’ll refer to the vector the state of a training algorithm and study how this evolves under various combinations of parameter changes. We will think of each step in training as a mapping from one state to another. Since mappings can be composed, any finite number of steps also correspond to a mapping. The following are some basic mappings used in the proof.
Run GD with WD for a step: ;
Scale the parameter : ;
Scale the LR : .
For example, when , is vanilla GD update without WD, also abbreviated as . When , is GD update with WD and LR . Here is the loss function at iteration , which is decided by the batch of the training samples in th iteration. Below is the main result of this subsection, showing our claim that GD + WD GD+ Exp LR (when Momentum is zero). It will be proved after a series of lemmas.
For every and positive integer following holds:
With WD being , is set as and thus the scaling factor of LR per iteration is , except for the first iteration it’s .
We first show how to write GD update with WD as a composition of above defined basic maps.
.
Below we will define the proper notion of equivalence such that (1). , which implies ; (2) the equivalence is preserved under future GD updates.
We first extend the equivalence between weights (same direction) to that between states, with additional requirement that the ratio between the size of GD update and that of parameter are the same among all equivalent states, which yields the notion of Equivalent Scaling.
is equivalent to iff , , which is also denoted by (\widetilde{{\bm{\theta}}},\widetilde{\eta})\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}({\bm{\theta}},\eta). is called Equivalent Scaling for all .
The following lemma shows that equivalent scaling commutes with GD update with WD, implying that equivalence is preserved under GD update (Lemma 2.4). This anchors the notion of equivalence — we could insert equivalent scaling anywhere in a sequence of basic maps(GD update, LR/parameter scaling), without changing the final network.
For any constant and , . In other words, ({\bm{\theta}},\eta)\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}({\bm{\theta}}^{\prime},\eta^{\prime})\Longrightarrow\textrm{GD}^{\rho}_{t}({\bm{\theta}},\eta)\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}\textrm{GD}^{\rho}_{t}({\bm{\theta}}^{\prime},\eta^{\prime}).
Now we formally define equivalence relationship between maps using equivalent scalings.
Two maps are equivalent iff , , which is also denoted by F\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}G.
By Lemma 2.2,, \textrm{GD}^{\rho}_{t}\mathrel{\overset{\rho}{\scalebox{1.5}[1.0]{\sim}}}\Pi_{2}^{\rho^{-1}}\circ\textrm{GD}_{t}\circ\Pi_{2}^{\rho^{-1}}. By Lemma 2.4, GD update preserves map equivalence, i.e. F\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}G\Rightarrow\textrm{GD}_{t}^{\rho}\circ F\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}\textrm{GD}_{t}^{\rho}\circ G,\forall c,\rho>0. Thus,
2 Replacing WD by Exponential LR: Case of constant LR with momentum
In this subsection the setting is the same to that in Subsection 2.1 except that the momentum factor is instead of 0. Suppose the initial momentum is , we set . Presence of momentum requires representing the state of the algorithm with four coordinates, , which stand respectively for the current parameters/LR and the buffered parameters/LR (from last iteration) respectively. Similarly, we define the following basic maps and equivalence relationships.
Run GD with WD for a step: ;
Scale Current parameter ;
Scale Current LR : ;
Scale Buffered parameter : ;
Scale Buffered parameter : .
is equivalent to iff , which is also denoted by ({\bm{\theta}},\eta,{\bm{\theta}}^{\prime},\eta^{\prime})\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}(\widetilde{{\bm{\theta}}},\widetilde{\eta},\widetilde{{\bm{\theta}}}^{\prime},\widetilde{\eta}^{\prime}). We call Equivalent Scalings for all .
Again by expanding the definition, we show equivalent scalings commute with GD update.
and , .
Similarly, we can rewrite as a composition of vanilla GD update and other scalings by expanding the definition, when the current and buffered LR are the same in the input of .
For any input , if is a root of , then . In other words,
Though looking complicated, the RHS of Equation 4 is actually the desired conjugated with some scaling on momentum part , and in the current update cancels with the in the next update. Now we are ready to show the equivalence between WD and Exp LR schedule when momentum is turned on for both.
where is a positive root of equation , which is always smaller than 1(See Appendix A.1). When , is the unique non-zero solution.
Above we implicitly assume that such that the roots are real and this is always true in practice. For instance of standard hyper-parameters where , .
Note that , it suffices to show that
which follows immediately from Lemma 2.7 and Lemma 2.8 by induction. ∎
3 Replacing WD by Exponential LR: Case of multiple LR phases
Usual practice in deep learning shows that reaching full training accuracy requires reducing the learning rate a few times.
Step Decay is the (standard) learning rate schedule, where training has phases , where phase starts at iteration (), and all iterations in phase use a fixed learning rate of .
The algorithm state in Section 2.2, consists of 4 components including buffered and current LR. When LR changes, the buffered and current LR are not equal, and thus Lemma 2.8 cannot be applied any more. In this section we show how to fix this issue by adding extra momentum correction. In detail, we show the below defined Exp LR schedule leads the same trajectory of networks in function space, with one-time momentum correction at the start of each phase. We empirically find on CIFAR10 that ignoring the correction term does not change performance much.
There exists a way to correct the momentum only at the first iteration of each phase, such that the following Tapered-Exponential LR schedule (TEXP) with momentum factor and no WD, leads the same sequence networks in function space as that of Step Decay LR schedule(Definition 2.11) with momentum factor and WD .
where , .
The analysis in previous subsection give the equivalence within each phase, where the same LR is used throughout the phase. To deal with the difference between buffered LR and current LR when entering new phases, the idea is to pretend and becomes whatever it needs to maintain such that we can again apply Lemma 2.8, which requires the current LR of the input state is equal to its buffered LR. Because scaling in RHS of Equation 4 is different in different phases, so unlike what happens within each phase, they don’t cancel with each other at phase transitions, thus remaining as a correction of the momentum. The proofs are delayed to Appendix A, where we proves a more general statement allowing phase-dependent WD, .
Alternative interpretation of Step Decay to exponential LR schedule:Below we present a new LR schedule, TEXP++, which is exactly equivalent to Step Decay without the need of one-time correction of momentum when entering each phase. We further show in Appendix A.1 that when translating from Step Decay, the TEXP++ we get is very close to the original TEXP(Equation 8), i.e. the ratio between the LR growth per round, converges to 1 exponentially each phase. For example, with WD 0.0005, max LR 0.1, momentum factor 0.9, the ratio is within , meaning TEXP and TEXP++ are very close for Step Decay with standard hyperparameters.
, for ;
, for ,
where , , and recursively defined as
The LR schedule is called Tapered Exponential ++, or TEXP++.
Example illustrating interplay of WD and BN
The paper so far has shown that effects of different hyperparameters in training are not easily separated, since their combined effect on the trajectory is complicated. We give a simple example to illustrate this, where convergence is guaranteed if we use either BatchNorm or weight decay in isolation, but convergence fails if both are used. (Momentum is turned off for clarity of presentation)
Case 1: WD alone: Since both the above objective with L2 regularization is strongly convex and smooth in , vanilla GD with suitably small learning rate could get arbitrarily close to the global minimum for this regularized objective. In our case, large batch SGD behaves similarly to GD and can achieve test error following the standard analysis of convex optimization.
Case 2: BN alone: Add a BN layer after the linear layer, and fix scalar and bias term to 1 and 0. The objective becomes
Case 3: Both BN and WD: When BN and WD are used together, no matter how small the noise is, which comes from the large batch size, the following theorem shows that SGD will not converge to any solution with error smaller than , which is independent of the batch size (noise level).
[Nonconvergence] Starting from iteration any , with probability over the randomness of samples, the training error will be larger than at least once for the following consecutive iterations.
(See full proof in Appendix A.) The high level idea of this proof is that if the test error is low, the weight is restricted in a small cone around the global minimum, and thus the amount of the gradient update is bounded by the size of the cone. In this case, the growth of the norm of the weight by Pythagorean Theorem is not large enough to cancel the shrinkage brought by weight decay. As a result, the norm of the weight converges to 0 geometrically. Again we need to use the lower bound for size of the gradient, that holds with constant probability. Thus the size of the gradient will grow along with the shrinkage of until they’re comparable, forcing the weight to leave the cone in next iteration. ∎
Viewing EXP LR via Canonical Optimization Framework
This section tries to explain why the efficacy of exponential LR in deep learning is mysterious to us, at least as viewed in the canonical framework of optimization theory.
Canonical framework for analysing 1st order methods This focuses on proving that each —or most—steps of GD noticeably reduce the objective, by relying on some assumption about the spectrum norm of the hessian of the loss, and most frequently, the smoothness, denoted by . Specifically, for GD update , we have
When , the first order term is larger than the second order one, guaranteeing the loss value decreases. Since the analysis framework treats the loss as a black box (apart from the assumed bounds on the derivative norms), and the loss is non-convex, the best one can hope for is to prove speedy convergence to a stationary point (where gradient is close to ). An increasing body of work proves such results.
Now we turn to difficulties in understanding the exponential LR in context of the above framework and with scale-invariance in the network.
Since loss is same for and for all a simple calculation shows that along any straight line through the origin, smoothness is a decreasing function of , and is very high close to origin. (Note: it is also possible to one can show the following related fact: In any ball containing the origin, the loss is nonconvex.)
Thus if one were trying to apply the canonical framework to argue convergence to a stationary point, the natural idea would be to try to grow the norm of the parameters until smoothness drops enough that the above-mentioned Canonical Framework starts to apply. Arora et al. (2019) showed this happens in GD with fixed LR (WD turned off), and furthermore the resulting convergence rate to stationary point is asymptotically similar to analyses of nonconvex optimization with learning rate set as in the Canonical framework. Santurkar et al. (2018) observed similar phenomenon in experiments, which they described as a smoothening of the objective due to BN.
The Canonical Framework can be thought of as a discretization of continuous gradient descent (i.e., gradient flow): in principle it is possible to use arbitrarily small learning rate, but one uses finite learning rate merely to keep the number of iterations small. The discrete process approximates the continuous process due to smoothness being small.
In case of gradient flow with weight decay (equivalently, with exponential LR schedule) the discrete process cannot track the continuous process for very long, which suggests that any explanation of the benefits of exponential LR may need to rely on discrete process being somehow better. The reason being that for gradient flow one can decouple the speed of the into the tangential and the radial components, where the former one has no effect on the norm and the latter one has no effect on the objective but scales the tangential gradient exponentially. Thus the Gradient Flow with WD gives exactly the same trajectory as vanilla Gradient Flow does, excepting a exponential reparametrization with respect to time .
It can be shown that if the local smoothness is upperbounded by (as stipulated in Canonical Framework) during a sequence () of GD updates with WD and constant LR then such sequence satisfies . This contrasts with the usual experimental observation that stays bounded away from . One should thus conclude that in practice, with constant LR and WD, smoothness doesn’t always stay small (unlike the above analyses where WD is turned off).
Experiments
The translation to exponential LR schedule is exact except for one-time momentum correction term entering new phases. The experiments explore the effect of this correction term. The Tapered Exponential(TEXP) LR schedule contains two parts when entering a new phase I: an instant LR decay () and an adjustment of the growth factor (). The first part is relative small compared to the huge exponential growing. Thus a natural question arises: Can we simplify TEXP LR schedule by dropping the part of instant LR decay?
Also, previously we have only verified our equivalence theorem in Step Decay LR schedules. But it’s not sure how would the Exponential LR schedule behave on more rapid time-varying LR schedules such as Cosine LR schedule.
Settings: We train PreResNet32 on CIFAR10. The initial learning rate is 0.1 and the momentum is 0.9 in all settings. We fix all the scalar and bias of BN, because otherwise they together with the following conv layer grow exponentially, sometimes exceeding the range of Float32 when trained with large growth rate for a long time. We fix the parameters in the last fully connected layer for scale invariance of the objective.
We tried the following LR schedule (we call it TEXP–). Interestingly, up to correction of momentum when entering a new phase, this schedule is equivalent to a constant LR schedule, but with the weight decay coefficient reduced correspondingly at the start of each phase. (See Theorem A.2 and Figure 5)
where , .
2 Better Exponential LR Schedule with Cosine LR
We applied the TEXP LR schedule (Theorem 2.12) on the Cosine LR schedule (Loshchilov & Hutter, 2016), where the learning rate changes every epoch, and thus correction terms cannot be ignored. The LR at epoch is defined as: . Our experiments show this hybrid schedule with Cosine LR performs better on CIFAR10 than Step Decay, but this finding needs to be verified on other datasets.
Conclusions
The paper shows rigorously how BN allows a host of very exotic learning rate schedules in deep learning, and verifies these effects in experiments. The lr increases exponentially in almost every iteration during training. The exponential increase derives from use of weight decay, but the precise expression involves momentum as well. We suggest that the efficacy of this rule may be hard to explain with canonical frameworks in optimization.
Our analyses of BN is a substantial improvement over earlier theoretical analyses, since it accounts for weight decay and momentum, which are always combined in practice.
Our tantalising experiments with a hybrid of exponential and cosine rates suggest that more surprises may lie out there. Our theoretical analysis of interrelatedness of hyperparameters could also lead to faster hyperparameter search.
References
Appendix A Omitted Proofs
Suppose are the two real roots of the the following equation, we have
are real ;
;
Let , we have .
if we view as functions of , then is monotone decreasing, is monotone increasing.
Let , we have . Note the minimum of is taken at , the both roots of must lie between and , if exists.
Note that is monotone decreasing, since is constant, , must be decreasing and must be increasing.
A.2 Omitted proofs in Section 2.1
A.3 Omitted proofs in Section 2.2
For any input , it’s easy to check both composed maps have the same outputs on the 2,3,4th coordinates, namely . For the first coordinate, we have
For any input , it’s easy to check both composed maps have the same outputs on the 2,3,4th coordinates, namely . For the first coordinate, we have
A.4 Omitted proofs of Theorem 2.12
In this subsection we will prove a stronger version of Theorem 2.12(restated below), allowing the WD, changing each phase.
There exists a way to correct the momentum only at the first iteration of each phase, such that the following Tapered-Exponential LR schedule (TEXP) with momentum factor and no WD, leads the same sequence networks in function space compared to that of Step Decay LR schedule(Definition 2.11) with momentum factor and phase-dependent WD in phase , where phase lasts from iteration to iteration , .
where , .
Towards proving Theorem 2.12, we need the following lemma which holds by expanding the definition, and we omit its proof.
We define the Canonicalization map as , and it holds that
, .
, .
Similar to the case of momentum-free SGD, we define the notion of equivalent map below
For two maps and , we say is equivalent to iff , , which is also denoted by F\mathrel{\overset{c}{\scalebox{1.5}[1.0]{\sim}}}G.
Note that for any , . Thus as a direct consequence of Lemma 2.8, the following lemma holds.
, \textrm{GD}^{\rho}_{t}\circ N\mathrel{\overset{\alpha}{\scalebox{1.5}[1.0]{\sim}}}\Pi_{3}^{\alpha^{-1}}\circ\Pi_{4}^{\alpha^{-1}}\circ\Pi_{2}^{\alpha^{-1}}\circ\textrm{GD}_{t}\circ\Pi_{2}^{\alpha^{-1}}\circ\Pi_{3}^{\alpha}\circ\Pi_{4}^{\alpha}\circ N.
Starting with initial state where and a given LR schedule , the parameters generated by GD with WD and momentum satisfies the following relationship:
Define , for . By Lemma A.3 and Lemma A.5, letting be the root of , we have
where \mathrel{\overset{\prod\limits_{i=0}^{T-1}\alpha_{i}}{\scalebox{2.5}[1.0]{\sim}}} is because of Lemma A.5, and is defined as
Since the canonicalization map only changes the momentum part of the state, it’s easy to check that doesn’t touch the current parameter and the current LR . Thus only changes the momentum part of the input state. Now we claim that whenever . This is because when , , thus . In detail,
where is because GD update sets the same as , and thus ensures the input of has the same momentum factor in buffer as its current momentum factor, which makes an identity map.
Thus we could rewrite Equation 9 with a “sloppy”version of , H^{\prime}_{t}=\begin{cases}H_{t}&\mbox{\eta_{t}\neq\eta_{t-1};}\\ Id&\mbox{o.w.}\end{cases}:
Now we construct the desired sequence of parameters achieved by using the Tapered Exp LR schedule 8 and the additional one-time momentum correction per phase. Let , and
we claim is the desired sequence of parameters. We’ve already shown that {\bm{\theta}}_{t}\mathrel{\overset{}{\scalebox{1.5}[1.0]{\sim}}}\widetilde{{\bm{\theta}}}_{t},\ \forall t. Clearly is generated using only vanilla GD, scaling LR and modifying the momentum part of the state. When for any , and thus . Thus the modification on the momentum could only happen at . Also it’s easy to check that , if . ∎
A.5 Omitted proofs of Theorem 2.13
, for ;
, for ,
where , , and recursively defined as
needs to be always positive. Here are free parameters. Different choice of would lead to different trajectory for , but the equality that is always satisfied. If the initial condition is given via , then it’s also free to choose , as long as .
We will prove by induction. By assumption for . Now we will show that .
To conclude that , it suffices to show that the coefficients before is the same to that in . In other words, we need to show
which is equivalent to the definition of , Equation 11.
Let . Define is the larger root of the equation . To guarantee the existence of we also assume . Then we have
We will prove the above theorem with a strengthened induction —
First, since ,
which shows . Here the last step is by definition of .
Because of , we have
Now we are ready to give the formal statement about the closeness of Equation 8 and the reduced LR schedule by Theorem 2.13.
Given a Step Decay LR schedule with , the TEXP++ LR schedule in Theorem 2.13 is the following(, ):
where is the larger root of . In Appendix A, we show that . When is small compared to , which is usually the case in practice, one could approximate by 1. For example, when , , , the above upper bound becomes
Assuming and () are the roots of Equation 1 with and , we have , by Lemma A.1.
We can rewrite the recursion in Theorem 2.13 as the following:
By Lemma A.7, we have , . Thus , which means geometrically converges to its stable fixed point . and . Since that , , we have , and thus , .
Note that , By definition of TEXP and TEXP++, we have
When , we have
Thus we conclude , we have
A.6 Omitted Proofs in Section 3
We will use to denote and to . Note that training error is equivalent to .
Since the objective is strongly convex, it has unique argmin . By symmetry, , for some . By KKT condition, we have
which implies .
Case 3: Both BN and WD
We will need the following lemma when lower bounding the norm of the stochastic gradient.
Suppose , then
This Chernoff-bound based proof is a special case of Dasgupta & Gupta (2003).
Setting for Theorem A.6:
Suppose WD factor is , LR is , the width of the last layer is , Now the SGD updates have the form
where , and .
Step 1: Let , and . Thus if we assume the training error is smaller than from iteration to , then by spherical triangle inequality, , for .
Now let’s define and for any vector , and we have the following two relationships:
.
.
The second property is because by Lemma 1.3, and by assumption of small error, .
In other word, . Since is monotone decreasing, holds for any .
Step 2: We show that the norm of the stochastic gradient is lower bounded with constant probability. In other words, we want to show the norm of is lower bounded with high probability.
Let be the projection matrix for the orthogonal space spanned by and . W.L.O.G, we can assume the rank of is 2. In case , we just exclude a random direction to make rank 2. Now we have are still i.i.d. multivariate gaussian random variables, for , and moreover, is independent to . When , we can lower bound by dealing with .
It’s not hard to show that conditioned on ,
where . We further note that . By Lemma A.9,
Now we will give a high probability lower bound for . Note that , we have
which implies the following, where is defined as :
Thus w.p. at least , equation 24 and equation 21 happen together, which implies
Step 3. To stay in the cone , the SGD update has to be smaller than for any . However, step 1 and 2 together show that w.p. per iteration. Thus the probability that always stays in the cone for every is less than . ∎
It’s interesting that the only property of the global minimum we use is that the if both , are optimal, then the angle between and is at most . Thus we indeed have proved a stronger statement: At least once in every iterations, the angle between and will be larger than . In other words, if the the amount of the update stabilizes to some direction in terms of angle, then the fluctuation in terms of angle must be larger than for this simple model, no matter how small the noise is.
A.7 Omitted Proofs in Section 4
Suppose loss is scale invariant, then is non-convex in the following two sense:
The domain is non-convex: scale invariant loss can’t be defined at origin;
There exists no ball containing origin such that the loss is locally convex, unless the loss is constant function.
Suppose . W.L.O.G, we assume . By convexity, every line segment passing must have constant loss, which implies the loss is constant over set . Applying the above argument on any other maximum point implies the loss is constant over . ∎
Suppose the momentum factor , LR is constant, and the loss function is lower bounded. If and such that , , then .
By Lemma 1.3 and the update rule of GD with WD, we have
Note that by assumption we have .
As a conclusion, we have , which implies . ∎
Appendix B Other Results
Now we rigorously analyze norm growth in this algorithm. This greatly extends previous analyses of effect of normalization schemes (Wu et al., 2018; Arora et al., 2018) for vanilla SGD.
Under the update rule 1.2 with , the norm of scale invariant parameter satisfies the following property:
Almost Monotone Increasing: .
Assuming is a constant, then
Let’s use to denote respectively.
The only property we will use about loss is .
Expanding the square of , we have
Simplify , we have
Further if is a constant, we have
which covers the result without momentum in (Arora et al., 2019) as a special case:
For general deep nets, we have the following result, suggesting that the mean square of the update are constant compared to the mean square of the norm. The constant is mainly determined by , explaining why the usage of weight decay prevents the parameters to converge in direction. (Page, ) had a similar argument for this phenomenon by connecting this to the LARS(You et al., 2017), though it’s not rigorous in the way it deals with momentum and equilibrium of norm.
For SGD with constant LR , weight decay and momentum , when the limits , exist, we have
Take average of Equation 26 over , when the limits , exists, we have
Appendix C Scale Invariance in Modern Network Architectures
In this section, we will discuss how Normalization layers make the output of the network scale-invariant to its parameters. Viewing a neural network as a DAG, we give a sufficient condition for the scale invariance which could be checked easily by topological order, and apply this on several standard network architectures such as Fully Connected(FC) Networks, Plain CNN, ResNet(He et al., 2016a), and PreResNet(He et al., 2016b). For simplicity, we restrict our discussions among networks with ReLU activation only. Throughout this section, we assume the linear layers and the bias after last normalization layer are fixed to its random initialization, which doesn’t harm the performance of the network empirically(Hoffer et al., 2018b).
Suppose is an integer and is all the parameters of the network, then is said to be homogeneous of degree , or -homogeneous, if , . The output of can be multi-dimensional. Specifically, scale invariance means degree of homogeneity is 0.
Suppose the network only contains following modules, and we list the degree of homogeneity of these basic modules, given the degree of homogeneity of its input.
Linear Layer, e.g. Convolutional Layer or Fully Connected Layer
Bias Layer(Adding Trainable Bias to the output of the previous layer)
Addition Layer (adding the outputs of two layers with the same dimension Addition Layer(+) is mainly used in ResNet and other similar architectures. In this section, we also use it as an alternative definition of Bias Layer(B). See Figure 7.)
Normalization Layer without affine transformation(including BN, GN, LN, IN etc.)
Normalization Layer with affine transformation
For the purpose of deciding the degree of homogeneity of a network, there’s no difference among convolutional layers, fully connected layer and the diagonal linear layer in the affine transformation of Normalization layer, since they’re all linear and the degree of homogeneity is increased by 1 after applying them.
On the other hand, BN and IN has some benefit which GN and LN doesn’t have, namely the bias term (per channel) immediately before BN or IN has zero effect on the network output and thus can be removed. (See Figure 15)
We also demonstrate the homogeneity of the output of the modules via the following figures, which will be reused to later to define network architectures.
For a network only consisting of modules defined above and ReLU activation, we can view it as a Directed acyclic graph and check its scale invariance by the following algorithm.
C.2 Networks without Affine Transformation and Bias
We start with the simple cases where all bias term(including that of linear layer and normalization layer) and the scaling term of normalization layer are fixed to be 0 and 1 element-wise respectively, which means the bias and the scaling could be dropped from the network structure. We empirically find this doesn’t affect the performance of network in a noticeable way. We will discuss the full case in the next subsection.
ResNet:
See Figure 10. To ensure the scaling invariance, we add an additional normalizaiton layer in the shortcut after downsampling. This implementation is sometimes used in practice and doesn’t affect the performance in a noticeable way.
Preactivation ResNet:
See Figure 11. Preactivation means to change the order between convolutional layer and normalization layer. For similar reason, we add an additional normalizaiton layer in the shortcut before downsampling.
C.3 Networks with Affine Transformation
Now we discuss the full case where the affine transformation part of normalization layer is trainable. Due to the reason that the bias of linear layer (before BN) has 0 gradient as we mentioned in C.2, the bias term is usually dropped from network architecture in practice to save memory and accelerate training( even with other normalization methods)(See PyTorch Implementation (Paszke et al., 2017)). However, when LN or GN is used, and the bias term of linear layer is trainable, the network could be scale variant (See Figure 15).
ResNet:
See Figure 13. To ensure the scaling invariance, we add an additional normalizaiton layer in the shortcut after downsampling. This implementation is sometimes used in practice and doesn’t affect the performance in a noticeable way.
Preactivation ResNet:
See Figure 14. Preactivation means to change the order between convolutional layer and normalization layer. For similar reason, we add an additional normalizaiton layer in the shortcut before downsampling.