Year: 2020

Abstract:
Cloud computing is becoming increasingly popular as a platform for distributed training of deep neural networks. Synchronous stochastic gradient descent (SSGD) suffers from substantial slowdowns due to stragglers if the environment is nondedicated, as is common in cloud computing. Asynchronous SGD (ASGD) methods are immune to these slowdowns but are scarcely used due to gradient staleness, which encumbers the convergence process. Recent techniques have had limited success mitigating the gradient staleness when scaling up to many workers (computing nodes). In this paper we define the Gap as a measure of gradient staleness and propose Gap-Aware (GA), a novel asynchronous-distributed method that penalizes stale gradients linearly to the Gap and performs well even when scaling to large numbers of workers. Our evaluation on the CIFAR, ImageNet, and WikiText-103 datasets shows that GA outperforms the currently acceptable gradient penalization method, in final test accuracy. We also provide convergence rate proof for GA. Despite prior beliefs, we show that if GA is applied, momentum becomes beneficial in asynchronous environments, even when the number of workers scales up.

heading: 1 INTRODUCTION
text: The steady growth of deep neural networks over the years has made it impractical to train them from scratch on a single worker (i.e., computational device). Distributing the computations over several workers can drastically reduce the training time. However, due to the sequential nature of the widely used stochastic gradient descent (SGD) method, distributing the process is not an easy task.
Synchronous SGD (SSGD) is the most common method used to distribute the learning process across multiple workers. Several recent works (Mikami et al., 2018; Ying et al., 2018; Yamazaki et al., 2019; Goyal et al., 2017) have shown that SSGD can achieve large speedups while maintaining high accuracy. The major drawback of SSGD is that its speed is confined to the slowest worker in every iteration. This shortcoming is magnified in non-dedicated1 environments such as cloud computing. For this reason, all the above mentioned works were forced to use homogeneous workers in a dedicated network, which serves to reduce the variance in the workers’ iteration times. Unlike cloud computing, dedicated networks are expensive and therefore not available to most users.
In asynchronous SGD (ASGD), each worker communicates independently of the others, thereby addressing the major drawback of SSGD. ASGD enjoys linear speedup in terms of the number of workers, even on non-dedicated networks. This makes ASGD a potentially better alternative to SSGD when using cloud computing. Unfortunately, ASGD also has a significant weakness known as gradient staleness; the gradients used to update the parameter server’s (master) parameters are
∗Equal contribution. 1An environment of computation nodes who are not specifically optimized to work together
often based on older parameters and therefore are inaccurate. Prior works have shown that gradient staleness severely hinders the convergence process by reaching reduced final accuracy (Chen et al., 2016; Cui et al., 2016). Mitliagkas et al. (2016) showed that gradient staleness also induces implicit momentum, thus the momentum coefficient γ must be decayed when scaling up the number of workers. Most research works measure the gradient staleness of a worker according to the delay: the number of master updates since the worker began calculating the stochastic gradient g, until g is used to update the master. To overcome gradient staleness, Zhang et al. (2015b) proposed Staleness-Aware (SA), which penalizes the step size of stale gradients linearly to their delay. This method was later embraced by other works (Jiang et al., 2017; Hardy et al., 2017; Giladi et al., 2019) and is currently the common method for penalizing stale gradients. Unfortunately, this method suffers from a degradation of the final accuracy, especially when scaling up the number of workers. In Section 4.1, we show that the main reason for this degradation is the over-penalization and under-penalization caused by SA.
SSGD and ASGD rely on hyperparameter tuning for every different number of workers (Shallue et al., 2018). Tuning is extremely time-consuming, thus avoiding it is beneficial, whenever possible.
Our contribution: To mitigate gradient staleness while minimizing the degradation of final accuracy, we define a measure of gradient staleness we refer to as the Gap. The Gap is based on the difference between the parameters used to calculate the gradient and the parameters on which the gradient is applied. We propose a new method called Gap-Aware (GA) that penalizes the step size of stale gradients linearly to their Gap, while eliminating the over-penalization or under-penalization of SA. No new hyperparameters are introduced using the GA method.
• We show that GA out-performs SA, especially as the number of workers scales up. • We prove that the convergence rate of the GA-ASGD algorithm with a non-convex loss function is consistent with SGD: O (
1√ BK
) where K is the total number of steps and B is the batch size.
• We show that penalizing the gradient itself rather than the step-size, eliminates under-penalization. • Our results suggest that GA can be used without re-tuning the hyperparameters. • As opposed to conclusions by Mitliagkas et al. (2016), we show that applying momentum in an
asynchronous environment is advantageous (using GA), even when multiple workers are used. • We combine GA with Adam (Kingma & Ba, 2015) (Adam-GA), and show that Adam-GA achieves
almost two orders of magnitude better perplexity than Adam or Adam-SA (which combines Adam with SA) using several workers on the Transformers-XL model.
Our results establish GA as a superior gradient-penalizing option to SA and suggest that using GA is a preferable alternative to SSGD in non-dedicated networks such as cloud computing, even when scaling to large numbers of workers. To validate our claims, we performed experiments on the CIFAR10, CIFAR100 (Krizhevsky, 2012), ImageNet (Russakovsky et al., 2015), and WikiText-103 (Merity et al., 2016) datasets, using several state-of-the-art architectures. A version of GA has reached 72.18% final test accuracy on the ImageNet dataset using 128 simulated asynchronous workers. As far as we know, this is the largest number of asynchronous workers reported to converge on ImageNet.

heading: 2 RELATED WORK
text: Eliminating gradient staleness is a challenging task and several papers suggested techniques to reduce its detrimental effects. Zheng et al. (2017) proposed DC-ASGD, which uses a Taylor expansion to mitigate the gradient staleness. EASGD (Zhang et al., 2015a) uses a center force to pull the workers’ parameters toward the master’s parameters. Both DC-ASGD and EASGD achieve high accuracy on small numbers of workers, but fall short when trained on large clusters. Chan & Lane (2014) proposed penalizing stale gradients by reducing their size and thus limiting their effect on the learning process. They suggest decaying the learning rate exponentially to the delay; this makes the step size arbitrarily small when the amount of workers grows, virtually ceasing the learning process. As part of their convergence analysis, Dutta et al. (2018) suggest a penalizing method that is linear to the norm between the master and worker’s parameters. However, their method introduces another hyperparameter, which requires additional time to tune. As opposed to other methods, GA performs well even when the number of workers is large, without introducing new hyperparameters.
Gupta et al. (2016) as well as Aji & Heafield (2019) suggest collecting several gradients before updating the master to reduce the effects of gradient staleness. Wen et al. (2017) propose minimizing the size of the gradients to reduce communication times. GA is orthogonal to both of these approaches.

heading: 3 BACKGROUND
text: The goal of an optimization procedure is to minimize f(θ), where f is a smooth, but not necessarily convex, objective function (a.k.a. loss) and the vector θ ∈ Rd is the model’s parameters:
θ∗ = arg min θ∈Rd
f(θ) := Eξ[F (θ; ξ)] (1)
where ξ ∈ Ξ is a random variable from Ξ, the entire set of training samples Ξ = {1, 2, · · · ,M}. F (θ; ξ) is the stochastic loss function with respect to the training sample indexed by ξ. SGD is commonly the workhorse behind the optimization of deep neural networks. Denoting η as the learning rate and k as the step number, SGD’s iterative update rule is: θk+1 = θk − ηk∇f(θk). We denote Xk as the variable X at the kth step, where X is any variable.
Momentum Momentum (Polyak, 1964) is a widely adopted optimization technique due to its accelerated convergence and oscillation reduction (Sutskever et al., 2013). Instead of simply using the gradient, the momentum iterative update rule2 uses an exponentially-weighted moving average of gradients called the update vector: vk+1 = γvk +∇f(θk). The update rule is: θk+1 = θk − ηkvk+1. Nesterov’s Accelerated Gradient (NAG) (Nesterov, 1983) is a well-used variation of momentum that has been proven to achieve quadratic speedup in convergence rate compared to SGD.

