At Stability's Edge: How to Adjust Hyperparameters to Preserve Minima Selection in Asynchronous Training of Neural Networks?
Niv Giladi Mor Shpigel Nacson Elad Hoffer Daniel Soudry


[
    Anamaria Savu
    August 1, 2016
==================




Background: Recent developments have made it possible to accelerate neural networks training significantly using large batch sizes and data parallelism. Training in an asynchronous fashion, where delay occurs, can make training even more scalable. However, asynchronous training has its pitfalls, mainly a degradation in generalization, even after convergence of the algorithm. This gap remains not well understood, as theoretical analysis so far mainly focused on the convergence rate of asynchronous methods.   
 
Contributions: We examine asynchronous training from the perspective of dynamical stability. We find that the degree of delay interacts with the learning rate, to change the set of minima accessible by an asynchronous stochastic gradient descent algorithm. We derive closed-form rules on how the learning rate could be changed, while keeping the accessible set the same. Specifically, for high delay values, we find that the learning rate should be kept inversely proportional to the delay. We then extend this analysis to include momentum. We find momentum should be either turned off, or modified to improve training stability.  We provide empirical experiments to validate our theoretical findings.






























§ INTRODUCTION


Training deep neural networks (DNNs) requires large amounts of computational resources, often using many devices operating over days and weeks. Furthermore, with ever-increasing model size and available data, the amount of compute used was noted to increase exponentially over the past few years <cit.>.
Fortunately, the operations made in DNN training are highly suitable for parallelization over many devices. Most commonly, the parallelization is done by "data-parallelism" in which the data is divided into separate batches which are distributed between different devices during training. By using many devices, with each device highly utilized, one could train on a large number of samples without paying in run-time. However, this training is done synchronously, with synchronization between the different devices done on every iteration (S-SGD). With the growth in the number of devices participating in the training, the synchronization becomes a prominent bottleneck.

To overcome the synchronization bottleneck, asynchronous training (A-SGD) has been proposed <cit.>. The basic idea behind such training is that when a device finishes calculating its batch gradients, an update to the DNN parameters is immediately performed, without waiting for other devices. This approach is known as asynchronous centralized training with a parameter server (PS) that updates the parameters <cit.>. The main problem in such training is that, since the PS updates the parameters whenever a device communicates with him, the parameters that are being used in other devices calculation are no longer up-to-date. This phenomena is called gradient staleness or delay as we will refer to it, and it causes a deterioration in generalization performance when using A-SGD.

The generalization deterioration can be seen in Fig. <ref>. Unless the learning rate is significantly decreased, we can see a generalization gap: a deterioration in the generalization of A-SGD (with delay τ=32) from the baseline (S-SGD, τ=0) value near the steady state — i.e., after we are near full convergence, following many training epochs (2000). 

Due to the generalization gap demonstrated in the figure,  A-SGD with a parameter server and large delays is not commonly used — despite it is relatively simple to implement and despite its vast potential to accelerate training.

Therefore, our main goal in this work is to shed some theoretical light on the generalization gap problem and use it to improve A-SGD training.























Previous theoretical analysis of A-SGD <cit.> focused on analyzing the convergence rate, the time it takes to reach steady state, and not on the properties of the obtained solution. In contrast, in our paper we focus on understanding how the delay affects the selection of the solution we converge to, and changes in this selection can impact generalization. 

We tackle these questions from the perspective of dynamical stability. The dynamical stability approach was used in <cit.>,  to study which minima are accessible under a specific choice of optimization algorithm and hyperparameters. In <cit.>, the authors analyzed gradient descent (GD) algorithm as a discrete-time nonlinear dynamical system. By analyzing the Lyapunov stability of this system for different minima, they showed a relation between the learning rate choice and the accessible minima set, the subset of the local optima that GD can converge to. In <cit.>, the authors focused on stochastic gradient descent (SGD), defined a criterion to evaluate the stability of a specific minimum and used this criterion to show how the learning rate and batch-size play a role in SGD minima selection process.

Here, we use dynamical stability to analyze the dynamics of A-SGD. Using this approach, the main question we try to tackle is:


How do learning rate, delay and momentum
interact and affect the minima selection process?



Contributions

We start by modelling A-SGD as a dynamical system with delay. By analyzing the stability properties of that system, we find:
 
    
  * There exist an inverse linear relation between the delay of A-SGD, and the threshold learning rate the critical learning rate in which a minimum loses stability.
    
  * This implies that in order to keep a specific minimum stability as we change the delay, we need to change the learning rate inversely proportional to the delay.
    
  * Momentum has a crucial role in determining stability properties for A-SGD. Depending on the specific training algorithm, it can either hurt the stability or improve it. We show how to modify momentum to stabilize A-SGD training. 

With our theoretical findings, we derive closed form rules when training asynchronously. We suggest to scale the learning rate inversely to the delay in order to reach a better generalization performance. In section <ref> we provide experiments on popular classification tasks to support our theoretical analysis. It is interesting to contrast this simple linear relation with the more complicated picture observed for the scaling of the learning rate with the batch size. Specifically, it has been observed by <cit.> that the optimal learning rate scales differently with the batch size when changing the models and datasets, i.e., there is no general "rule of thumb" that applies in all cases. 

A similar scaling rule for the learning rate was proposed before <cit.>, however, there it lacked a theoretical basis or a demonstration of its effectiveness with large effective batch sizes, the sum of all the minibatch sizes of all the workers, as we do here.




§ THEORETICAL ANALYSIS
 


 §.§ Preliminaries and Problem Setup

Consider the problem of minimizing the empirical loss 

    f(x) =  f_i(x) ,

where N is the number of samples, x∈^d and ∀ i=1,...,N: f_i: ^d→ is twice continuously differentiable function. The update rule for minimizing f(x) in eq. <ref> using asynchronous stochastic gradient descent (A-SGD) is given by

    x_t+1    = x_t - η∇ f_n(t-τ)(x_t-τ) ,

where η is the learning rate, n(t) is a random selection process of
a sample from { 1,2,…,N} at iteration t, and
τ is some delay due the asynchronous nature of our training. For simplicity, we focus on a fixed delay τ. The extension to stochastic delay is discussed in section <ref>. 

Our main goal is understanding how different factors such as the gradient staleness τ and the learning rate η affect the minima selection process in neural networks. In other words, we would like to understand how the different hyperparameters interact to divide the minima of the loss to two sets: those we can converge to and those we cannot converge to.

To analyze this we suppose we are in a vicinity of some minimum point x^*, which implies ∇ f(x^*)=0. Given some values of η and τ, we ask whether or not we can converge to x^*, using the theory of dynamical stability. As we shall see, if the learning rate η or delay τ are too high, then this minimum loses stability, A-SGD cannot converge to x^* , in expectation. 

Specifically, we examine the expectation of the linearized dynamics around x^*. We show in  appendix <ref> that, to ensure stability, it is sufficient that the following one-dimensional equation is stable:

    x_t+1 - x_t + η a  x_t-τ = 0
     ,

where we defined the Hessian H = 1/N∇^2 f_i(x^*), the sharpness term a = λ_max(H) as the maximal eigenvalue of the Hessian, and x_t is the projection of the expectation of the perturbation 𝐱_t - 𝐱^* on the eigenvector which corresponds to the maximal eigenvalue a. Additionally, we show in  appendix <ref> that the characteristic equation of eq. <ref> is

We use a Z-transform <cit.> to obtain the characteristic equation of eq. <ref>.

    The Z-transform of a discrete-time signal x_t is defined as the power series X(z) = ∑_t=-∞^∞ x_tz^-t, where z∈ℂ.

The characteristic equation ismight not be clear to the reader what characteristic equation is and how is this related to z transform. Explain.:

    z-(1+m)+mz^-1+η(1-m)a z^-τ=0

or


    z^τ+1-z^τ+ η a =0 .




 §.§ Stability Analysis
 

For given (η,τ), we would like to determine if the minimum point x^* is asymptotically stable <cit.> in expectation. This will enable us to divide the minima into two sets: those we might converge to since they are stable, and those we cannot possibly converge (except for a measure zero set of initialization) since they are unstable.
We use the characteristic equation (eq. <ref>) to define the stability criterion:
 
    For given (η,τ), we say that the dynamics in eq. <ref> are stable if all the roots of the corresponding characteristic equation (eq. <ref>) are inside the unit circle. This condition is equivalent to x_t→ 0 for any initialization.

We would like to find conditions on when and how
can we change the hyperparameters (η,τ) to
maintain the same stability criterion. This, for example, will enable us to understand how to compensate for the delay introduced by asynchrony using the learning rate. In order to analyze stability we examine the characteristic equation in eq. <ref> and ask: when does the maximal root of this polynomial have unit magnitude?

We use the fact that solutions with z=1 are given by z=e^iθ where i is the unit imaginary number and θ is some angle. Substituting this into eq. <ref> and assuming that τ>0,α>0, m<1 we obtain the relation:

    m = cos( (2τ+1)θ/2)/cos( (2τ-1)θ/2)   ,  where α = sin(θ)/sin(τθ) .

The full derivation is in appendix Add ref. Using the last result, 



  §.§.§ The Interaction Between Learning Rate and Delay
 

Recall the characteristic equation 

    z^τ+1-z^τ+a η =0 .

This polynomial has τ+1 roots. In order to ensure stability we require that the root with the maximal magnitude, the maximal root, will be inside the unit circle. We want to find the threshold learning rate, the learning rate in which the maximal root is exactly on the unit circle, so we are at the threshold of stability. In appendix <ref>, we show that this requires that

    a η =  2 sin(π/4τ+2) .

Using Taylor approximation we get

    a η    = 2(π/4τ+2 + O( 1/τ^3) ) ⇒1/a η  = 1/π(2τ+1)+O(1/τ) .


We observe numerically that the error between the exact solution (eq. <ref>) and the linear approximation (eq. <ref>) is smaller than 0.05 for τ≥1. Additionally, in the appendix Fig. <ref> we demonstrate the high accuracy of the analytic approximation of the relation between 1/aη and τ, compared to the numerical evaluation of  the value of 1/a η for which the maximal root of eq. <ref> is on the unit circle. 

Implications: We can see that to maintain stability for a given minimum point (or a given sharpness value) the learning rate should be kept inversely proportional to the delay. This implies that given some minimum x^* for τ=0 and a corresponding learning rate η_0 for which this minimum is stable, we can evaluate the learning rate which will ensure this minimum remain stable for larger delay values. To do this, we first estimate a using eq. <ref>: a η_0 =  2 sin(π/4·0+2)=2⇒ a = 2/η_0. Note that we do not use eq. <ref> to evaluate a since we are interested in τ=0, while the relation in eq. <ref> is only a good approximation for τ≥1. Next, given some delay τ, we substitute a into eq. <ref> in order to evaluate a learning rate value for which the stability of all minima is maintained as in τ=0

    η≈π/a(2τ+1) = πη_0/4(τ+0.5) .

Related empirical results: In section <ref> we show empirically the existence of a stability threshold for different values of delay and compare it with our theoretical threshold.

Stochastic delay: In appendix <ref> we extend our theoretical analysis to derive the characteristic equation for A-SGD with stochastic delay, when τ is drawn from some discrete distribution. We analyze two cases:

    
  * Discrete uniform distribution: τ∼{a,b}.
    
  * Gaussian distribution discrete approximation: ∀μ, ∀ k=1,...,2μ: (τ=k) = (k-0.5≤z≤ k+0.5) where z∼ℕ(μ,1). In <cit.>, the authors showed empirically a delay distribution that resembles to Gaussian distribution.

For both cases, we show numerically that the inverse relation between the learning rate η and the expected delay 𝔼τ still applies.



  §.§.§ The effects of momentum on stability
 

The optimization step of stochastic gradient descent with momentum is defined as follows:  

    x_t = m v_t-1 - η(1-m) ∇ f_n(t)(x_t) , 
       x_t = x_t-1 + v_t


The optimization step of A-SGD with momentum is defined as follows: 

    v_t+1    =m v_t-η(1-m)∇ f_n(t-τ)(x_t-τ)
    x_t+1    = x_t+v_t+1 ,

where x_t are the weights, v_t and ∇ f_n(t)(x_t) are the velocity and gradients at time t, respectively, m is the momentum parameter, η is the step size and τ is the delay. The constant (1-m) term which multiplies the gradients is called "dampening". 

In appendix <ref> we extend our theoretical analysis to derive the characteristic equation for A-SGD with momentum. In addition, in section <ref> we show numerically that an inverse relation between the learning rate η and the delay τ also applies when using momentum. Particularly, 

    
  * We need to keep the learning rate inversely proportional to the delay.
    
  * For a given delay, larger momentum values require smaller learning rate for stability.

Therefore, the range of stable learning rates decreases when the momentum parameter ('m') increases which can make tuning the learning rate difficult, especially with large delays. These results suggest that, to ensure stability when training with large delay, it is recommended to work without momentum. 

Relation to previous results: The conclusion that when using A-SGD with high delay values it's recommended to turn off momentum is consistent with the results of <cit.>. In <cit.>, for streaming PCA, the authors showed it is necessary to reduce momentum in order to ensure convergence and acceleration through asynchrony. In <cit.> the authors suggested that asynchrony adds implicit momentum to the training process and therefore it is necessary to reduce momentum when working asynchronously.

Next, we discuss a new method for introducing momentum into asynchronous training. This method enables asynchronous training where increasing the momentum parameter improves the stability.

Shifted momentum As discussed, training asynchronously is less stable when momentum is used. We propose to utilize momentum in an alternative method, called shifted momentum, for training asynchronously where the momentum benefits the training process and particularly its stability. We observe this method tends to improve the convergence stability compared to training without momentum (or with the original momentum), as is demonstrated in appendix Fig. <ref>. We suggest that instead of exchanging the gradients terms, as in eq.  <ref>, we exchange the entire velocity term. This way, each worker calculates the velocity term based in its own gradients and momentum buffer. The formulation of this method is given in the following equation:

    v_t+1    =m v_t-τ-η(1-m)∇ f_n(t-τ)(x_t-τ)
    x_t+1    = x_t+v_t+1

or

    x_t+1    = x_t+m (x_t-τ - x_t-τ-1) -η(1-m)∇ f_n(t-τ)(x_t-τ)

In appendix <ref> we show that the characteristic equation of eq. <ref> is 

    z^τ+2-z^τ+1+(η(1-m)a-m)z+m=0 ,

where we use the sharpness term a = λ_max(H) as before.

We would like to characterize how the learning rate, delay and momentum  affect minima stability. Thus, for each momentum value, we evaluate numerically the value of 1/aτ for which the maximal root of eq. <ref> is on the unit circle, i.e., when we are on the threshold of stability. In Fig. <ref> we see that the inverse relation between the learning rate η and the delay τ still applies when using shifted momentum. Moreover, we can see that in contrast to regular momentum, in shifted momentum, a larger momentum value m enables us to work with larger step-size. Therefore, increasing the momentum improves the stability.

Relation to previous results: The analysis of delayed gradients and velocity might also shed light on the stability of recent asynchronous training approaches, where the workers communicating through weight averaging <cit.>. This method is similar to ours in the sense that each worker holds its own momentum buffer. In parallel to us,
<cit.> used a variation of shifted momentum with Nesterov momentum (denoted as Multi-ASGD), and demonstrated empirically its generalization benefits, but without a theoretical analysis of this benefit. 


The next important question is whether actual learning problem will behave in such way? We answer this question and show this is true by training a fully connected network on the familiar MNIST dataset.Fig<ref> shows this behaviour empirically. More details about the empirical evaluation can be found subsection <ref>. 




 §.§ Special Case : Stability Not Affected By Momentum

Need to add motivation for this case.

In this case, the characteristic equation simplifies to 

    z^2-(1+m)z+1=0 .

We can analytically solve this equation and get

    z_±=    m+1/2±1/2√(m^2+2m-3) ⇒ |z_±|^2=(m+1)^2/4+(1-(m+1)^2/4)=1 ,

where we used the fact that m<1 and thus m^2+2m-3<0.
So, regardless of the momentum value m we get that |z_±|^2=1
 and we are at the threshold of stability at aη=1.
Therefore, in this case m does not affect stability.

Do we have any numerical results that relates to this part?




§ EXPERIMENTS
 

In this section, we provide experiments to support our theoretical findings. In the following subsections we: (1) demonstrate the relationship between hyperparameters and minima selection, and (2) show our findings can help improve asynchronous training. Details about the experiments and the implementation can be found in appendix <ref>. [Code will be available at <https://github.com/paper-submissions/delay_stability>]





















 §.§ How Hyperparameters Affect Minima Selection
 
In this section, we demonstrate how the delay and learning rate affect the accessible minima set. We train with a fixed learning rate.

Minima stability.  To demonstrate how delay and learning rate change the stability of a minimum, we start from a model that converged to some minimum and train with different values of delay and learning rate to see if the algorithm leaves that minimum, the minimum becomes unstable. We do so by training a VGG-11 on CIFAR10 for 10,000 epochs – until we reach a steady state. This training is done without delay, momentum and weight decay. Next, introduce a delay τ, change the learning rate, and continue to train the model. Fig. <ref> shows the number of epochs it takes to leave the steady state for a given delay τ and learning rate η. We observe that for certain (τ,η) pairs, the algorithm stays in the minimum (below the black circle) while for others it leaves that minimum after some number of epochs (above the black circle). Importantly, we can see in the right panel in Fig. <ref> that, as predicted by the theory, the inverse learning rate, 1/η, where η is the maximal learning rate in which we did not diverge, scales linearly with the delay τ. Additional details are given in appendix <ref>.



Generalization with delay. With delay, we need to adjust the hyperparameters in order to maintain the accessible minima set. However, even if a certain pair of (τ,η) changes the accessible set, it is possible that there are still accessible minima that generalize well. We perform experiments to investigate what type of generalization we can expect from training with different (τ,η) pairs. We examine this by training a VGG-11 on CIFAR10 with different (τ,η) pairs until we reach a steady state (around 6,000 epochs). We use plain SGD without momentum or weight decay. We compare the generalization performance achieved by each pair of learning rate and delay. We repeat the experiment for each pair four times and report mean and standard deviation values. The results are presented in Fig. <ref>. We can see a linear scaling between the delay values and the learning rate empirical stability threshold, the learning rate in which the error diverge. In addition, we see that the smallest error (with small variance) is obtained at a learning rate which is somewhat smaller then the learning rate at the empirical threshold of stability, as expected <cit.>. 



Shifted momentum stability. In subsection <ref> we introduced shifted momentum as a modification of the standard momentum update, in which increasing the momentum value ('m') improves stability. We validate the stability properties of this method by training a fully connected model with MNIST. The model has 3 layers, 1024 neurons in each layer with ReLU activations. Again, training is done synchronously with a large batch and no weight decay until it reaches a steady state. Then, after reaching a minimum, we continued to train the model, each time with a different triplet of (τ,η,m). We found the maximum learning rate for a given m and τ for which training does not diverge, i.e, this maximum learning rate is at the edge of stability. Fig. <ref> depicts the empirical results. The value of a=λ_max(H) is estimated at the minimum point using power iteration. Two important results emerge from the graph. First, in order to maintain the stability threshold, the learning rate has to be inversely proportional to the delay, as described in subsection <ref>. Second, with increased momentum values, training becomes more stable. Meaning, we can use larger learning rates with larger momentum value. This stands in contrast to the analysis of the original momentum: as we show numerically in appendix <ref>, increasing the momentum value m in the standard momentum algorithm decreases the stability and hence we need to decrease the learning rate as the momentum value grows larger. 







 §.§ Improving Asynchronous Training

So far we focused on the steady state behavior of A-SGD, i.e. after many iterations. However, one of the prominent motivations for training asynchronously is to speed-up training. In this subsection, we examine whether our findings are also relevant for improving the accuracy of models trained asynchronously with little to no excess budget of epochs, compared to equivalent large batch regime. In large batch training, the learning rate is scaled as a function of the ratio between the large batch size and the small one. As <cit.> pointed out, we can expect a different learning rate scaling for different models/datasets.
We start with a set of models and datasets that follow a square root scaling of the learning rate with the batch size <cit.>. Recall that our inversely linear scaling rule (i.e., η∝ 1/τ) applies to the large batch learning rate. We demonstrate the validity of our inversely linear learning rate scaling by comparing our method with one that does not account for the delay τ. The results are presented in Table <ref>. We can see that using the small batch regime with delay (ASGD) does not converge at all. 

With our inversely linear learning rate scaling (+LR), there is a small gap from the equivalent large batch. If we also increase the budget of epochs by 30%, our optimization regime (+30%) generalizes better than the large batch (LB). Because A-SGD has better run-time performance compared to S-SGD <cit.>, such excess in epochs may still result in improved overall wall clock time (this depends on the hardware details).




ImageNet. We next experiment with ResNet50 and ImageNet, which is a popular benchmark for large batch and asynchronous training because of its complexity and scale. Our focus is asynchronous centralized training with high delay. To the best of our knowledge, the generalization gap is not closed yet in this setting. This is an important setting because of its simplicity and its scalability potential. Optimization details can be found in appendix <ref>

 In Fig. <ref>, we compare three A-SGD optimizations trained with ImageNet. As can be seen in the figure, the generalization gap decreases from 4.33% to 1.69%, just by turning off momentum. This corresponds with our analysis and previous results about the relation between momentum and delay. Shifted momentum similarly improves generalization, as can be seen in the right panel. This validates our analysis on the beneficial role the momentum parameter has, using shifted momentum. The learning rate is first scaled linearly with the total batch size of all the workers, as in <cit.>. Our inverse linear scaling with delay cancels this increase, and we get a similar learning rate as in regular small batch training. In contrast, when we scaled the learning rate with 1/√(τ), training did not converge at all. 









§ DISCUSSION



  
Motivation.  A fundamental problem with asynchronous training is that it seems to cause a degradation in generalization, even after training has converged to a steady state. Identifying the root of this problem and resolving it is essential in order to scale parallelism. When approaching this problem, we need to address two issues. First, what is the origin of this generalization gap? Second, how can we decrease this generalization gap?


  
Conclusions. Our work tackles both questions by studying the behaviour of A-SGD and the relation between the delay and the hyperparameters, the learning rate and momentum. We analyze A-SGD from the theoretical perspective of dynamical stability. We find that a linear connection between the inverse learning rate and delay is necessary in order to keep the set of accessible minima the same. In addition, we find how momentum affects the accessible minima set. Our analysis suggests that, when increasing delay,  momentum degrades stability. Therefore, it should be turned off in order to maintain performance, as was previously observed empirically <cit.>. However, we observe that momentum can have some benefits in improving convergence stability without delay. To maintain these benefits, we propose to modify momentum into a method called shifted momentum. We supply a theoretical analysis of A-SGD with shifted momentum and conclude that, in contrast to regular momentum, this method improves stability when delay is increased. In addition, we supply empirical evidence to support these findings. Lastly, we demonstrate, these findings can improve the generalization performance of distributed training algorithms and bring us one step closer to closing the generalization gap.


  
Future Directions. It is interesting to examine how the dynamical stability analysis holds during training. Specifically, what implications can we derive from the analysis, before we reach the steady state (e.g., a minimum of the loss), given a tight epochs budget. Our empirical findings in this case (Fig.  <ref> ) suggest that the optimal learning rate chosen for the steady state may remain optimal during the convergence process. This might be because the hyperparameters at the stability threshold are closely related to the hyperparameters that achieve the optimal convergence speed to that minimum. For example, in GD it easy to show that η_threshold=2η_optimal. Therefore, both stability and convergence rate may be optimally maintained using similar scaling relations in the hyperparameters. This is an interesting question for future study.

Another interesting question for future study is to understand how the stability conditions change when some synchronization is introduced. Several practical A-SGD methods use synchronization to some extent, e.g. <cit.>. For synchronization methods that reduce the delay in expectation, we can intuitively expect an improvement in dynamical stability, from our analysis of stochastic delay (appendix <ref>). However, further analysis of the stability method for each method is required for an exact answer. 

Answering these questions may lead to a more precise understanding of the trade-offs between S-SGD and the various A-SGD methods. 


ICLR/iclr2020_conference
31


urlstyle

[Amodei & Hernandez(2018)Amodei and Hernandez]AIandCompute
Dario Amodei and Danny Hernandez.
Ai and compute.
<https://openai.com/blog/ai-and-compute/>, 2018.
Accessed: 2019-05-23.

[Arjevani et al.(2018)Arjevani, Shamir, and Srebro]Arjevani2018
Yossi Arjevani, Ohad Shamir, and Nathan Srebro.
A Tight Convergence Analysis for Stochastic Gradient Descent with
  Delayed Updates.
jun 2018.

[Assran et al.(2019)Assran, Loizou, Ballas, and Rabbat]Assran2018
Mahmoud Assran, Nicolas Loizou, Nicolas Ballas, and Michael Rabbat.
Stochastic Gradient Push for Distributed Deep Learning.
2019.

[Chen et al.(2016)Chen, Pan, Monga, Bengio, and
  Jozefowicz]chen2016revisiting
Jianmin Chen, Xinghao Pan, Rajat Monga, Samy Bengio, and Rafal Jozefowicz.
Revisiting distributed synchronous sgd.
arXiv preprint arXiv:1604.00981, 2016.

[Dai et al.(2018)Dai, Zhou, Dong, Zhang, and Xing]Dai2018
Wei Dai, Yi Zhou, Nanqing Dong, Hao Zhang, and Eric Xing.
Toward Understanding the Impact of Staleness in Distributed Machine
  Learning, sep 2018.

[Dean et al.(2012)Dean, Corrado, Monga, Chen, Devin, Mao, Senior,
  Tucker, Yang, and Le]Dean2012
Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao,
  Andrew Senior, Paul Tucker, Ke Yang, and Quoc V Le.
Large scale distributed deep networks.
Advances in Neural Information Processing Systems, pp.  1223–1231, 2012.

[Deng et al.(2009)Deng, Dong, Socher, Li, Li, and
  Fei-Fei]imagenet_cvpr09
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei.
Imagenet: A large-scale hierarchical image database.
In Computer Vision and Pattern Recognition, 2009. CVPR 2009.
  IEEE Conference on, pp.  248–255. Ieee, 2009.

[Dutta et al.(2018)Dutta, Joshi, Ghosh, Dube, and Nagpurkar]Dutta2018
Sanghamitra Dutta, Gauri Joshi, Soumyadip Ghosh, Parijat Dube, and Priya
  Nagpurkar.
Slow and Stale Gradients Can Win the Race: Error-Runtime Trade-offs
  in Distributed SGD.
mar 2018.

[Goyal et al.(2017)Goyal, Dollár, Girshick, Noordhuis, Wesolowski,
  Kyrola, Tulloch, Jia, and He]goyal2017accurate
Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz
  Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He.
Accurate, large minibatch sgd: training imagenet in 1 hour.
arXiv preprint arXiv:1706.02677, 2017.

[Hakimi et al.(2019)Hakimi, Barkai, Gabel, and Schuster]Hakimi2019
Ido Hakimi, Saar Barkai, Moshe Gabel, and Assaf Schuster.
Taming Momentum in a Distributed Asynchronous Environment.
2019.

[He et al.(2016)He, Zhang, Ren, and Sun]He
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.
Deep residual learning for image recognition.
In Proceedings of the IEEE conference on computer vision and
  pattern recognition, pp.  770–778, 2016.

[Hoffer et al.(2017)Hoffer, Hubara, and Soudry]hoffer2017train
Elad Hoffer, Itay Hubara, and Daniel Soudry.
Train longer, generalize better: closing the generalization gap in
  large batch training of neural networks.
In NIPS, pp.  1731–1741, 2017.

[Keskar et al.(2016)Keskar, Mudigere, Nocedal, Smelyanskiy, and
  Tang]Keskar2016
Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy,
  and Ping Tak Peter Tang.
On Large-Batch Training for Deep Learning: Generalization Gap and
  Sharp Minima.
sep 2016.

[Krizhevsky(2009)]krizhevsky2009learning
Alex Krizhevsky.
Learning multiple layers of features from tiny images.
2009.

[Lecun et al.(1998)Lecun, Bottou, Bengio, and Ha]Lecun1998
Yann Lecun, Leon Bottou, Yoshua Bengio, and Patrick Ha.
Gradient-Based Learning Applied to Document Recognition.
0 (November):0 1–46, 1998.

[LeCun et al.(2012)LeCun, Bottou, Orr, and
  Müller]lecun2012efficient
Yann A LeCun, Léon Bottou, Genevieve B Orr, and Klaus-Robert Müller.
Efficient backprop.
In Neural networks: Tricks of the trade, pp.  9–48.
  Springer, 2012.

[Li(2014)]Li2014
Mu Li.
Scaling Distributed Machine Learning with the Parameter Server.
Proceedings of the 2014 International Conference on Big Data
  Science and Computing - BigDataScience '14, pp.  1–1, 2014.

[Lian et al.(2015)Lian, Huang, Li, and Liu]Lian2015
Xiangru Lian, Yijun Huang, Yuncheng Li, and Ji Liu.
Asynchronous parallel stochastic gradient for nonconvex optimization.
In Advances in Neural Information Processing Systems, pp.  2737–2745, 2015.

[Lian et al.(2016)Lian, Zhang, Hsieh, Huang, and Liu]Lian2016
Xiangru Lian, Huan Zhang, Cho-Jui Hsieh, Yijun Huang, and Ji Liu.
A comprehensive linear speedup analysis for asynchronous stochastic
  parallel optimization from zeroth-order to first-order.
In Advances in Neural Information Processing Systems, pp.  3054–3062, 2016.

[Lian et al.(2017)Lian, Zhang, Zhang, and Liu]Lian2018
Xiangru Lian, Wei Zhang, Ce Zhang, and Ji Liu.
Asynchronous decentralized parallel stochastic gradient descent.
arXiv preprint arXiv:1710.06952, 2017.

[Liu et al.(2018)Liu, Li, Shi, Zhou, and Zhao]liu2018towards
Tianyi Liu, Shiyang Li, Jianping Shi, Enlu Zhou, and Tuo Zhao.
Towards understanding acceleration tradeoff between momentum and
  asynchrony in nonconvex stochastic optimization.
In Advances in Neural Information Processing Systems, pp.  3686–3696, 2018.

[Mitliagkas et al.(2017)Mitliagkas, Zhang, Hadjis, and
  Re]Mitliagkas2017
Ioannis Mitliagkas, Ce Zhang, Stefan Hadjis, and Christopher Re.
Asynchrony begets momentum, with an application to deep learning.
54th Annual Allerton Conference on Communication, Control, and
  Computing, Allerton 2016, pp.  997–1004, 2017.

[Nar & Sastry(2018)Nar and Sastry]Nar2018
Kamil Nar and S Shankar Sastry.
Step Size Matters in Deep Learning.
In NIPS, 2018.

[Oppenheim(1999)]oppenheim1999discrete
Alan V Oppenheim.
Discrete-time signal processing.
Pearson Education India, 1999.

[Recht et al.(2011)Recht, Re, Wright, and Niu]Niu
Benjamin Recht, Christopher Re, Stephen Wright, and Feng Niu.
Hogwild: A lock-free approach to parallelizing stochastic gradient
  descent.
In Advances in neural information processing systems, pp.  693–701, 2011.

[Shallue et al.(2018)Shallue, Lee, Antognini, Sohl-Dickstein, Frostig,
  and Dahl]Shallue2018
Christopher J Shallue, Jaehoon Lee, Joe Antognini, Jascha Sohl-Dickstein, Roy
  Frostig, and George E Dahl.
Measuring the effects of data parallelism on neural network training.
arXiv preprint arXiv:1811.03600, 2018.

[Simonyan & Zisserman(2014)Simonyan and Zisserman]Simonyan2014
Karen Simonyan and Andrew Zisserman.
Very deep convolutional networks for large-scale image recognition.
arXiv preprint arXiv:1409.1556, 2014.

[Wu et al.(2018)Wu, Ma, and E]Wu2018
Lei Wu, Chao Ma, and Weinan E.
How SGD Selects the Global Minima in Over-parameterized Learning: A
  Dynamical Stability Perspective.
In NIPS, 2018.

[Yan et al.(2018)Yan, Yang, Li, Lin, and Yang]Yan2018
Yan Yan, Tianbao Yang, Zhe Li, Qihang Lin, and Yi Yang.
A unified analysis of stochastic momentum methods for deep learning.
arXiv preprint arXiv:1808.10396, 2018.

[Zagoruyko & Komodakis(2016)Zagoruyko and Komodakis]Zagoruyko
Sergey Zagoruyko and Nikos Komodakis.
Wide residual networks.
arXiv preprint arXiv:1605.07146, 2016.

[Zhang et al.(2015)Zhang, Gupta, Lian, and Liu]Zhang
Wei Zhang, Suyog Gupta, Xiangru Lian, and Ji Liu.
Staleness-aware async-sgd for distributed deep learning.
arXiv preprint arXiv:1511.05950, 2015.






	

PART: 
*Appendix
	
	

§ STABILITY ANALYSIS FOR EQ. <REF>
 
	In this section, we would like to analyze the stability of eq. <ref>. In particular, we would like to examine if a given minimum point x^* is stable. To analyze this we suppose we are in a vicinity of some minimum point x^*, which implies ∇ f(x^*)=0, and ask whether or not we can converge to x^* using the theory of dynamical stability.
	Formally, consider the linearized dynamics around x^*:

    x_t+1    =x_t
    -η( G(x^*;n_t-τ) + ∇ G(x^*;n_t-τ)(x_t-τ-x^*) ) ,

where we denoted G(x_t;n_t)=∇ f_n_t(x_t) and changed the notation of the time index in n(t) to the subscript, n_t.

Examining the expectation of this equation we obtain

    x_t+1   (1)=x_t -η( 1/N G(x^*;i) + 1/N∇ G(x^*;i)(x_t-τ-x^*) )
       (2)=x_t -ηH(x_t-τ-x^*) ,

where in (1) we used ∀ k = 1,...,N: (n_t=k)=1/N, and in (2) we used the fact that x^* is a minimum point and thus G(x^*;i)=∇ f(x^*)=0 and denoted H = 1/N∇ G(x^*;i)=1/N∇^2 f_i(x^*) .



    x^* is a fixed point of the stochastic dynamics described in eq. <ref>, if for any n, we have G(x^*,n)=0.

need to say that fixed points don't always exist but in our setting of over-parametrization (which also should be motioned) they do exist and all global minima are fixed points.

Our main goal is understanding how different factors such as gradient staleness and hyperparameters such as the momentum and learning rate affect the minima selection process in neural networks. In other words, we would like to understand how the different hyperparameters interact to divide the global minima of our network to two sets: those we can converge to and those we cannot converge to.

To analyze this we suppose we are in a vicinity of a global minimum,
so f can be approximated using a quadratic form, and ask whether or
not we can converge to x^* using the theory of dynamical stability. Formally, let x^* be some fixed point and consider the quadratic approximation of f near x^*: 

    f(x) ≈1/2N(x - x^*)^⊤H_i (x - x^*) ,
 where H_i = ∇^2 f_i(x^*) and we assumed f(x^*)=0. The corresponding linearized the acronym for ASGD with momentum (eq. <ref>) is given by

    x_t+1    =x_t+m(x_t-x_t-1)-η(1-m)H_n_t-τ(x_t-τ-x^*) .


Using s_t= x_t - x^* variable change we obtain

    s_t+1 = s_t  - ηHs_t-τ .

From the Spectral Factorization Theorem we can write H = UAU^⊤ where U is an orthogonal matrix and A=(a_1,...,a_n) is a diagonal matrix. Substituting this into eq. <ref> we obtain:

    s_t+1 = s_t - ηUAU^⊤s_t-τ .

Multiplying the last equation with U^⊤ from the left, denoting s̃_t = U^⊤s_t, and using the fact that U is an orthogonal matrix, U^⊤U=I we get:

    s̃_t+1 = s̃_t  - ηAs̃_t-τ .

Recall that A=(a_1,...,a_N) is a diagonal matrix. Therefore, analyzing the dynamics of the last equation is equivalent to analyzing the dynamics of the following N one-dimensional equations: 

    ∀ i = 1,...N  : s̃_t+1(i) = s̃_t (i)  - η a_i s̃_t-τ (i) ,

where s_t(i) denotes the i^th component of the vector s_t.

In order to ensure stability of the N-dimensional dynamical system, it's sufficient to require that

    s̃_t+1(1) = s̃_t (1)  - η a_1 s̃_t-τ (1) ,

where we assume without loss of generality a_1≥ a_2 ≥…≥ a_N. This is true since the dynamics for i=1 is the first one that loses stability.

To simplify notations we define x_t = s̃_t (1) and the sharpness term a = a_1 = λ_max(H) 

, the maximal singular value of H. Using these notations, we can re-write eq. <ref> as:

    x_t+1    = x_t -η  a  x_t-τ⇔
     x_t+1 - x_t + η a  x_t-τ = 0
     .


Since this is a linear time invariant difference equation, of order τ+1, its solution is, generically:

    x_t = ∑_i=1^τ+1c_i z_i^t ,

where c_i are determined by the initial conditions, and z_i are the roots of the characteristic equation of eq. <ref>. To find this characteristic equation, we substitute x_t=z^t into eq. <ref>, and obtain

    z^t+1-z^t+η a z^t-τ=0 ⇔
        z^τ+1-z^τ+η a=0

Note that for x_t→ 0, it is required that ∀ i, z_i<1. 
	
	

§ FINDING THE CONDITION FOR THE MAXIMAL ROOT OF THE CHARACTERISTIC EQUATION (EQ. <REF>) TO BE ON THE UNIT CIRCLE  

	To simplify the notation, we denote α = aη.
	Recall the characteristic eq. (eq. <ref>)
    
    z^τ+1-z^τ+α=0 .

    Since we are looking for solution on the unit circle we substitute z=e^iθ into the equation where i is the unit imaginary number and θ is some angle. We obtain:
    
    e^iθ(τ+1)-e^iθτ+α=0 .

    Using e^iθ = cos(θ) + i sin(θ) we get
    
    cos(θ(τ+1)) + isin(θ(τ+1))
            -( cos(θτ) + isin(θτ))+α=0 ⇒

    
    cos(θ(τ+1))
            -cos(θτ)
             +α=0
    sin(θ(τ+1))
            -sin(θτ)
             =0

    Using trigonometric product-sum identities we obtain
    
    -2sin(θ(2τ+1)/2)sin(θ/2) +α=0
    
             2cos(θ(2τ+1)/2)sin(θ/2) =0

    If sin(θ/2)=0 then we get from the first equation α = 0. This is a contradiction since we assume that α>0. Thus, sin(θ/2)≠0. This implies from the second equation in eq. <ref> that 
    cos(θ(2τ+1)/2)=0⇒θ(2τ+1)/2 = π/2+π k  , for  k=0,1,...,2τ .
 
    
    Substituting this result into the first equation in eq. <ref> and using α>0 we obtain that the possible solutions must satisfy
    
    α = 2 sin( (1+4k)π/4τ+2)  , for  k=0,1,...,τ .


    Also, since sin(x)=sin(π-x) we can eliminate symmetric solution and get
    
    α = 2 sin( (1+4k)π/4τ+2)  , for  k=0,1,...,τ+1/2 .

    Note that for k=0,1,...,τ+1/2: 0<(1+4k)π/4τ+2<π/2 and thus sin( (1+4k)π/4τ+2)>0 is monotonically increasing with k. Since the magnitude of the characteristic equation increases with α and we are interested in the maximal root we are looking for the minimal α value. This value corresponds to k=0. Thus, the maximal root satisfies:
    
    α = sin( π/4τ+2) .

    
    
	

§ FINDING THE CONDITION FOR THE SOLUTION OF THE CHARACTERISTIC EQUATION IN EQ. <REF> TO BE ON THE UNIT CIRCLE 

	Recall the characteristic equation (eq. <ref>)
    
    z^τ+1-(1+m)z^τ+mz^τ-1+(1-m)α=0 .

    Since we are looking for solution on the unit circle we substitute z=e^iθ into the equation where i is the unit imaginary number and θ is some angle. We obtain:
    
    e^iθ(τ+1)-(1+m)e^iθτ+m e^iθ(τ-1)+(1-m)α=0 .

    Using e^iθ = cos(θ) + i sin(θ) we get
    
    cos(θ(τ+1)) + isin(θ(τ+1))
            -(1+m)( cos(θτ) + isin(θτ))
        +m ( cos(θ(τ-1)) + isin(θ(τ-1)))+(1-m)α=0 ⇒

    
    cos(θ(τ+1))
            -(1+m)cos(θτ)
             +m cos(θ(τ-1))+(1-m)α=0
    sin(θ(τ+1))
            -(1+m)sin(θτ)
             +m sin(θ(τ-1))=0

    Using trigonometric product-sum identities we obtain
    
    -2sin(θ(2τ+1)/2)sin(θ/2) 
                - m · (-2) sin(θ(2τ-1)/2)sin(θ/2) 
            +(1-m)α=0
    
             2cos(θ(2τ+1)/2)sin(θ/2) - m· 2cos(θ(2τ-1)/2)sin(θ/2)=0

    If sin(θ/2)=0 then we get from the first equation (1-m)α = 0. This is a contradiction since we assume α>0,m<1. Thus, sin(θ/2)≠0⇒θ≠ 2π k for k some integer number.

    
    

§ STABILITY ANALYSIS FOR EQ. <REF> WITH STOCHASTIC DELAY
 
    We assume that τ(t) is drawn from some distribution.
	In this section, we would like to analyze the stability of eq. <ref>. In particular, we would like to examine if a given minimum point x^* is stable. To analyze this we suppose we are in a vicinity of some minimum point x^*, which implies ∇ f(x^*)=0, and ask whether or not we can converge to x^* using the theory of dynamical stability.
	Formally, consider the linearized dynamics around x^*:

    x_t+1    =x_t
    -η( G(x^*;n_t-τ(t)) + ∇ G(x^*;n_t-τ(t))(x_t-τ(t)-x^*) ) ,

where we denoted G(x_t;n_t)=∇ f_n_t(x_t) and changed the notation of the time index in n(t) to the subscript, n_t.

Examining the expectation of this equation we obtain

    x_t+1   (1)=x_t -η( 1/N G(x^*;i) + 1/N∇ G(x^*;i)(∑_kx_t-k(τ(t)=k)-x^*) )
       (2)=x_t -ηH∑_k(τ(t)=k)(x_t-k-x^*) ,

where in (1) we used ∀ t and ∀ k = 1,...,N: (n_t=k)=1/N, and in (2) we used the fact that x^* is a minimum point and thus G(x^*;i)=∇ f(x^*)=0 and denoted H = 1/N∇ G(x^*;i)=1/N∇^2 f_i(x^*) .

Using s_t= x_t - x^* variable change we obtain

    s_t+1 = s_t  - ηH∑_k (τ(t)=k)s_t-k .

From the Spectral Factorization Theorem we can write H = UAU^⊤ where U is an orthogonal matrix and A=(a_1,...,a_n) is a diagonal matrix. Substituting this into eq. <ref> we obtain:

    s_t+1 = s_t - ηUA∑_k(τ(t)=k)U^⊤s_t-k .

Multiplying the last equation with U^⊤ from the left, denoting s̃_t = U^⊤s_t, and using the fact that U is an orthogonal matrix, U^⊤U=I we get:

    s̃_t+1 = s̃_t  - ηA∑_k(τ(t)=k)s̃_t-k .

Recall that A=(a_1,...,a_N) is a diagonal matrix. Therefore, analyzing the dynamics of the last equation is equivalent to analyzing the dynamics of the following N one-dimensional equations: 

    ∀ i = 1,...N  : s̃_t+1(i) = s̃_t (i)  - η a_i ∑_k(τ(t)=k)s̃_t-k (i) ,

where s_t(i) denotes the i^th component of the vector s_t.

In order to ensure stability of the N-dimensional dynamical system, it's sufficient to require that

    s̃_t+1(1) = s̃_t (1)  - η a_1 ∑_k(τ(t)=k)s̃_t-k (1) ,

where we assume without loss of generality a_1≥ a_2 ≥…≥ a_N. This is true since the dynamics for i=1 is the first one that loses stability.

To simplify notations we define x_t = s̃_t (1) and the sharpness term a = a_1 = λ_max(H) 

, the maximal singular value of H. Using these notations, we can re-write eq. <ref> as:

    x_t+1    = x_t -η  a ∑_k(τ(t)=k) x_t-k⇔
     x_t+1 - x_t + η a ∑_k(τ(t)=k) x_t-k = 0
     .


The characteristic equation of eq. <ref> is

    z - 1 + η a ∑_k(τ(t)=k) z^-k = 0




 §.§ Stabiliy Analysis

We would like to find conditions on when and how
can we change the hyperparameters (η,𝔼τ) to
maintain the same stability criterion (definition <ref>). 
In order to analyze stability we examine the characteristic equation in eq. <ref> and ask: when does the maximal root of this polynomial have unit magnitude?

    
  * τ∼{a,b}:
    
    z - 1 + η a ∑_k=a^b 1/n z^-k = 0

    
    
    
  * τ∼(λ):
    
    z - 1 + η a ∑_k=0^∞exp(-λ)λ^k/k! z^-k   = 0 ⇒
    
            z - 1 + η a exp(-λ) ∑_k=0^∞(λ/z)^k/k!   = 0 ⇒
    
            z - 1 + η a exp(-λ) exp( λ/z)    = 0 ⇒
    
            z - 1 + η a exp(λ(1/z - 1))    = 0

    
    
  * Gaussian distribution discrete approximation: ∀μ, ∀ k=1,...,2μ: (τ=k) = (k-0.5≤z≤ k+0.5) where z∼ℕ(μ,1):
    
    
    
  * τ∼_0(p):
    
    z - 1 + η a ∑_k=0^∞ p(1-p)^k z^-k   = 0 ⇒
    
            z - 1 + η a p ∑_k=0^∞(1-p/z)^k    = 0

    If z>1-p (this includes the unit circle) we obtain:
    
    z - 1 + η a p 1/1-1-p/z   = 0 ⇒
    
            z - 1 + η a p z/z-1+p   = 0 ⇒
    
            z^2  +z(η a p+p-2)+1-p    = 0 ⇒


    

    

    
    
    
    
    
    
    
    
    
    
    
    
     
    
    
    
    
    
    
    
        
    
    
    
    
    

§ THEORETICAL ANALYSIS WITH MOMENTUM

    In this section, we repeat the steps of the analysis in section <ref> for A-SGD with momentum.


 §.§ Preliminaries and Problem Setup
 
Consider the problem of minimizing the empirical loss 

    f(x) =  f_i(x) ,

where N is the number of samples, x∈^d and ∀ i=1,...,N: f_i: ^d→ is twice continuously differentiable function. The update rule for minimizing f(x) in eq. <ref> using asynchronous stochastic gradient descent with momentum (A-MSGD) is given by

    v_t+1    =m v_t-η(1-m)G(x_t-τ;n_t-τ)
    x_t+1    = x_t+v_t+1

or

    x_t+1    = x_t+m(x_t - x_t-1)-η(1-m)G(x_t-τ;n_t-τ) ,

where m is the momentum, η is the learning rate, G(x_t;n_t)=∇ f_n_t(x_t), n_t is a random selection process of
a sample from { 1,2,…,N} at iteration t, and
τ is some delay due the asynchronous nature of our training.

Our main goal is understanding how different factors such as the gradient staleness τ, and hyperparameters such as the momentum m and learning rate η affect the minima selection process in neural networks. In other words, we would like to understand how the different hyperparameters interact to divide the global minima of our network to two sets: those we can converge to and those we cannot converge to.

To analyze this we suppose we are in a vicinity of a minimum point x^*, which implies ∇ f(x^*)=0,

and ask whether or not we can converge to x^* using the theory of dynamical stability. Formally, consider the linearized dynamics around some minimum point x^*:

    x_t+1    =x_t+m(x_t - x_t-1)-η(1-m)( G(x^*;n_t-τ) + ∇ G(x^*;n_t-τ)(x_t-τ-x^*) ) .

Examining the first moment of this equation we obtain

    x_t+1    = x_t+m(x_t - x_t-1)-η(1-m)( 1/N G(x^*;i) + 1/N∇ G(x^*;i)(x_t-τ-x^*) )
        = x_t+m(x_t - x_t-1)-η(1-m) H(x_t-τ-x^*) ,

where 1/N G(x^*;i)=1/N∇ f(x^*)=0 since x^* is a minimum point and H = 1/N∇ G(x^*;i)=1/N∇^2 f_i(x^*) .



    x^* is a fixed point of the stochastic dynamics described in eq. <ref>, if for any n, we have G(x^*,n)=0.

need to say that fixed points don't always exist but in our setting of over-parametrization (which also should be motioned) they do exist and all global minima are fixed points.

Our main goal is understanding how different factors such as gradient staleness and hyperparameters such as the momentum and learning rate affect the minima selection process in neural networks. In other words, we would like to understand how the different hyperparameters interact to divide the global minima of our network to two sets: those we can converge to and those we cannot converge to.

To analyze this we suppose we are in a vicinity of a global minimum,
so f can be approximated using a quadratic form, and ask whether or
not we can converge to x^* using the theory of dynamical stability. Formally, let x^* be some fixed point and consider the quadratic approximation of f near x^*: 

    f(x) ≈1/2N(x - x^*)^⊤H_i (x - x^*) ,
 where H_i = ∇^2 f_i(x^*) and we assumed f(x^*)=0. The corresponding linearized the acronym for ASGD with momentum (eq. <ref>) is given by


    x_t+1    =x_t+m(x_t-x_t-1)-η(1-m)H_n_t-τ(x_t-τ-x^*) .


Using s_t= x_t - x^* variable change we obtain

    s_t+1 = s_t +m(s_t-s_t-1) - η(1-m) Hs_t-τ .

    
From the Spectral Factorization Theorem we can write H = UDU^⊤ where U is an orthogonal matrix and A=(a_1,...,a_n) is a diagonal matrix. Substituting this into eq. <ref> we obtain:

    s_t+1 = s_t +m(s_t-s_t-1) - η(1-m) UAU^⊤s_t-τ .

Multiplying the last equation with U^⊤ from the left, denoting s̃_t = U^⊤s_t, and using the fact that U is an orthogonal matrix, U^⊤U=I we get:

    s̃_t+1 = s̃_t + m( s̃_t - s̃_t-1) - η(1-m)As̃_t-τ .

Recall that A=(a_1,...,a_N) is a diagonal matrix. Therefore, analyzing the dynamics of the last equation is equivalent to analyzing the dynamics of the following N one-dimensional equations: 

    ∀ i = 1,...N  : s̃_t+1(i) = s̃_t (i) + m( s̃_t (i) - s̃_t-1 (i)) - η(1-m)a_i s̃_t-τ (i) ,

where s_t(i) denotes the i^th component of the vector s_t.

In order to ensure stability of the N-dimensional dynamical system, it's sufficient to require that

    s̃_t+1(1) = s̃_t (1) + m( s̃_t (1) - s̃_t-1 (1)) - η(1-m)a_1 s̃_t-τ (1) ,

where we assume without loss of generality a_1≥ a_2 ≥…≥ a_N. This is true since the dynamics for a_1 is the first one that loses stability.

To simplify notations we define x_t = s̃_t (1) and the sharpness term a = a_1 = λ_max(H), the maximal singular value of H. Using these notations, we can re-write eq. <ref> as:

    x_t+1    = x_t+m( x_t -  x_t-1)-η(1-m) a  x_t-τ⇔
    
     x_t+1    - (m+1) x_t+m  x_t-1 + η(1-m) a  x_t-τ = 0
     .

The characteristic equation of this difference equation is

We use a Z-transform <cit.> to obtain the characteristic equation of eq. <ref>.

    The Z-transform of a discrete-time signal x_t is defined as the power series X(z) = ∑_t=-∞^∞ x_tz^-t, where z∈ℂ.

The characteristic equation ismight not be clear to the reader what characteristic equation is and how is this related to z transform. Explain.:


    z-(1+m)+mz^-1+η(1-m)a z^-τ=0

or


    z^τ+1-(1+m)z^τ+mz^τ-1+η(1-m)a=0 .




 §.§ Stability Analysis
  
We would like to find conditions on when and how
can we change the hyperparameters (m,η,τ) to
maintain the same stability criterion (definition <ref>). 
In order to analyze stability we examine the characteristic equation in eq. <ref> and ask: when does the maximal root of this polynomial have unit magnitude? 


  §.§.§ The Interaction Between Learning Rate, Delay, and Momentum
 
For the general case and different values of momentum, we evaluate numerically the value of 1/aτ for which the maximal root of the general characteristic equation (eq. <ref>) is on the unit circle, when we are on the threshold of stability. We show the results in Fig. <ref>. We observe that there is still an inverse relation between the learning rate and delay when using momentum. Specifically, we observe that:

    
  * We need to decrease the learning rate as the delay increases.
    
  * The lines becomes more steep for larger values of momentum. This implies that, for a given delay, maintaining stability for larger values of momentum requires smaller learning rate. Therefore, it is easier to maintain stability with m=0. 





 §.§ Shifted momentum

In this section, we repeat the steps of the analysis in section <ref> for A-SGD with shifted momentum.
The update rule for minimizing f(x) in eq. <ref> using asynchronous stochastic gradient descent with shifted momentum is given by

    v_t+1    =m v_t-τ-η(1-m)∇ f_n(t-τ)(x_t-τ)
    x_t+1    = x_t+v_t+1

or

    x_t+1    = x_t+m v_t-τ-η(1-m)∇ f_n(t-τ)(x_t-τ) 
        = x_t+m (x_t-τ - x_t-τ-1) -η(1-m)∇ f_n(t-τ)(x_t-τ)

Following the same steps as in section <ref> we obtain the following one-dimensional equation:

    x_t+1    = x_t+m( x_t-τ -  x_t-τ-1)-η(1-m) a  x_t-τ⇔
    
     x_t+1    - x_t + (η(1-m)a-m) x_t-τ + m x_t-τ-1 = 0
     .

The last equation characteristic equation is:

    z^τ+2    - z^τ+1 + (η(1-m)a-m) z + m = 0
     .





§ EXPERIMENTS DETAILS
 
We experimented with a set of popular classification tasks: MNIST <cit.>, CIFAR10, CIFAR100 <cit.> and ImageNet <cit.>. In order to incorporate delay in the experiments, we keep replicas of the model parameters and perform SGD step with different replica at a time according to a round robin scheduling. The implementation is done with PyTorch framework. Section <ref> in the appendix shows that constant delay, round robin, acts similarly in terms of stability to several other delay distributions. In addition, <cit.> shows empirically with realistic distribution that constant delay distribution is a good model for delay distribution. Fig. <ref> shows empirically that round robin scheduling works in a similar way to discrete Gaussian distribtion.


Although stochastic gradient descent with momentum was originally introduced with the dampening term, many drop the latter when using momentum SGD. This is true for most DNN frameworks like Caffe, PyTorch, and TensorFlow where the dampening term is set to zero by default. As  <cit.> pointed out, without dampening, the momentum scales the learning rate so that the effective learning rate η_eff is equal to η_eff=η/1-m after sufficiently many iterations T (i.e., when T→∞). Because we alter the momentum value in our experiments, we use dampening and scale the learning rate accordingly to keep the effective learning rate the same as without dampening.



 §.§ ImageNet Optimization Details
 
Our baseline is <cit.> large batch training. They trained ResNet50 for 90 epochs with a large batch of 8192 samples and reached the same accuracy level of 23.8% as the small batch training. They used linear scaling with the batch size (scaling the learning rate by the large batch size divided by the baseline batch size) and a warm-up of the learning rate at the first 5 epochs. We use 32 workers, each with a minibatch size of 256. 




§ MINIMA STABILITY EXPERIMENTS
 
    In this section, we provide additional details about the minima stability experiment presented in section <ref>. As discussed in section <ref>, we are interested to examine for which pairs of (τ,η) the minima stability remains the same. 
    
    






    
    In Fig. <ref> we show the validation error of such (τ,η) pairs as a function of epochs. We note that these graphs are the same experiment as in Fig. <ref>. As can be seen, for larger learning rates, it takes less epochs to leave the minimum. It is interesting to see that after leaving the minimum, the A-SGD algorithm converges again to a minimum with generalization as good as the baseline (at τ=0). This suggests that the minima selection process of A-SGD is affected by the whole optimization path. In other words, suppose we start the optimization from a minimum with good generalization  (since it was selected using optimization with τ=0), and then it becomes unstable due to a change in the values of (η,τ), as in this experiment. These results in Fig. <ref> suggest we typically converge to a stable minimum with similar generalization properties, possibly nearby the original minimum. In contrast, if we start to train from scratch using the same (η,τ) pair which lost stability in our experiment, we typically get a generalization gap (as observed in our experiments), which suggests the optimization path might have taken a very different path from the start, leading to other regions with worse generalization than the original minimum.
    
    



§ ADDITIONAL EXPERIMENTS

    We examine what generalization performance we can expect during training, before reaching a minimum. We do so by using the same experiment in Fig. <ref>. We sample the validation error of each learning rate at different epochs. Results are presented in Fig. <ref>. Using our suggested learning rate modification (dividing the baseline large batch learning rate by the delay) gives the near optimal learning rate that can be seen in the figure. 
    
    
