On the relation between the sharpest directions of DNN loss and the SGD step length
Abstract
Stochastic Gradient Descent (SGD) based training of neural networks with a large learning rate or a small batch-size typically ends in well-generalizing, ﬂat regions of the weight space, as indicated by small eigenvalues of the
Hessian of the training loss.
However, the curvature along the SGD trajectory is poorly understood.
An empirical investigation shows that initially SGD visits increasingly sharp regions, reaching a maximum sharpness determined by both the learning rate and the batch-size of SGD.
When studying the
SGD dynamics in relation to the sharpest directions in this initial phase, we ﬁnd that the SGD step is large compared to the curvature and commonly fails to minimize the loss along the sharpest directions.
Furthermore, using a reduced learning rate along these directions can improve training speed while leading to both sharper and better generalizing solutions compared to vanilla SGD.
In summary, our analysis of the dynamics of SGD in the subspace of the sharpest directions shows that they inﬂuence the regions that SGD steers to (where larger learning rate or smaller batch size result in wider regions visited), the overall training speed, and the generalization ability of the ﬁnal model.
Introduction
Deep Neural Networks (DNNs) are often massively over-parameterized (Zhang et al., 2016), yet show state-of-the-art generalization performance on a wide variety of tasks when trained with Stochastic Gradient Descent (SGD).
While understanding the generalization capability of DNNs remains an open challenge, it has been hypothesized that SGD acts as an implicit regularizer, limiting the complexity of the found solution (Poggio et al., 2017; Advani and
Saxe, 2017; Wilson et al., 2017; Jastrzębski et al., 2017).
Various links between the curvature of the ﬁnal minima reached by SGD and generalization have been studied (Murata et al., 1994; Neyshabur et al., 2017).
In particular, it is a popular view that models corresponding to wide minima of the loss in the parameter space generalize better than those corresponding to sharp minima (Hochreiter and Schmidhuber, 1997; Keskar et al., 2016; Jastrzębski et al., 2017; Wang et al., 2018).
The existence of this empirical correlation between the curvature of the ﬁnal minima and generalization motivates our study.
Our work aims at understanding the interaction between SGD and the sharpest directions of the loss surface, i.e. those corresponding to the largest eigenvalues of the Hessian.
In contrast to studies such as those by Keskar et al. (2016) and Jastrzębski et al.
our analysis focuses on the whole training trajectory of SGD rather than just on the endpoint.
We will show in Sec.
3.1 that the evolution of the largest eigenvalues of the Hessian follows a [Figure] consistent pattern for the diﬀerent networks and datasets that we explore.
Initially, SGD is in a region of broad curvature, and as the loss decreases, SGD visits regions in which the top eigenvalues of the Hessian are increasingly large, reaching a peak value with a magnitude inﬂuenced by both learning rate and batch size.
After that point in training, we typically observe a decrease or stabilization of the largest eigenvalues.
To further understand this phenomenon, we study the dynamics of SGD in relation to the sharpest directions in Sec. 3.2 and Sec. 3.3.
Projecting to the sharpest directions 1 , we see that the regions visited in the beginning resemble bowls with curvatures such that an SGD step is typically too large, in the sense that an SGD step cannot get near the minimum of this bowl-like subspace; rather it steps from one side of the bowl to the other, see Fig.
1 for an illustration.
Finally in Sec.
4 we study further practical consequences of our observations and investigate an SGD variant which uses a reduced and ﬁxed learning rate along the sharpest directions.
In most cases we ﬁnd this variant optimizes faster and leads to a sharper region, which generalizes the same or better compared to vanilla SGD with the same (small) learning rate.
While we are not proposing a practical optimizer, these results may open a new avenue for constructing eﬀective optimizers tailored to the DNNs’ loss surface in the future.
On the whole this paper exposes and analyses SGD dynamics in the subspace of the sharpest directions.
In particular, we argue that the SGD dynamics along the sharpest directions inﬂuence the regions that SGD steers to (where larger learning rate or smaller batch size result in wider regions visited), the training speed, and the ﬁnal generalization capability.
Experimental setup and notation
We perform experiments mainly on Resnet-32 2 and a simple convolutional neural network, which we refer to as SimpleCNN (details in the Appendix D), and the CIFARdataset (Krizhevsky et al.).
SimpleCNN is a 4 layer CNN, achieving roughly 86% test accuracy on the CIFAR-10 dataset.
For training both of the models we use standard data augmentation on CIFAR-10 and for Resnet-32 L2 regularization with coeﬃcient 0 .
We additionally investigate the training of VGG-11 (Simonyan and Zisserman, 2014) on the
CIFAR-10 dataset (we adapted the ﬁnal classiﬁcation layers for 10 classes) and of a bidirectional Long Short Term Memory (LSTM) model (following the “small” architecture employed by Zaremba et al.
(2014), with added dropout regularization of 0 . 1 ) on the Penn Tree Bank [Figure] (PTB) dataset.
All models are trained using SGD, without using momentum, if not stated otherwise.
The notation and terminology we use in this paper are now described.
We will use t (time) to refer to epoch or iteration, depending on the context.
By η and S we denote the SGD learning rate and batch size, respectively.
H is the Hessian of the empirical loss at the current D -dimensional parameter value evaluated on the training set, and its eigenvalues are denoted as λ i , i = 1 . . .
D (ordered by decreasing absolute magnitudes).
λ max = λ 1 is the maximum eigenvalue, which is equivalent to the spectral norm of H .
The top K eigenvectors of H are denoted by e i , for i ∈ { 1 , . .
. , K } , and referred to in short as the sharpest directions .
We will refer to the mini-batch gradient calculated based on a batch of size S as g ( S ) ( t ) and to η g ( S ) ( t ) as the SGD step .
We will often consider the projection of this gradient onto one of the top eigenvectors, given by ˜
g
i ( t ) =
˜ g
i ( t ) e i ( t ) , where
˜ g
i ( t ) ≡ (cid:104) g ( S ) ( t ) , e i ( t ) (cid:105) .
Computing the full spectrum of the Hessian H for reasonably large models is computationally infeasible.
Therefore, we approximate the top K (up to 50 ) eigenvalues using the Lanczos algorithm (Lanczos, 1950; Dauphin et al., 2014), an extension of the power method, on approximately 5% of the training data (using more data was not beneﬁcial).
When regularization was applied during training (such as dropout, L2 or data augmentation), we apply the same regularization when estimating the Hessian.
This ensures that the Hessian reﬂects the loss surface accessible to SGD.
The code for the project is made available at https://github.com/kudkudak/dnn_sharpest_directions.
A study of the Hessian along the SGD path
In this section, we study the eigenvalues of the Hessian of the training loss along the SGD optimization trajectory, and the SGD dynamics in the subspace corresponding to the largest eigenvalues.
We highlight that SGD steers from the beginning towards increasingly sharp regions until some maximum is reached; at this peak the SGD step length is large compared to the curvature along the sharpest directions (see Fig.
1 for an illustration).
Moreover, SGD visits ﬂatter regions for a larger learning rate or a smaller batch-size.
3. Largest eigenvalues of the Hessian along the SGD path
We ﬁrst investigate the training loss curvature in the sharpest directions, along the training trajectory for both the SimpleCNN and Resnet-32 models.
Largest eigenvalues of the Hessian grow initially.
In the ﬁrst experiment we train
SimpleCNN and Resnet-32 using SGD with η = 0 .
1 and S = 128 and estimate the 10 largest eigenvalues of the Hessian, throughout training.
As shown in Fig.
2 (top) the spectral norm (which corresponds to the largest eigenvalue), as well as the other tracked eigenvalues, grows in the ﬁrst epochs up to a maximum value.
After reaching this maximum value, we observe a relatively steady decrease of the largest eigenvalues in the following epochs.
To investigate the evolution of the curvature in the ﬁrst epochs more closely, we track the eigenvalues at each iteration during the beginning of training, see Fig.
2 (bottom).
We observe that initially the magnitudes of the largest eigenvalues grow rapidly.
After this initial growth, the eigenvalues alternate between decreasing and increasing; this behaviour is also reﬂected in the evolution of the accuracy.
This suggests SGD is initially driven to regions that are diﬃcult to optimize due to large curvature.
To study this further we look at a full-batch gradient descent training of Resnet-32 3 . This experiment is also motivated by the instability of large-batch size training reported in the literature, as for example by Goyal et al. In the case of Resnet-32 (without Batch-Normalization) we can clearly see that the magnitude of the largest eigenvalues of the
Hessian grows initially, which is followed by a sharp drop in accuracy suggesting instability of the optimization, see Fig.
We also observed that the instability is partially solved through use of Batch-Normalization layers, consistent with the ﬁndings of Bjorck et al.
(2018), see Fig. 9 in Appendix. Finally, we report some additional results on the late phase of training, e.g. the impact of learning rate schedules, in Fig.
12 in the Appendix.
[Figure]
Learning rate and batch-size limit the maximum spectral norm.
Next, we investigate how the choice of learning rate and batch size impacts the SGD path in terms of its curvatures.
Fig.
4 shows the evolution of the two largest eigenvalues of the Hessian during training of the SimpleCNN and Resnet-32 on CIFAR-10, and an LSTM on PTB, for diﬀerent values of η and S .
We observe in this ﬁgure that a larger learning rate or a smaller batch-size correlates with a smaller and earlier peak of the spectral norm and the subsequent largest eigenvalue.
Note that the phase in which curvature grows for low learning rates or large batch sizes can take many epochs.
Additionally, momentum has an analogous eﬀect – using a larger momentum leads to a smaller peak of spectral norm, see Fig. 13 in Appendix.
Similar observations hold for VGG-11 and Resnet-32 using Batch-Normalization, see Appendix A.1.
Summary.
These results show that the learning rate and batch size not only inﬂuence the SGD endpoint maximum curvature, but also impact the whole SGD trajectory.
A high learning rate or a small batch size limits the maximum spectral norm along the path found by SGD from the beginning of training.
While this behavior was observed in all settings examined (see also the Appendix), future work could focus on a theoretical analysis, helping to establish the generality of these results [Figure]
3. Sharpest direction and SGD step
The training dynamics (which later we will see aﬀect the speed and generalization capability of learning) are signiﬁcantly aﬀected by the evolution of the largest eigenvalues discussed in
Section 3.1.
To demonstrate this we study the relationship between the SGD step and the loss surface shape in the sharpest directions.
As we will show, SGD dynamics are largely coupled with the shape of the loss surface in the sharpest direction, in the sense that when projected onto the sharpest direction, the typical step taken by SGD is too large compared to curvature to enable it to reduce loss.
We study the same SimpleCNN and Resnetmodels as in the previous experiment in the ﬁrst 6 epochs of training with SGD with η =0. and S = 128 .
The sharpest direction and the SGD step.
First, we investigate the relation between the SGD step and the sharpest direction by looking at how the loss value changes on average when moving from the current parameters taking a step only along the sharpest direction - see Fig.
6 left.
For all training iterations, we compute E
[ L ( θ ( t ) − αη ˜ g
1 ( t ))
− L ( θ ( t )) , for α ∈ { 0 . 25 , 0 . 5 , 1 , 2 , 4 } ; the expectation is approximated by an average over 10 diﬀerent mini-batch gradients.
We ﬁnd that E [ L ( θ ( t ) − αη ˜ g 1 ( t ))] increases relative to L ( θ ( t )) for α > 1 , and decreases for α < 1 .
More speciﬁcally, for SimpleCNN
we ﬁnd that α = 2 and α = 4 lead to a 2 .
1% and 11 .
1% increase in loss, while α = 0 .
25 and α = 0 .
5 both lead to a decrease of approximately 2% .
For Resnet-32 we observe a 3% and 13 .
1% increase for α = 2 and α = 4 , and approximately a 0 .
5% decrease for α = 0 .
25 and α = 0 .
5 , respectively.
The observation that SGD step does not minimize the loss along the sharpest direction suggests that optimization is ineﬀective along this direction.
This is also consistent with the observation that learning rate and batch-size limit the maximum spectral norm of the
Hessian (as both impact the SGD step length).
These dynamics are important for the overall training due to a high alignment of SGD step with the sharpest directions.
We compute the average cosine between the mini-batch gradient g S ( t ) and the top 5 sharpest directions e 1 ( t ) , . . . e 5 ( t ) .
We ﬁnd the gradient to be highly aligned with the sharpest direction, that is, depending on η and model the maximum average cosine is roughly between 0 . 2 and 0 . 4 .
Full results are presented in Fig.
Qualitatively, SGD step crosses the minimum along the sharpest direction.
Next, we qualitatively visualize the loss surface along the sharpest direction in the ﬁrst few epochs of training, see Fig 6 (right).
To better reﬂect the relation between the sharpest [Figure] [Figure] direction and the SGD step we scaled the visualization using the expected norm of the SGD step ∆ θ 1 ( t ) =
η E ( | ˜ g 1 ( t ) | ) where the expectation is over 10 mini-batch gradients.
Speciﬁcally, we evaluate L ( θ ( t ) + ke 1 ∆ θ 1 ( t )) , where θ ( t ) is the current parameter vector, and k is an interpolation parameter (we use k ∈ [ − 5 , 5] ).
For both SimpleCNN and Resnet-32 models, we observe that the loss on the scale of ∆ θ 1 ( t ) starts to show a bowl-like structure in the largest eigenvalue direction after six epochs.
This further corroborates the previous result that SGD step length is large compared to curvature in the sharpest direction.
Training and validation accuracy are reported in Appendix B. Furthermore, in the Appendix B we demonstrate that a similar phenomena happens along the lower eigenvectors, for diﬀerent η , and in the later phase of training.
Summary.
We infer that SGD steers toward a region in which the SGD step is highly aligned with the sharpest directions and would on average increase the loss along the sharpest directions, if restricted to them.
This in particular suggests that optimization is ineﬀective along the sharpest direction , which we will further study in Sec. 4.
3. How SGD steers to sharp regions in the beginning
Here we discuss the dynamics around the initial growth of the spectral norm of the Hessian.
We will look at some variants of SGD which change how the sharpest directions get optimized. [Figure] [Figure]
using the same η (blue and red horizontal lines).
Experiment.
We used the same SimpleCNN model initialized with the parameters reached by SGD in the previous experiment at the end of epoch 4 .
The parameter updates used by the three SGD variants, which are compared to vanilla SGD (blue), are based on the mini-batch gradient g ( S ) as follows: variant 1 (SGD top, orange) only updates the parameters based on the projection of the gradient on the top eigenvector direction, i.e. g ( t ) =
(cid:104) g ( S ) ( t ) , e 1 ( t ) (cid:105) e 1 ( t ) ; variant 2 (SGD constant top, green) performs updates along the constant direction of the top eigenvector
e 1 (0) of the Hessian in the ﬁrst iteration, i.e. g ( t ) =
(cid:104) g ( S ) ( t ) , e 1 (0) (cid:105) e 1 (0) ; variant 3 (SGD no top, red) removes the gradient information in the direction of the top eigenvector, i.e. g ( t )
=
g ( S ) ( t ) − (cid:104) g ( S ) ( t ) , e 1 ( t ) (cid:105) e 1 ( t ) .
We show results in the left two plots of Fig.
We observe that if we only follow the top eigenvector, we get to wider regions but don’t reach lower loss values, and conversely, if we ignore the top eigenvector we reach lower loss values but sharper regions.
[-Resnet-32 ek 5 
-]
[-2.6 SimpleCNN ek 5 
-]
Summary.
The take-home message is that SGD updates in the top eigenvector direction strongly inﬂuence the overall path taken in the early phase of training.
Based on these results, we will study a related variant of SGD throughout the training in the next section.
Optimizing faster while finding a good sharp region
In this ﬁnal section we study how the convergence speed of SGD and the generalization of the resulting model depend on the dynamics along the sharpest directions.
Our starting point are the results presented in Sec. 3 which show that while the SGD step can be highly aligned with the sharpest directions, on average it fails to minimize the loss if restricted to these directions.
This suggests that reducing the alignment of the SGD update direction with the sharpest directions might be beneﬁcial, which we investigate here via a variant of SGD, which we call Nudged-SGD (NSGD).
Our aim here is not to build a practical [Table] [Table] optimizer, but instead to see if our insights from the previous section can be utilized in an optimizer.
NSGD is implemented as follows: instead of using the standard SGD update, ∆ θ ( t ) = − η g ( S ) ( t ) , NSGD uses a diﬀerent learning rate, η (cid:48)
=
γη , along just the top K eigenvectors, while following the normal SGD gradient along all the others directions 4 .
In particular we will study NSGD with a low base learning rate η , which will allow us to capture any implicit regularization eﬀects NSGD might have.
We ran experiments with Resnetand SimpleCNN on CIFAR-10.
Note, that these are not state-of-the-art models, which we leave for future investigation.
We investigated NSGD with a diﬀerent number of sharpest eigenvectors K , in the range between 1 and 20 ; and with the rescaling factor γ ∈ { 0 . 01 , 0 . 1 , 1 , 5 } .
The top eigenvectors are recomputed at the beginning of each epoch 5 .
We compare the sharpness of the reached endpoint by both computing the Frobenius norm (approximated by the top 50 eigenvectors), and the spectral norm of the Hessian.
The learning rate is decayed by a factor of 10 when validation loss has not improved for 100 epochs.
Experiments are averaged over two random seeds.
When talking about the generalization we will refer to the test accuracy at the best validation accuracy epoch.
Results for Resnet-32 are summarized in Fig.
8 and Tab. 1; for full results on SimpleCNN we relegate the reader to Appendix, Tab. 2.
In the following we will highlight the two main conclusions we can draw from the experimental data.
NSGD optimizes faster, whilst traversing a sharper region.
First, we observe that in the early phase of training NSGD optimizes signiﬁcantly faster than the baseline, whilst traversing a region which is an order of magnitude sharper.
We start by looking at the impact of K which controls the amount of eigenvectors with adapted learning rate; we test K in { 1 , . . .
, 20 } with a ﬁxed γ = 0 .
On the whole, increasing K correlates with a signiﬁcantly improved training speed and visiting much sharper regions (see Fig.
We highlight that
NSGD with K = 20 reaches a maximum λ max of approximately 8 · 10 3 compared to baseline
SGD reaching approximately 150 .
Further, NSGD retains an advantage of over 5% ( 1% for
SimpleCNN) validation accuracy, even after 50 epochs of training (see Tab. 1).
NSGD can improve the ﬁnal generalization performance, while ﬁnding a sharper ﬁnal region.
Next, we turn our attention to the results on the ﬁnal generalization and sharpness.
We observe from Tab. 1 that using γ < 1 can result in ﬁnding a signiﬁcantly sharper endpoint exhibiting a slightly improved generalization performance compared to baseline SGD using the same η = 0 .
On the contrary, using γ > 1 led to a wider endpoint and a worse generalization, perhaps due to the added instability.
Finally, using a larger K generally correlates with an improved generalization performance (see Fig.
8, right).
More speciﬁcally, baseline SGD using the same learning rate reached 86 .
4% test accuracy with the Frobenius norm of the Hessian || H
|| F = 272 ( 86 .
6% with ||
H
|| F = 191 on SimpleCNN).
In comparison, NSGD using γ = 0 .
01 found endpoint corresponding to 87 .
0% test accuracy and || H
|| F =
and ||
H
|| F = 287 on SimpleCNN).
Finally, note that in the case of Resnet-32 K = 20 leads to 88% test accuracy and
|| H
|| F = 1100 which closes the generalization gap to SGD using η = 0 .
We note that runs corresponding to η =
.generally converge at ﬁnal cross-entropy loss around 0 .
01 and over 99% training accuracy.
As discussed in Sagun et al. (2017) the structure of the Hessian can be highly dataset dependent, thus the demonstrated behavior of NSGD could be dataset dependent as well.
In particular NSGD impact on the ﬁnal generalization can be dataset dependent.
In the
Appendix C and Appendix F we include results on the CIFAR-100,
Fashion MNIST (Xiao et al., 2017) and IMDB (Maas et al., 2011) datasets, but studies on more diverse datasets are left for future work.
In these cases we observed a similar behavior regarding faster optimization and steering towards sharper region, while generalization of the ﬁnal region was not always improved.
Finally, we relegate to the Appendix C additional studies using a high base learning and momentum.
Summary.
We have investigated what happens if SGD uses a reduced learning rate along the sharpest directions.
We show that this variant of SGD, i.e. NSGD, steers towards sharper regions in the beginning.
Furthermore, NSGD is capable of optimizing faster and ﬁnding good generalizing sharp minima , i.e. regions of the loss surface at the convergence which are sharper compared to those found by vanilla SGD using the same low learning rate, while exhibiting better generalization performance.
Note that in contrast to Dinh et al.
(2017) the sharp regions that we investigate here are the endpoints of an optimization procedure, rather than a result of a mathematical reparametrization.
Related work
Tracking the Hessian : The largest eigenvalues of the Hessian of the loss of DNNs were investigated previously but mostly in the late phase of training.
Some notable exceptions are: LeCun et al.
(1998) who ﬁrst track the Hessian spectral norm, and the initial growth is reported (though not commented on).
Sagun et al.
(2016) report that the spectral norm of the Hessian reduces towards the end of training.
Keskar et al.
(2016) observe that a sharpness metric grows initially for large batch-size, but only decays for small batch-size.
Our observations concern the eigenvalues and eigenvectors of the Hessian, which follow the consistent pattern, as discussed in Sec. 3.1.
Finally, Yao et al.
(2018) study the relation between the Hessian and adversarial robustness at the endpoint of training.
Wider minima generalize better :
Hochreiter and Schmidhuber (1997) argued that wide minima should generalize well.
Keskar et al.
(2016) provided empirical evidence that the width of the endpoint minima found by SGD relates to generalization and the used batch-size.
Jastrzębski et al.
(2017) extended this by ﬁnding a correlation of the width and the learning rate to batch-size ratio.
Dinh et al.
(2017) demonstrated the existence of reparametrizations of networks which keep the loss value and generalization performance constant while increasing sharpness of the associated minimum, implying it is not just the width of a minimum which determines the generalization.
Recent work further explored importance of curvature for generalization (Wen et al., 2018; Wang et al., 2018).
Stochastic gradient descent dynamics .
Our work is related to studies on SGD dynamics such as Goodfellow et al.
; Chaudhari and Soatto (2017);
Xing et al.
Zhu et al.
In particular, recently Zhu et al.
(2018) investigated the importance of noise along the top eigenvector for escaping sharp minima by comparing at the ﬁnal minima SGD with other optimizer variants.
In contrast we show that from the beginning of training SGD visits regions in which SGD step is too large compared to curvature.
Concurrent with this work Xing et al.
by interpolating the loss between parameter values at consecutive iterations show it is roughly-convex, whereas we show a related phenomena by investigating the loss in the subspace of the sharpest directions of the Hessian.
Conclusions
The somewhat puzzling empirical correlation between the endpoint curvature and its generalization properties reached in the training of DNNs motivated our study.
Our main contribution is exposing the relation between SGD dynamics and the sharpest directions, and investigating its importance for training.
SGD steers from the beginning towards increasingly sharp regions of the loss surface, up to a level dependent on the learning rate and the batch-size. Furthermore, the SGD step length is large compared to the curvature along the sharpest directions, and highly aligned with them.
Our experiments suggest that understanding the interaction of SGD based optimization and the sharpest directions of the loss landscape is a promising avenue for understanding generalization properties of neural networks. Additionally, results such as those showing the impact of the SGD step length on the regions visited (as characterized by their curvature) may help design novel optimizers tailor-ﬁt to neural networks. Acknowledgements
SJ was supported by Grant No. DI 2014/016644 from Ministry of Science and Higher Education, Poland and No. 2017/25/B/ST6/01271 from National Science Center, Poland. Work at Mila was funded by NSERC, CIFAR, and Canada Research Chairs. This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 732204 (Bonseyes).
This work is supported by the
Swiss State Secretariat for Education‚ Research and Innovation (SERI) under contract number 16.0159. A Additional results for Sec. 3. A. Additional results on the evolution of the largest eigenvalues of the Hessian First, we show that the instability in the early phase of full-batch training is partially solved through use of Batch-Normalization layers, consistent with the results reported by Bjorck et al.
; results are shown in Fig.
[Figure]
Next
[Figure]
we extend results of Sec.
3.1 to VGG-11 and Batch-Normalized Resnet-32 models, see Fig. 11 and Fig.
Importantly [Figure] we evaluated the Hessian in the inference mode
[Figure]
which resulted in large absolute magnitudes of the eigenvalues on Resnet-
[Figure] [Figure]
A. Impact of learning rate schedule
In the paper we focused mostly on SGD using a constant learning rate and batch-size.
We report here the evolution of the spectral and Frobenius norm of the Hessian when using a simple learning rate schedule in which we vary the length of the ﬁrst stage L ; we use η = 0 .for
L epochs and drop it afterwards to η = 0 .
We test L in { 10 , 20 , 40 , 80 } .
Results are reported in Fig.
The main conclusion is that depending on the learning rate schedule in the next stages of training curvature along the sharpest directions (measured either by the spectral norm, or by the Frobenius norm) can either decay or grow.
Training for a shorter time (a lower L ) led to a growth of curvature (in term of Frobenius norm and spectral norm) after the learning drop, and a lower ﬁnal validation accuracy. [Figure]
A. Impact of using momentum
In the paper we focused mostly on experiments using plain SGD [Figure] without momentum.
In this section we report that large momentum similarly to large η leads to a reduction of spectral norm of the Hessian, see Fig.
13 for results on the VGG11 network on CIFAR and CIFAR100.
[Figure]
B Additional results for Sec. 3.
In Fig.
14 we report the corresponding training and validation curves for the experiments depicted in Fig.
Next, we plot an analogous visualization as in Fig. 6, but for the 3rd and 5th eigenvector, see Fig.
15 and Fig.
16, respectively.
To ensure that the results do not depend on the learning rate, we rerun the Resnet-32 and SimpleCNN experiments with η = 0 .
05 , see Fig.
Finally, we run the same experiment as in Sec. 3.2, but instead of focusing on the early phase we replot Fig.
6 for the ﬁrst 200 epochs, see Fig.
[Figure] [Figure]
[Figure] [Figure]
[Figure]
C Additional results for Sec.
Here we report additional results for Sec. 4.
Most importantly, in Tab.
2 we report full results for SimpleCNN model.
Next, we rerun the same experiment, using the Resnetmodel, on the CIFAR-100 dataset, see Tab. [Figure] and on the Fashion-MNIST dataset, see
Tab. 6.
In the case of CIFAR-100 we observe that conclusion carry-over fully.
In the case of
Fashion-MNIST we observe that the ﬁnal generalization for the case of γ < 1 and γ = 1 . 0 is [Figure] similar.
Therefore, as discussed in the main text, the behavior seems to be indeed dataset dependent.
In Sec.
4 we purposedly explored NSGD in the context of suboptimally picked learning rate, which allowed us to test if NSGD has any implicit regularization eﬀect.
In the next two experiments we explored how NSGD performs when using either a large base learning η , or when using momentum.
Results are reported in Tab.
3 (learning rate η = 0 . 1 ) and Tab.(momentum µ = 0 . 9 ).
In both cases we observe that NSGD improves training speed and reaches a signiﬁcantly sharper region initially, see Fig.
However, the ﬁnal region curvature in both cases, and the ﬁnal generalization when using momentum, is not signiﬁcantly aﬀected.
Further study of NSGD using a high learning rate or momentum is left for future work.
[Table] [Table]
[Table] [Table]
[Table]
D SimpleCNN Model
The SimpleCNN used in this paper has four convolutional layers.
The ﬁrst two have 32 ﬁlters, while the third and fourth have 64 ﬁlters.
In all convolutional layers, the convolutional kernel window size used is ( 3 , 3 ) and ‘same’ padding is used.
Each convolutional layer is followed by a ReLU activation function.
Max-pooling is used after the second and fourth convolutional layer, with a pool-size of ( 2 , 2 ).
After the convolutional layers there are two linear layers with output size 128 and 10 respectively.
After the ﬁrst linear layer ReLU activation is used.
After the ﬁnal linear layer a softmax is applied.
Please also see the provided code.
E Comparing NSGD to Newton Method
Nudged-SGD is a second order method, in the sense that it leverages the curvature of the loss surface.
In this section we argue that it is signiﬁcantly diﬀerent from the Newton method, a representative second order method.
The key reason for that is that, similarly to SGD, NSGD is driven to a region in which curvature is too large compared to its typical step .
In other words NSGD does not use an optimal learning rate for the curvature, which is the key design principle for second order methods.
This is visible in Fig.
20, where we report results of a similar study as in Sec. 3.2, but for NSGD ( K = 5 , γ = 0 . 01 ).
The loss surface appears sharper in this plot, because reducing gradients along the top K sharpest directions allows optimizing over signiﬁcantly sharper regions.
As discussed, the key diﬀerence stems for the early bias of SGD to reach maximally sharp regions.
It is therefore expected that in case of a quadratic loss surface Newton and NSGD optimizers are very similar.
In the following we construct such an example.
First, recall that update in Newton method is typically computed as:
[Equation]
where λ is a scalar.
Now, if we assume that H is diagonal and put diag ( H ) =
[100 , 100 , 100 , 100 , 100 , 1 , 1] , and ﬁnally let λ = 0 , it can be seen that the update of NSGD with γ = 0 .
01 and K = 5 is equivalent to that of Newton method. [Figure] [Figure] Resnet
[Figure]
{++ NSGD ek 5 
+}
E p o c h 6.0 5.0 4.
L 1.4 1.6 1.
[Figure]
+ NSGD e
[Figure]
{+k 5 
+}
E p o c h 15.010.
[Figure]
L 1.4 1.6 1.
[Figure]
[Figure]
F Experiments on sentiment analysis dataset
Most of the experiments in the paper focused on image classiﬁcation datasets (except for language modeling experiments in Sec. 3.1).
The goal of this section is to extend some of the experiments to the text domain.
We experiment with the IMDB (Maas et al., 2011) binary sentiment classiﬁcation dataset and use the simple CNN model from the Keras (Chollet et al., 2015) example repository 6 .
First, we examine the impact of learning rate and batch-size on the Hessian along the training trajectory as in Sec. 3.1.
We test η ∈ { 0 . 025 , 0 . 05 , 0 . 1 } and S ∈ { 2 , 8 , 32 } .
As in Sec.
3.1 we observe that the learning rate and the batch-size limit the maximum curvature along the training trajectory.
In this experiment the phase in which the curvature grows took many epochs, in contrast to the CIFAR-10 experiments.
The results are summarized in Fig.
Next, we tested Nudged SGD with η = 0 .
01 , S = 8 and K = 1 .
We test γ ∈ { 0 . 1 , 1 . 0 , 5 . 0 } .
We increased the number of parameters of the base model by increasing by a factor ofnumber of ﬁlters in the ﬁrst convolutional layer and the number of neurons in the dense layer to encourage overﬁtting.
Experiments were repeated over 3 seeds.
We observe that in this setting NSGD for γ < 1 optimizes signiﬁcantly faster and ﬁnds a sharper region initially.
At the same time using γ < 1 does not result in ﬁnding a better generalizing region.
The results are summarized in Tab. 7 and Fig.
[Figure] [Figure]
[Table]