heading: 4 ASYNCHRONOUS SGD (ASGD)
text: We consider the commonly used ASGD, which operates with a parameter-server (master), used to keep the model’s most up-to-date parameters. Each worker maintains a replica of the model’s parameters. The workers run in parallel and synchronize with the master independently from each other at the beginning of each batch iteration. We denote τk as the delay at the kth step. The worker and master algorithms are given by Algorithm 1 and 2, respectively, where B is the batch-size and ξk,b denotes the bth sample in the batch sampled at the kth iteration. Gradient staleness appears when a gradient gk is computed on parameters θk−τk but applied to different parameters θk.
Algorithm 1 Momentum-ASGD: worker i Always do:
Receive parameters θk−τk from the master Get B training samples ξk−τk,[1...B] Compute gradient: gik ← ∑B b=1 ∇F (θk−τk ;ξk−τk,b) B Send gik to the master
Algorithm 2 Momentum-ASGD: master For k = 1...K do:
Receive gradient gik from worker i Update momentum vk+1 ← γvk + gik Update master’s weights: θk+1 ← θk − ηk · vk+1 Send θk+1 to worker i

heading: 4.1 STALENESS-AWARE
text: Zhang et al. (2015b) proposed a gradient penalization method called Staleness-Aware (SA). SA aims to reduce the effects of gradient staleness by dividing the step size by its corresponding τ (Algorithm 3). The worker algorithm remains unchanged. The two ideas behind SA is that stale gradients should be penalized to reduce their impact and that gradient staleness scales up with τ . SA successfully mitigates the gradient staleness when N is small. Although commonly used, SA can potentially over-penalize as well as under-penalize stale gradients as we show below.
2We consider the version of momentum without dampening
Algorithm 3 Staleness-Aware: master Initialize an iteration array: iter = [0] ∗N For k = 1...K do:
Receive gradient gik from worker i Calculate worker i’s delay τk ← k − iter[i] Update momentum vk+1 ← γvk + gik Update master θk+1 ← θk − ηkτk vk+1 Send θk+1 to worker i Save current iteration iter[i]← k
Algorithm 4 Gap-Aware: master For k = 1...K do:
Receive gradient gik from worker i Calculate Gap: Gk = |θk−θk−τk | C + 1 d
Update momentum vk+1 ← γvk + (
1 Gk ) gik
Update master θk+1 ← θk − ηkvk+1 Save and send current parameters θk+1 to worker i
Over-Penalizing Let us assume that at some step k, after τ master updates we get θk = θk−τ just as the gradient calculated on θk−τ is applied. This means there is no gradient staleness for the next gradient update since it was computed using the same parameters on which it is applied. Unfortunately, the delay remains τ > 0, thereby causing over-penalization when SA is used.
Additionally, τ scales linearly with N , which dramatically reduces η when N is large. Consequently, on large numbers of workers, the convergence rate of SA is sluggish and its accuracy plummets.
Under-Penalizing The SA method doesn’t take into account that when using momentum, the update step also contains past gradients. To emphasize the importance of this issue, let’s examine a fictional example: assume that some gradient gk is very stale (τk is large). Following the SA technique, the update rule is: θk+1 = θk − ηkτk · vk+1 = θk − ηk τk · (γvk + gk). This means the stale gradient gk is indeed penalized by being multiplied by ηkτk , which is small; thus gk doesn’t change the parameters much. We further assume the next iteration is very fast (τk+1 is small). The next update will be: θk+2 = θk+1 − ηk+1τk+1 · (γ 2vk + γgk + gk+1). The stale gradient gk is multiplied by γ ηk+1 τk+1
, which is large (assuming ηk ≈ ηk+1). Despite the fact that gk was stale, it still has a significant impact on the learning process. In other words, gk is under-penalized.
To eliminate this possibility we penalize the stale gradient itself rather than the learning rate. Using this method, the staleness of each gradient is accounted for within the update vector v.

heading: 5 GAP-AWARE (GA)
text: In this section we propose a new method called Gap-Aware to mitigate over and under-penalization.

heading: 5.1 THE GAP AS A MEASURE OF GRADIENT STALENESS
text: An intuitive method to measure gradient staleness would be: ‖∇f(θk)−∇f(θk−τk)‖. This essentially measures the difference between the stale gradient and the accurate gradient that is computed on the up-to-date parameters. (Of course, ∇f(θk) is never calculated in ASGD algorithms.) Commonly used in deep learning is the Lipschitzian gradients assumption:
‖∇f (x)−∇f (y)‖ ≤ L‖x− y‖, ∀x,∀y, L ∈ R (2) Setting x = θk, y = θk−τk into Equation 2 we get: ‖∇f (θk) − ∇f (θk−τk)‖ ≤ L‖θk − θk−τk‖. This implies that ‖θk − θk−τk‖ is a valid (and easily calculated) measure of the gradient staleness. This measure also addresses the delay’s over-penalization; using the same simple example described in Section 4.1, the term ‖θk − θk−τk‖ will now be zero, correctly measuring the gradient staleness. The learning rate η, commonly decays as the training progresses. This decay can be viewed as a built-in penalization to reduce variance. Following this notion, we suggest reducing the staleness penalization as η decays. To accommodate all the attributes above, we define the Gap: Definition 1. Gk, the Gap at the kth step, is defined as the minimal number of updates required to traverse the current distance between the master’s and worker’s parameters using the maximal learning rate and assuming all gradients have an average norm. Gk ∈ R is defined as:
Gk = ‖θk − θk−τk‖/C + 1 Where C = ηmaxEk[‖∇f(θk−τk)‖] is a constant representing the maximal distance the parameters can travel in a single update, given the gradient’s norm is the average gradient norm.
Definition 1 means that dividing η by the Gap produces larger steps than those produced by SA This allows exploring more distant minimas while still mitigating the gradient staleness. Note that E[Gk] = τk occurs only if all previous τk updates were in the exact same direction, which rarely happens. Empirically, we found that E[Gk] < τk (See Appendix C.8).
To mitigate the gradient staleness, while eliminating the over-penalization and under-penalization, we divide the gradients themselves by their respective Gap. We refer to this method as Gap-Aware (GA).

heading: 5.2 CONVERGENCE ANALYSIS
text: In this section we provide the outlines of the convergence analysis. The complete proofs are given in Appendix B. The GA-ASGD update rule (without momentum) is:
θk+1 = θk − ηk ( 1
Gk ) · B∑ b=1 ∇F (θk−τk ; ξk−τk,b) (3)
The convergence rate is the speed (or number of steps) at which a convergent sequence approaches its limit. We follow ideas similar to Lian et al. (2015) to show that the upper bound of the convergence rate of GA on a non-convex loss function is similar to that of SGD. Assumption 1. We assume the following, commonly-used assumptions, hold:
• Unbiased gradient: The stochastic gradient∇F (θ; ξ) is unbiased: ∇f(θ) = Eξ[∇F (θ; ξ)] (4)
• Bounded variance: The variance of the stochastic gradient is bounded: Eξ[‖∇F (θ; ξ)−∇f(θ)‖2] ≤ σ2, ∀θ (5)
• Lipschitzian gradients: See Equation 2.
• Independence: All the random variables {ξk,b}k=1...K;b=1...B , are independent.
• Bounded age: All delay variables τ1, ...τK are bounded: max k τk ≤ T (6)
Theorem 1. Assume that Assumption 1 holds and the learning rate sequence {ηk}k=1···K satisfies:
BLηk Gk + 2B2L2T T∑ t=1 η2k+t G2k+t ≤ 1 for all k = 1, 2, ... (7)
We have the following ergodic convergence rate for the iteration of GA-ASGD:
1∑K k=1 ηk Gk K∑ k=1 ηk Gk E(‖∇f(θk)‖2) ≤ 2(f(θ1)−f(θ∗))
B + ∑K k=1 ( ηk Gk + 2BL ∑k−1 j=k−T η2j G2j ) ηkLσ 2
Gk∑K k=1 ηk Gk
(8) Where E[·] denotes taking expectation in terms of all random variables.
To simplify the upper bound in Theorem 1, we observed that setting the learning rate ηk such that the expression ηkGk is a constant value across all k obtains the following convergence rate: Corollary 1. Assume that Assumption 1 holds and that ηk are set such that ηkGk is constant for any k as follows:
ηk Gk := η = √ f(θ1)− f(θ∗) BLKσ2 , ∀k ∈ [1, . . . ,K] (9)

heading: If the maximal delay parameter T satisfies:
text: K ≥ 4BL(T + 1) 2(f(θ1)− f(θ∗)) σ2
(10)
then the output of GA satisfies the following ergodic convergence rate:
min k∈{1,··· ,K}
E[‖∇f(θk)‖2] ≤ 1
K K∑ k=1 E[‖∇f(θk)‖2] ≤ 4 √ (f(θ1)− f(θ∗))Lσ2 BK
(11)
Corollary 1 claims that if the total iterations K is greater thanO(BT 2), the convergence rate achieves O(1/ √ BK), which is consistent with the convergence rate of ASGD presented in Lian et al. (2015), and with the convergence rate of SGD.

heading: 5.3 GAP-AWARE VERSIONS
text: We explore three ways to measure Gk:
• Global: Gk ∈ R as defined in Definition 1. • Layer-wise: Every layer is penalized differently and independently. Gk ∈ RP where P is the
number of layers in the model. We denote 1S as an S-dimensional vector of ones. We denote any vector X∗,p is the pth layer in the vector X∗. Every element in Gk is calculated per-layer:
Gk,p = ‖θk,p − θk−τk,p‖/Cp + 1p (12)
• Parameter-wise: Every parameter (element in the parameter vector θ) is penalized differently and independently. Gk ∈ Rd where d is the number of parameters. We denote | · | on vector X , as the absolute value per element of X . Every element in Gk is calculated and applied per-element:
Gk = |θk − θk−τk |/C + 1d (13)
Where C ∈ Rd is also calculated element-wise. Specifically, C = ηmaxEk[|∇f(θk−τk)|]. We tested these variations on three different frameworks3 to determine which technique has the best performance. Figure 1 demonstrates that the parameter-wise method (equation 13) resulted in the best test and train error. Since this phenomenon repeats across all frameworks, we henceforth use the parameter-wise method in the Gap-Aware algorithm. We denote as an element-wise multiplication between vectors and describe the final GA algorithm of the master as Algorithm 4. The worker algorithm remains the same as in Algorithm 1.

heading: 6 EXPERIMENTS
text: We simulated multiple distributed workers4 to measure the final test error, train error, and convergence speed of different cluster sizes. To validate that penalizing linearly to the Gap is the factor that leads to better performance, we used the same hyperparameters across all the tested algorithms (see Appendix C.4). These hyperparameters are the ones tuned for a single worker, suggested by the authors of the respective papers for each framework. We simulated the workers’ execution time using a gamma-distributed model (Ali et al., 2000) (see Appendix C.3), where the execution time for each individual batch was drawn from a gamma distribution. The gamma distribution is a well-accepted model for task execution time, which naturally gives rise to stragglers. The importance of asynchronous over synchronous training is explained in Appendix D.
Combining GA with DANA One way to verify whether it is better to penalize using the Gap or the delay, is to change the Gap while fixing the delay, and examining the results using GA and SA. Momentum generally increases the norm of the update vector; this in turn, increases the effective step size thus increasing the Gap for a given delay. Hakimi et al. (2019) introduced DANA, which uses the
3A framework is a unique combination of dataset and model. See full experiment in Appendix C.9. 4A worker is a machine with one or more accelerators (i.e., GPU). ASGD methods treat each machine with
multiple accelerators, all working synchronously locally, as a single worker.
momentum to estimate the master’s parameters at the time of the gradient update, thus decreasing the Gap. The combination of decreasing the Gap using DANA and penalizing stale gradients using GA or SA is easily integrated since both methods are orthogonal. In our experiments, we also compared between DANA-Gap-Aware (DANA-GA) and DANA-Staleness-Aware (DANA-SA). We note that since DANA decreases the Gap, DANA-GA penalizes much less than DANA-SA (see Appendix C.8).
Algorithms Our evaluations consist of the following algorithms:
• Baseline: Single worker with the same tuned hyperparameters as in the respective framework’s paper. See Appendix C.4. • ASGD: ASGD (Algorithm 2) without momentum (γ = 0). • NAG-ASGD: ASGD with momentum (Algorithm 2) using a NAG optimizer. • Staleness-Aware: SA as described in Algorithm 3, using a NAG optimizer. • Gap-Aware: Parameter-wise GA (Algorithm 4) as described in Section 5, using a NAG optimizer. • DANA: DANA (Algorithm 6) as described in Appendix C.1. • DANA-SA: DANA-Staleness-Aware (Algorithm 7) as described in Appendix C.1. • DANA-GA: DANA-Gap-Aware (Algorithm 8) as described in Appendix C.1. • Adam: Adam (Algorithm 9) as described in Appendix C.1. • Adam-SA: Adam-Staleness-Aware (Algorithm 10) as described in Appendix C.1. • Adam-GA: Adam-Gap-Aware (Algorithm 11) as described in Appendix C.1. Our evaluation was extensive on image classification tasks such as CIFAR10, CIFAR100 (Krizhevsky, 2012), and ImageNet (Russakovsky et al., 2015). It also included a language modeling task using the WikiText-103 corpus (Merity et al., 2016). All datasets and models are detailed in Appendix C.2.

heading: 6.1 EVALUATION ON CIFAR
text: Gradient Staleness Effects In Figure 2, NAG-ASGD shows how gradient staleness is exacerbated by momentum. NAG-ASGD yields high accuracy with few workers, but the test error climbs sharply when more than 16 workers are used. On the other hand, ASGD without momentum performs poorly using few workers. When using many workers, ASGD significantly surpasses NAG-ASGD because of the implicit momentum generated in asynchronous training (Mitliagkas et al., 2016).
SA & GA Figure 2 also demonstrates that both staleness penalization methods (GA and SA) outperform the naive NAG-ASGD. GA results in better final test error than SA across all experiments. This empirically proves that GA is the better method for penalizing the gradients. We claim this occurs mainly because SA over-penalizes the gradients, thereby making it impossible to reach any distant, good minima when the number of steps is limited (for more details see Appendix C.8).
DANA Versions Figure 2 shows that DANA potentially diverges when N grows as opposed to DANA-GA and DANA-SA. This shows that DANA benefits from staleness penalization. Furthermore, DANA-GA out-performs all other methods and remains close to the baseline’s error across all frameworks. The fact that DANA-GA out-performs DANA-SA validates that GA is superior to SA.

heading: N ASGD NAG-ASGD SA GA DANA DANA-SA DANA-GA
text: Tuned ASGD To validate that the staleness penalization helps overcome the gradient staleness and improve the results, we tuned the momentum and learning rate of ASGD using 32 workers on the 3 frameworks shown in Figure 2. For each framework, we performed a grid search of 70 perturbations (See Appendix C.12). Table 1 shows that GA and DANA-GA, using the same hyperparameters as the baseline, provide similar or better results than tuning both γ and η, which is highly time-consuming.
According to Mitliagkas et al. (2016), if momentum is used, the asynchronous implicit momentum should impede the convergence as N increases. However, GA and DANA-GA, which use a large momentum, generally perform better than the tuned ASGD even when N is large. This phenomenon repeats across all frameworks, which suggests that GA, and especially DANA-GA, can mitigate the asynchronous implicit momentum problem. Tuning these methods should further improve the results.
The graphs of the train error also show the same concepts discussed here regarding the test error and are presented in Figure 6, Appendix C.10. The convergence rate analysis appears in Appendix C.11.

heading: 6.2 IMAGENET EXPERIMENTS
text: We conducted experiments on the ImageNet dataset using the ResNet-50 model (He et al., 2016). Every asynchronous worker is a machine with 8 GPUs, so the 128 workers in our experiments simulate a total of 1024 GPUs. For reference, Goyal et al. (2017) used 256 GPUs synchronously. The hyperparameters we used are those of the tuned single worker (see Appendix C.4). Table 3 shows that GA out-performs SA due to the high number of workers, which exacerbates the over-penalizing of SA. Unlike SA, GA out-performs NAG-ASGD as N increases due to successful staleness mitigation. DANA-GA remains close to the baseline and better than any other method asN increases. DANA-GA reaches 72.18% final test accuracy when using 128 workers, which is the most asynchronous workers shown to converge on ImageNet as far as we know.

heading: 6.3 NLP EXPERIMENTS
text: NLP tasks are usually trained using Adam (Kingma & Ba, 2015). To test SA and GA we implemented a version of Adam-SA and Adam-GA given by Algorithm 10 and 11, respectively (Appendix C.1). Transformer-XL (Dai et al., 2019) is a state-of-the-art model for NLP tasks; however, its sensitivity to gradient staleness is catastrophic (Aji & Heafield, 2019). Table 2 shows that GA successfully mitigates the gradient staleness and achieves near-baseline perplexity while SA results in a higher perplexity by almost two orders of magnitude. In this scenario, SA completely fails to mitigate the gradient staleness, proving the superiority of GA. (See hyperparameters in Appendix C.4).

heading: 7 CONCLUSIONS
text: The goal of this work is to mitigate gradient staleness, one of the main challenges of ASGD. We argue that penalizing stale gradients linearly to the delay, as done in the widely used SA method, flounders due to over and under-penalization. We defined the Gap to measure gradient staleness and proposed GA, a novel asynchronous distributed technique that mitigates the gradient staleness by penalizing stale gradients linearly to the Gap. We showed that GA surpasses SA across all frameworks, especially in NLP problems or when the number of workers is large. This presents GA as a superior alternative for staleness penalizing. We further introduced DANA-GA and demonstrated that DANA-GA mitigates gradient staleness better than any of the other methods we compared. Despite prior belief, DANA-GA’s superb performance enables the use of momentum in asynchronous environments with many workers; it presents a desirable alternative for parallel training with multiple workers, especially on non-dedicated environments such as cloud computing. In future work, we plan to examine what makes GA perform so well in NLP tasks.

heading: ACKNOWLEDGEMENT
text: This work was supported by The Hasso Plattner Institute.

heading: A SOURCE CODE
text: The source code of DANA-Gap-Aware is provided via: DOWNLOAD LINK

heading: B PROOFS

heading: Proof for Theorem 1
text: Proof. From the Lipschitzisan gradient assumption equation 2, we have
f(θk+1)− f(θk) ≤
≤〈∇f(θk), θk+1 − θk〉+ L
2 ‖θk+1 − θk‖2 =
=− 〈 ∇f(θk), ηk ( 1
Gk ) · B∑ b=1 ∇F (θk−τk ; ξk−τk,b) 〉 + η2kL 2G2k ∥∥∥∥∥ B∑ b=1 ∇F (θk−τk ; ξk−τk,b) ∥∥∥∥∥ 2
=− Bηk Gk
〈 ∇f(θk), 1
B B∑ b=1 ∇F (θk−τk ; ξk−τk,b)
〉 + η2kL
2G2k ∥∥∥∥∥ B∑ b=1 ∇F (θk−τk ; ξk−τk,b) ∥∥∥∥∥ 2 (14)
Taking expectation with respect to ξk,∗ on both sides of equation 14, we have
Eξk,∗ [f(θk+1)]− f(θk) ≤− Bηk Gk
〈 ∇f(θk), 1
B B∑ b=1 ∇f(θk−τk)
〉
+ η2kL
2G2k Eξk,∗ ∥∥∥∥∥ B∑ b=1 ∇F (θk−τk ; ξk−τk,b) ∥∥∥∥∥ 2  (15)
where we use the unbiased stochastic gradient assumption (equation 4).
From the fact that:
〈a, b〉 = 1 2
( ‖a‖2 + ‖b‖2 − ‖a− b‖2 ) we have
Eξk,∗ [f(θk+1)]− f(θk)
≤− Bηk 2Gk ‖∇f(θk)‖2 + ∥∥∥∥∥ 1B B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2 − ∥∥∥∥∥∇f(θk)− 1B B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2
︸ ︷︷ ︸ T1  + η2kL
2G2k Eξk,∗ ∥∥∥∥∥ B∑ b=1 ∇F (θk−τk ; ξk−τk,b) ∥∥∥∥∥ 2 
︸ ︷︷ ︸ T2
(16)
Next we estimate the upper bound of T1 and T2. For T2 we have
T2 =Eξk,∗ ∥∥∥∥∥ B∑ b=1 ∇F (θk−τk ; ξk−τk,b) ∥∥∥∥∥ 2 
=Eξk,∗ ∥∥∥∥∥ ( B∑ b=1 (∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk)) + B∑ b=1 ∇f(θk−τk) )∥∥∥∥∥ 2 
=Eξk,∗ [∥∥∥∥∥ B∑ b=1 (∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk)) ∥∥∥∥∥ 2 + ∥∥∥∥∥ B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2
+ 2 〈 B∑ b=1 (∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk)) , B∑ b=1 ∇f(θk−τk) 〉]
=Eξk,∗ ∥∥∥∥∥ B∑ b=1 (∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk)) ∥∥∥∥∥ 2 + ∥∥∥∥∥ B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2 
=Eξk,∗ ∥∥∥∥∥ B∑ b=1 (∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk)) ∥∥∥∥∥ 2 + ∥∥∥∥∥ B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2 
=Eξk,∗ [ B∑ b=1 ‖(∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk))‖ 2
+ 2 ∑
1≤b<b′≤B
〈∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk),∇F (θk−τk ; ξk−τk,b′)−∇f(θk−τk)〉
+ ∥∥∥∥∥ B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2 ]
≤Eξk,∗ [ B∑ b=1 ( ‖(∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk))‖ 2 ) + ∥∥∥∥∥ B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2 ]
≤Bσ2 + ∥∥∥∥∥ B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2
(17)
where the fifth equality is due to
Eξk,∗ 〈 B∑ b=1 (∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk)) , B∑ b=1 ∇f(θk−τk) 〉
= 〈 B∑ b=1 Eξk,∗ (∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk)) , B∑ b=1 ∇f(θk−τk) 〉 =0
and the last inequality is due to the bounded variance assumption equation 5 and due to:
Eξk,∗  ∑ 1≤b<b′≤B 〈∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk),∇F (θk−τk ; ξk−τk,b′)−∇f(θk−τk)〉  =Eξk,∗  ∑ 1≤b<b′≤B Ek−τk,b′ [〈∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk),∇F (θk−τk ; ξk−τk,b′)−∇f(θk−τk〉]
 =Eξk,∗  ∑ 1≤b<b′≤B 〈∇F (θk−τk ; ξk−τk,b)−∇f(θk−τk),Ek−τk,b′ [∇F (θk−τk ; ξk−τk,b′)−∇f(θk−τk)]〉
 =0. (18)
We next turn to T1:
T1 = ∥∥∥∥∥∇f(θk)− 1B B∑ b=1 ∇f (θk−τk) ∥∥∥∥∥ 2
= ‖∇f(θk)−∇f (θk−τk)‖ 2
≤L2‖θk − θk−τk‖2
where the last inequality is from the Lipschitzian gradient assumption (equation 2). It follows that
T1 ≤L2 ‖θk − θk−τk‖ 2
=L2 ∥∥∥∥∥∥ k−1∑
j=k−τk
(θj+1 − θj) ∥∥∥∥∥∥ 2
=L2 ∥∥∥∥∥∥ k−1∑
j=k−τk
ηj
( 1
Gj ) · B∑ b=1 ∇F ( θj−τj ; ξj−τj ,b )∥∥∥∥∥∥ 2
=L2 ∥∥∥∥∥∥ k−1∑
j=k−τk
ηj
( 1
Gj ) · B∑ b=1 [ ∇F ( θj−τj ; ξj−τj ,b ) −∇f ( θj−τj )] + k−1∑ j=k−τk ηj ( 1 Gj ) · B∑ b=1 ∇f ( θj−τj )∥∥∥∥∥∥ 2
≤2L2  ∥∥∥∥∥∥ k−1∑ j=k−τk ηj ( 1 Gj ) · B∑ b=1 [ ∇F ( θj−τj ; ξj−τj ,b ) −∇f ( θj−τj )]∥∥∥∥∥∥ 2
︸ ︷︷ ︸ T3
+ ∥∥∥∥∥∥ k−1∑
j=k−τk
ηj
( 1
Gj ) · B∑ b=1 ∇f ( θj−τj )∥∥∥∥∥∥ 2
︸ ︷︷ ︸ T4  (19)
where the last inequality uses the fact that ‖a+ b‖2 ≤ 2‖a‖2 + 2‖b‖2 for any real vectors a and b. Taking the expectation in terms of {ξj−τj ,∗|j ∈ {k − τk, ..., k − 1}} for T3, we have
Eξj−τj,∗|j∈{k−τk,...,k−1}(T3)
=Eξj−τj,∗|j∈{k−τk,...,k−1}  ∥∥∥∥∥∥ k−1∑ j=k−τk ηj ( 1 Gj ) · B∑ b=1 ( ∇F (θj−τj ; ξj−τj ,b)−∇f(θj−τj ) )∥∥∥∥∥∥ 2 
=Eξj−τj,∗|j∈{k−τk,...,k−1}  k−1∑ j=k−τk η2j G2j ∥∥∥∥∥ B∑ b=1 ( ∇F (θj−τj ; ξj−τj ,b)−∇f(θj−τj ) )∥∥∥∥∥ 2 
+ 2Eξj−τj,∗|j∈{k−τk,...,k−1} [ ∑ k−1≥j′′>j′≥k−τk ηj′ηj′′ G′jG ′′ j 〈 B∑ b=1 ( ∇F (θj′′−τj′′ ; ξj′′−τj′′ ,b)−∇f(θj′′−τj′′ ) ) ,
B∑ b=1 ( ∇F (θj′−τj′ ; ξj′−τj′ ,b)−∇f(θj′−τj′ )
)〉]
=Eξj−τj,∗|j∈{k−τk,...,k−1}  k−1∑ j=k−τk η2j G2j ∥∥∥∥∥ B∑ b=1 ( ∇F (θj−τj ; ξj−τj ,b)−∇f(θj−τj ) )∥∥∥∥∥ 2 
=Eξj−τj,∗|j∈{k−τk,...,k−1}  k−1∑ j=k−τk η2j G2j B∑ b=1 ∥∥(∇F (θj−τj ; ξj−τj ,b)−∇f(θj−τj ))∥∥2 
≤Eξj−τj,∗|j∈{k−τk,...,k−1}  k−1∑ j=k−τk Bη2j G2j ∥∥(∇F (θj−τj ; ξj−τj ,b)−∇f(θj−τj ))∥∥2  ≤B k−1∑
j=k−τk
η2j G2j σ2 (20)
where the second to last equality is due to the last lines in equation 17 and the third equality is due to
Eξj ,k−1≥j≥k−τk [ ∑ k+τk−1≥j′′>j′≥k ηj′ηj′′ G′jG ′′ j 〈 B∑ b=1 ( ∇F (θj′′−τj′′ ; ξj′′−τj′′ ,b)−∇f(θj′′−τj′′ ) ) ,
B∑ b=1 ( ∇F (θj′−τj′ ; ξj′−τj′ ,b)−∇f(θj′−τj′ )
)〉]
=Eξj ,k−1≥j≥k−τk [ ∑ k−1≥j′′>j′≥k−τk ηj′ηj′′ G′jG ′′ j 〈 B∑ b=1 Ej′′,∗ [ ∇F (θj′′−τj′′ ; ξj′′−τj′′ ,b)−∇f(θj′′−τj′′ ) ] ,
B∑ b=1 ( ∇F (θj′−τj′ ; ξj′−τj′ ,b)−∇f(θj′−τj′ ) )〉] =0.
Taking the expectation in terms of ξj−τj ,∗ for T4, we have
Eξj−τj,∗|j∈{k−τk,...,k−1}[T4]
=Eξj−τj,∗|j∈{k−τk,...,k−1}  ∥∥∥∥∥∥ k−1∑ j=k−τk ηj ( 1 Gj ) · B∑ b=1 ∇f ( θj−τj )∥∥∥∥∥∥ 2 
=Eξj−τj,∗|j∈{k−τk,...,k−1}  ∥∥∥∥∥∥ k−1∑ j=k−τk Bηj Gj · ∇f ( θj−τj )∥∥∥∥∥∥ 2  ≤T k−1∑
j=k−τk
B2η2j G2j
Eξj−τj,∗|j∈{k−τk,...,k−1} [∥∥∇f(θj−τj )∥∥2] (21)
where the last inequality uses the fact that ‖ ∑N i=1 ai‖2 ≤ N ∑N i=1 ‖ai‖2 for any real vectors ai and the bounded age assumption equation 6.
We take full expectation on both sides of equation 19 and substitute E[T3] and E[T4] by their upper bounds, equation 20 and equation 21 respectively:
E[T1] ≤ 2L2 B k−1∑
j=k−τk
η2j G2j σ2 + T k−1∑ j=k−τk B2η2j G2j E [∥∥∇f(θj−τj )∥∥2]
 (22)
Substituting E[T1] and E[T2] with their upper bounds equation 22 and equation 17 respectively, and taking full expectation on both sides in equation 16, we obtain
E[f(θk+1)]− f(θk)
≤− Bηk 2Gk E[‖∇f(θk)‖2] + E ∥∥∥∥∥ 1B B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2 
+ BηkL
2
Gk B k−1∑ j=k−τk η2j G2j σ2 + T k−1∑ j=k−τk B2η2j G2j E [∥∥∇f(θj−τj )∥∥2]  + η2kL
2G2k
Bσ2 + E ∥∥∥∥∥ B∑ b=1 ∇f(θk−τk) ∥∥∥∥∥ 2 
≤− Bηk 2Gk
E[‖∇f(θk)‖2] + ( B2η2kL
2G2k − Bηk 2Gk
) E [ ‖∇f(θk−τk)‖ 2 ]
+ Bη2kL 2G2k + B2ηkL 2 Gk k−1∑ j=k−τk η2j G2j σ2 + B3ηkL2T Gk k−1∑ j=k−τk η2j G2j E [∥∥∇f(θj−τj )∥∥2] (23)
Summarizing the inequality equation 23 from k = 1 to k = K, meaning until the K-th update of the master, we have
E[f(θK+1)]− f(θ1)
≤− B 2 K∑ k=1 ηk Gk E [ ‖∇f(θk)‖2 ] + K∑ k=1 ( B2η2kL 2G2k − Bηk 2Gk ) E [ ‖∇f(θk−τk)‖ 2 ]
+ K∑ k=1 Bη2kL 2G2k + B2ηkL 2 Gk k−1∑ j=k−τk η2j G2j σ2 + TL2
K∑ k=1 B3ηk Gk k−1∑ j=k−τk η2j G2j E [∥∥∇f(θj−τj )∥∥2]  ≤− B
2 K∑ k=1 ηk Gk E ( ‖∇f(θk)‖2 ) +
K∑ k=1
( B2η2kL
2G2k + B3ηkL 2T Gk T∑ t=1 η2k+t G2k+t − Bηk 2Gk ) E [ ‖∇f(θk−τk)‖ 2 ]
+ K∑ k=1 Bη2kL 2G2k + B2ηkL 2 Gk k−1∑ j=k−τk η2j G2j σ2 ≤− B
2 K∑ k=1 ηk Gk E ( ‖∇f(θk)‖2 ) + K∑ k=1 Bη2kL 2G2k + B2ηkL 2 Gk k−1∑ j=k−τk η2j G2j σ2 ≤− B
2 K∑ k=1 ηk Gk E ( ‖∇f(θk)‖2 ) + K∑ k=1 Bη2kL 2G2k + B2ηkL 2 Gk k−1∑ j=k−T η2j G2j σ2 (24) where the second to last inequality is due to equation 7 and the last inequality is due to equation 6. Note that θ∗ is the global optimization point. By doing a few simple algebraic operations on equation 24 we have:
1∑K k=1 ηk Gk K∑ k=1 ηk Gk E(‖∇f(θk)‖2) ≤ 2(f(θ1)− f(θ∗)) +
∑K k=1 ( Bη2kL
G2k + 2B
2ηkL 2 Gk ∑k+T−1 j=k−τk η2j G2j ) σ2
B ∑K k=1 ηk Gk
(25)
This completes the proof.

heading: Proof for Corollary 1
text: Proof. Combining equation 9 and equation 10, we get
K ≥ 4BL(T + 1) 2(f(θ1)− f(θ∗)) σ2
1 4B2L2(T + 1)2 ≥ (f(θ1)− f(θ ∗) BLKσ2
1
4B2L2(T + 1)2 ≥ η2
η ≤ 1 2BL(T + 1)
(26)
If follows from equation 26 that
BηL+ 2B2L2T 2η2 ≤ 1 2T + 2 + T 2 2(T + 1)2 ≤ 1 2 + 1 2 = 1
The last inequality holds since naturally T ≥ 0. This implies that condition equation 7 in Theorem 1 is satisfied globally. Then we can safely apply equation 8 in Theorem 1:
1
K K∑ i=1 E(‖∇f(θi)‖2) ≤ 2(f(θ1)− f(θ∗)) +K
( Bη2L+ 2B2L2Tη3 ) σ2
BKη
= 2(f(θ1)− f(θ∗))
BKη + Lσ2η (1 + 2BLTη)
≤2(f(θ1)− f(θ ∗))
BKη + 2Lσ2η
=2
√ (f(θ1)− f(θ∗))Lσ2
BK + 2
√ (f(θ1)− f(θ∗))Lσ2
BK
=4
√ (f(θ1)− f(θ∗))Lσ2
BK
where the third inequality is due to equation 26 and the second to last equality uses equation 9. This completes the proof.

heading: Proof for equation in Section 4.1
text: Proof.
θk+2 = θk+1 − ηk+1 τk+1 · vk+2
= θk+1 − ηk+1 τk+1 · (γvk+1 + gk+1) = θk+1 − ηk+1 τk+1 · (γ(γvk + gk) + gk+1) = θk+1 − ηk+1 τk+1 · (γ2vk + γgk + gk+1)
(27)

heading: C EXPERIMENTAL SETUP

heading: C.1 ALGORITHMS
text: Algorithms 5 to 11 only change the master’s algorithm; the complementary worker algorithm is the same as ASGD (Algorithm 1). The master’s scheme is a simple FIFO. We consider parameter server optimizations beyond the scope of this paper.
The calculation of the C coefficient is described in Appendix C.6.
We note that in Algorithms 8 and 11 the term θi is identical to θk−τk from the definition of τk in Section 4.
Algorithm 5 Staleness-Aware-Gradient: master Initialize an iteration array: iter = [0] ∗N For k = 1...K do:
Receive gradient gik from worker i Calculate worker i’s current delay τk ← k − iter[i] Update momentum vk+1 ← γvk + g i k τk Update master’s weights θk+1 ← θk − ηk · vk+1 Send θk+1 to worker i Save current iteration iter[i]← k
Algorithm 6 DANA: master For k = 1...K do:
Receive gradient gik from worker i Update worker’s momentum vi ← γvi + gik Update master’s weights θk+1 ← θk − ηkvi Send estimate θ̂ = θk+1 − ηkγ ∑N j=1 v j to worker i
Algorithm 7 DANA-Staleness-Aware: master Initialize an iteration array for the workers: iter = [0] ∗N For k = 1...K do:
Receive gradient gik from worker i Calculate worker i’s current delay τk ← k − iter[i] Update worker’s momentum vi ← γvi + g i k
τk
Update master’s weights θk+1 ← θk − ηkvi Send estimate θ̂ = θk+1 − ηkγ ∑N j=1 v
j to worker i Save current iteration iter[i]← k
Algorithm 8 DANA-Gap-Aware: master
Initialize the given weights for each worker: θi = θ0 For k = 1...K do:
Receive gradient gik from worker i Calculate Gap: Gk = |θk−θi| C + 1 d
Update worker’s momentum vi ← γvi + (
1 Gk ) gik
Update master’s weights θk+1 ← θk − ηvi Save and send estimate θi ← θk+1 − ηγ ∑N j=1 v j to worker i
The Adam-based algorithm requires a slightly more intelligent integration to the gradient staleness penalizing methods (such as GA and SA). Penalizing the gradient before calculating the first and second moments doesn’t affect the update vector since the first and second moments cancel each other out. Therefore, we suggest applying the penalty only on the first moment, thus decreasing the update step’s size by the desired amount. Since DANA’s integration into the Adam algorithm is convoluted and not straight forward, we chose not to implement the combination in this paper.
Algorithm 9 Adam: master Require: η1 . . . ηK : step lengths Require: β1, β2 ∈ [0, 1): exponential decay rates for the moment estimates Initialize: m0 ← 0, v0 ← 0 For k = 1...K do:
Receive gradient gik from worker i Update biased first moment estimate mk ← β1mk−1 + (1− β1)gik Update biased second moment estimate vk ← β2vk−1 + (1− β2)(gik)2 Compute bias-corrected first order moment estimate m̂k ← mk1−βk1 Compute bias-corrected second order moment estimate v̂k ← vk1−βk2 Update master’s weights θk+1 ← θk − ηk·m̂k√v̂k+ Send θk+1 to worker i
Algorithm 10 Adam-Staleness-Aware: master Require: η1 . . . ηK : step lengths Require: β1, β2 ∈ [0, 1): exponential decay rates for the moment estimates Initialize: m0 ← 0, v0 ← 0 Initialize: iter = [0] ∗N : an iteration array for the workers For k = 1...K do:
Receive gradient gik from worker i Calculate worker i’s current delay τk ← k − iter[i] Update biased first moment estimate mk ← β1mk−1 + (1− β1) g i k
τk
Update biased second moment estimate vk ← β2vk−1 + (1− β2)(gik)2 Compute bias-corrected first order moment estimate m̂k ← mk1−βk1 Compute bias-corrected second order moment estimate v̂k ← vk1−βk2 Update master’s weights θk+1 ← θk − ηk·m̂k√v̂k+ Send θk+1 to worker i Save current iteration iter[i]← k
Algorithm 11 Adam-Gap-Aware: master Require: η1 . . . ηK : step lengths Require: β1, β2 ∈ [0, 1): exponential decay rates for the moment estimates Initialize: m0 ← 0, v0 ← 0 Initialize: θi = θ0: parameters for every worker For k = 1...K do:
Receive gradient gik from worker i
Calculate Gap: Gk = |θk−θi| C + 1 d Update biased first moment estimate mk ← β1mk−1 + (
1−β1 Gk ) gik
Update biased second moment estimate vk ← β2vk−1 + (1− β2)(gik)2 Compute bias-corrected first order moment estimate m̂k ← mk1−βk1 Compute bias-corrected second order moment estimate v̂k ← vk1−βk2 Update master’s weights θk+1 ← θk − ηk·m̂k√v̂k+ Send θk+1 to worker i Save worker i’s given parameters θi ← θk+1

heading: C.2 DATASETS & MODELS
text: CIFAR The CIFAR-10 (Krizhevsky, 2012) dataset comprises 60K RGB images partitioned into 50K training images and 10K test images. Each image contains 32x32 RGB pixels and belongs to 1 of 10 equal-sized classes. CIFAR-100 is similar but has 100 classes. Link.
ImageNet The ImageNet dataset (Russakovsky et al., 2015), known as ILSVRC2012, consists of RGB images, each labeled as one of 1000 classes. The images are partitioned into 1.28 million training images and 50K validation images; each image is randomly cropped and re-sized to 224x224 (1-crop validation). Link.
WikiText-103 The WikiText language modeling dataset is a collection of over 100 million tokens extracted from the set of verified Good and Featured articles on Wikipedia. Compared to the preprocessed version of Penn Treebank (PTB), WikiText-103 is over 110 times larger. The WikiText dataset also features a far larger vocabulary and retains the original case, punctuation, and numbers (Merity et al., 2016). Link.
Transformer-XL The WikiText-103 dataset is trained on the Transformer-XL model (Dai et al., 2019). The hyperparameters are the ones suggested in the original paper (also see Appendix C.4) and the implementation is taken from their repository. Link.

heading: C.3 GAMMA DISTRIBUTION
text: Ali et al. (2000) suggest a method called CVB to simulate the run-time of a distributive network of computers. The method is based on several definitions:
Definition 2. Task execution time variables:
• µtask - mean time of tasks • Vtask - variance of tasks • µmach - mean computation power of machines • Vmach - variance of computation power of machines • αtask = 1V 2task • αmach = 1V 2mach G(α, β) is a random number generated using a gamma distribution, where α is the shape and β is the scale.
For our case, all tasks are similar and run on a batch size of B. Therefore, the algorithm for deciding the execution-time of every task on a certain machine is reduced to one of the following:
Algorithm 12 Task execution time - homogeneous machines βtask = µtaskαtask q = G(αtask, βtask) βmach =
q αmach
for i from 0 to K − 1: time = G(αmach, βmach)
Algorithm 13 Task execution time - heterogeneous machines βmach = µmachαmach for j from 0 to M : p[j] = G(αmach, βmach)
βtask[j] = p[j] αtask for i from 0 to K − 1: time = G(αtask, βtask[curr])
where K is the total amount of tasks of all the machines combined (the total number of batch iterations), M is the total number of machines (workers), and curr is the machine currently about to run.
We note that Algorithms 12 and 13 naturally give rise to stragglers. In the homogeneous algorithm, all workers have the same mean execution time but some tasks can still be very slow; this generally means that in every epoch a different machine will be the slowest. In the heterogeneous algorithm, every machine has a different mean execution time throughout the training. We further note that p[j] is the mean execution time of machine j on the average task.
In our experiments, we simulated execution times using the following parameters as suggested by Ali et al. (2000): µtask = µmach = B ·V 2mach, where B is the batch size, yielding a mean execution time of µ simulated time units, which is proportionate to B. In the homogeneous setting Vmach = 0.1, whereas in the heterogeneous setting Vmach = 0.6. For both settings, Vtask = 0.1.
Figure 3 illustrates the differences between the homogeneous and heterogeneous gamma-distribution. Both environments have the same mean (128) but the probability of having an iteration that is at
least 1.25x longer than the mean (which means 160 or more) is significantly higher in the heterogeneous environment (27.9% in heterogeneous environment as opposed to 1% in the homogeneous environment).

heading: C.4 HYPERPARAMETERS
text: Since one of our intentions was to verify that penalizing the gradients linearly to the Gap is the factor that leads to a better final test error and convergence rate, we used the same hyperparameters across all algorithms tested. These hyperparameters are the original hyperparameters of the respective neural network architecture, which are tuned for a single worker.

heading: CIFAR-10 ResNet-20
text: • Initial Learning Rate η: 0.1 • Momentum Coefficient γ: 0.9 with NAG • Dampening: 0 (no dampening) • Batch Size B: 128 • Weight Decay: 0.0005 • Learning Rate Decay: 0.1 • Learning Rate Decay Schedule: Epochs 80 and 120 • Total Epochs: 160 We note that Krizhevsky (2012) originally suggested 0.0001 as the Weight Decay hyperparameter for this framework. However, when we tuned the Weight Decay on a single worker we found that 0.0005 results in the best final test accuracy (92.43% as opposed to 91.63%).
CIFAR-10/100 Wide ResNet 16-4
• Initial Learning Rate η: 0.1 • Momentum Coefficient γ: 0.9 with NAG • Dampening: 0 (no dampening) • Batch Size B: 128 • Weight Decay: 0.0005 • Learning Rate Decay: 0.2 • Learning Rate Decay Schedule: Epochs 60, 120 and 160 • Total Epochs: 200

heading: ImageNet ResNet-50
text: • Initial Learning Rate η: 0.1 • Momentum Coefficient γ: 0.9 with NAG • Dampening: 0 (no dampening) • Batch Size B: 256 • Weight Decay: 0.0001 • Learning Rate Decay: 0.1
• Learning Rate Decay Schedule: Epochs 30 and 60 • Total Epochs: 90

heading: WikiText-103 Transformer-XL
text: • Initial Learning Rate η: 0.00025 • Dropout: 0.1 • Dampening: 0 (no dampening) • Batch Size B: 64 • First Moment Coefficient β1: 0.9 • Second Moment Coefficient β2: 0.999 • : 10−8 • Learning Rate Decay: Cosine from 0.00025 to 0 • Gradient Clipping: 0.25 • Total Iteration Steps: K = 200000
Learning Rate Warm-Up In the early stages of training, the network changes rapidly, causing error spikes. For all algorithms, we follow the gradual warm-up approach (Goyal et al., 2017) to overcome this problem: we divide the initial learning rate by the number of workers N and ramp it up linearly until it reaches its original value after 5 epochs. We also use momentum correction (Goyal et al., 2017) in all algorithms to stabilize training when the learning rate changes.

heading: C.5 WEIGHT DECAY
text: When GA is used with Weight Decay, the gradients contain a weight decay element which also needs to be divided by the Gap as a part of the gradient.

heading: C.6 C COEFFICIENT
text: In Definition 1, we explained that we use a coefficient C to measure the gap. In Section 5.3, using the parameter-wise method, C is calculated per-parameter. To calculate C per-parameter, we used a weighted-average in a manner similar to the technique used in Adam (Kingma & Ba, 2015). The mechanism is described in Algorithm 14.
Algorithm 14 C Coefficient Calculation Require: ηmax (usually ηmax = η1) Require: β1 ∈ [0, 1): exponential decay rates for the moment estimates Initialize: C ← 0d, m0 ← 0 For k = 1...K do:
Receive gradient gik from worker i Calculate update step vk+1 ← γvk + gik Update biased second moment estimate mk ← β1mk−1 + (1− β1)v2k+1 Compute bias-corrected second order moment estimate m̂k ← mk1−βk1 Calculate Coefficient C ← ηmax (√ m̂k + )
Where is the parameter-wise method, all operations are executed per-parameter. Throughout our experiments we used β1 = 0.999 and = 10−8 as suggested by Kingma & Ba (2015).

heading: C.7 TABLED RESULTS

heading: C.8 DELAY VS. GAP
text: To better illustrate that the delay is usually bigger than the Gap, we measured both sizes throughout the training process using different workers. The tested framework was CIFAR100 using WideResNet 16-4. We used the Gap-Aware and DANA-GA algorithms with the same hyperparameters described in Appendix C.4.
Figure 4 shows the average Gap and Delay (τ) for every epoch throughout the training process. The Gap (Figure 4(b)) is constantly lower than the Delay (Figure 4(c)), especially towards the end of the training where the learning rate is small (which decreases the distance between the master’s and worker’s parameters). This figure illustrates how penalizing according to the Delay, as in Staleness-Aware, can easily over-penalize when the number of workers is large.
DANA uses an approximation of the master’s parameters at the time of the future update, thus mitigating the staleness of the incoming gradients. This mitigation also reduces the Gap, as shown in Figure 4(a), which reduces the needed penalization when using DANA-GA.

heading: C.9 GAP VERSIONS
text: We tested three different Gap variations (See Section 5.3) to determine which technique has the best performance. The variations were tested on three different frameworks:
• CIFAR10 using ResNet-20 • CIFAR10 using WideResNet 16-4
• CIFAR100 using WideResNet 16-4 Each framework was trained on N ∈ [4, 8, 16, 24, 32] asynchronous workers. Figure 5 contains the experiments not shown in Section 5.3 and demonstrates that parameter-wise Gap-Aware usually reaches better or similar final errors. The hyperparameters are the same ones detailed in Appendix C.4.

heading: C.10 CIFAR TRAINING
text: Figure 6 shows that DANA-GA always remains very close to the zero-error region. This means that, unlike other algorithms, DANA-GA is able to converge on the training set despite the gradient staleness. Figure 6 further demonstrates all of the concepts discussed in Section 6.1.

heading: C.11 CONVERGENCE RATE
text: Figure 7 shows that the convergence rate of GA is similar to that of SA, despite using a larger step size. This suggests that GA does not require more steps than SA to reach its (better) minima. DANA-GA’s convergence rate remains very close to the baseline, which suggests that it doesn’t require more steps to converge. This means that DANA-GA reaches a test error similar to the single worker case in the same number of steps, while enjoying asynchronous speedup.
Figure 8 demonstrates the same ideas discussed in the last paragraph on ImageNet using 64 asynchronous workers. However, since in this case the number of workers is much larger, both SA and DANA-SA perform very poorly due the the over-penalization of SA. This helps illustrate that GA is a better staleness mitigation method than SA. DANA-GA remains very close to the baseline despite the large number of workers used, demonstrating the superiority of DANA-GA.

heading: C.12 TUNED ASGD
text: We tuned the learning rate and momentum of ASGD on the CIFAR10 dataset with the ResNet-20 model using 32 workers. Tuning was performed using a grid search over 70 perturbations:
η ∈ [0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 1] γ ∈ [−0.9,−0.8,−0.5,−0.25, 0, 0.25, 0.5, 0.8, 0.9, 0.95]
As suggested by Mitliagkas et al. (2016), we also tested negative values of momentum to mitigate the implicit momentum created by the gradient staleness. Figures 9 to 11 show the results of the above experiments. The best final test error was given when:
• Figure 9: (η = 0.03, γ = 0.5) • Figure 10: (η = 0.3, γ = −0.8) • Figure 11: (η = 0.3, γ = −0.5) This shows that the best hyperparameters can vary between frameworks. The best hyperparameters for a specific framework can also vary across different number of workers as all the hyperparameters found in this experiment are different from the best hyperparameters of the single worker. Tuning for the best hyperparameters for every different number of workers for each framework significantly increases the training time and is best avoided if possible.
DANA-GA surpasses the tuned ASGD in every framework, while DANA performs very poorly using 32 workers. This proves that gradient penalization is very beneficial to overcome gradient staleness and specifically that GA is a very successful gradient penalization method.

heading: C.13 GRADIENT STALENESS NOISE
text: We notice that in the ImageNet experiments (Table 3) NAG-ASGD remains relatively close to the baseline even when the number of workers is large, as opposed to the CIFAR experiments, in which NAG-ASGD severely deteriorates as N scales up. This phenomenon suggests that there is some
gradient staleness noise that a framework can ”tolerate” and still perform well. Following this intuition, it is reasonable that some gradient staleness should be allowed to go ”un-penalized” to avoid limiting the step-size needlessly. This idea explains why SA and GA demonstrated relatively poor results in ImageNet, especially when the number of workers was relatively small. Though we consider this analysis beyond the scope of this work, it is relevant for this paper to note that we think that the tolerable gradient staleness noise depends on the size of the model and dataset, which suggests that GA can be further improved by correctly analysing the tolerable gradient staleness noise and starting the penalization accordingly. We plan to continue our research in this path as well.

heading: D ASYNCHRONOUS SPEEDUP
text: Cloud computing is becoming increasingly popular as a platform to perform distributed training of deep neural networks. Although synchronous SGD is currently the primary method (Mikami et al., 2018; Ying et al., 2018; Yamazaki et al., 2019; Goyal et al., 2017) used to distribute the learning process, it suffers from substantial slowdowns when run in non-dedicated environments such as the cloud. This shortcoming is magnified in heterogeneous environments and non-dedicated networks. ASGD addresses the SSGD drawback and enjoys linear speedup in terms of the number of workers in both heterogeneous and homogeneous environments even in non-dedicated networks. This makes ASGD a potentially better alternative for cloud computing.
Figure 12(a) shows the theoretically achievable speedup, based on the detailed gamma-distributed model, for asynchronous (GA and other ASGD variants) and synchronous algorithms using homogeneous and heterogeneous workers. The asynchronous algorithms can achieve linear speedup while the synchronous algorithm (SSGD) falls short as we increase the number of workers. This occurs because SSGD must wait in each iteration until all workers complete their batch. Figure 12(b) shows that ASGD-based algorithms (including GA, SA and DANA versions) are up to 21% faster than SSGD in homogeneous environments. In heterogeneous environments, ASGD methods can be 6x faster than SSGD. We note that this speedup is an underestimate, since our simulation includes only batch execution times. It does not model the execution time of barriers, all-gather operations, and other overheads which usually increase communication time, especially in SSGD.

heading: D.1 GAP-AWARE OVERHEAD
text: The Gap-Aware method requires the master to save the parameters of every worker and adds some simple calculations mentioned in Algorithm 4 and Algorithm 14. These calculations add no communication or computation requirements to the workers and introduce only a lightweight overhead to the parameter server compared to vanilla-ASGD. This lightweight overhead is similar to the overhead introduced by other ASGD-based methods such as Zheng et al. (2016). The space requirement is not critical since the master is usually implemented in a distributed manner, and the parameters are stored in the CPU-side memory, which is usually substantially larger than the total parameter size.

heading: D.2 HETEROGENEOUS EXPERIMENTS
text: We tested the performance of GA in reference to other algorithms when the asynchronous workers are heterogeneous. The setting was very similar to the one mentioned in Section 6, except that it this scenario we used the gamma-distribution to model heterogeneous workers (see Appendix C.3).
Figure 13 demonstrates that GA and DANA-GA are superior to the other tested algorithms in heterogeneous environments as well. When comparing between Figure 13 and Figure 2 it is noticeable that heterogeneous environments reach a higher accuracy. This is because in heterogeneous environments some workers are very fast compared to the other ones, thus their gradients are more accurate and arrive more frequently than the slow workers’ gradients. Since in cloud computing, the workers can be either heterogeneous or homogeneous, we suggest using DANA-GA to maximize the results.

Review summaries:
This paper studies training large machine learning models in a distributed setup. For such a setup, as the number of workers increases, employing synchronous stochastic gradient descent incurs a significant delay due to the presence of straggling workers. Using asynchronous methods should circumvent the issue of stragglers. However, these asynchronous methods suffer from the stale gradients where by the time a worker sends the gradients to the master server, the model parameters have changed based on the gradients received from other workers. This leads to severe performance degradation in the models trained by using asynchronous methods, especially where the number of workers scales.

The paper introduces a new variant of asynchronous SGD, GA-ASGD, for distributed training. The goal is to mitigate the gradient staleness issue caused by asynchronously applying gradients to an old version of parameters. Prior work addresses this issue by penalizing the learning step of a worker linearly to its missed updates since getting a replica of parameters. However, that approach does not consider the differences between the old and new versions of parameters, which can cause over-penalization and under-penalization. The main contribution of this paper is to introduce a new way of measuring weight staleness and to explore the idea of penalizing the gradient itself to mitigate the staleness issue. The paper does a good job of discussing how GA can be applied to existing optimizers such as Adam. It performs empirical studies on ImageNet and Transformers-XL to conclude that GA-ASGD outperforms ASGD and the prior staleness aware approach. It also demonstrates the scalability of GA by scaling up to training with 128 asynchronous workers.