Year: 2019

Abstract:
Mini-batch stochastic gradient descent (SGD) is state of the art in large scale distributed training. The scheme can reach a linear speedup with respect to the number of workers, but this is rarely seen in practice as the scheme often suffers from large network delays and bandwidth limits. To overcome this communication bottleneck recent works propose to reduce the communication frequency. An algorithm of this type is local SGD that runs SGD independently in parallel on different workers and averages the sequences only once in a while. This scheme shows promising results in practice, but eluded thorough theoretical analysis. We prove concise convergence rates for local SGD on convex problems and show that it converges at the same rate as mini-batch SGD in terms of number of evaluated gradients, that is, the scheme achieves linear speedup in the number of workers and mini-batch size. The number of communication rounds can be reduced up to a factor of T —where T denotes the number of total steps—compared to mini-batch SGD. This also holds for asynchronous implementations. Local SGD can also be used for large scale training of deep learning models. The results shown here aim serving as a guideline to further explore the theoretical and practical aspects of local SGD in these applications.

heading: 1 INTRODUCTION
text: Stochastic Gradient Descent (SGD) (Robbins & Monro, 1951) consists of iterations of the form
xt+1 := xt − ηtgt , (1)
for iterates (weights) xt,xt+1 ∈ Rd, stepsize (learning rate) ηt > 0, and stochastic gradient gt ∈ Rd with the property Egt = ∇f(xt), for a loss function f : Rd → R. This scheme can easily be parallelized by replacing gt in (1) by an average of stochastic gradients that are independently computed in parallel on separate workers (parallel SGD). This simple scheme has a major drawback: in each iteration the results of the computations on the workers have to be shared with the other workers to compute the next iterate xt+1. Communication has been reported to be a major bottleneck for many large scale deep learning applications, see e.g. (Seide et al., 2014; Alistarh et al., 2017; Zhang et al., 2017; Lin et al., 2018b). Mini-batch parallel SGD addresses this issue by increasing the compute to communication ratio. Each worker computes a mini-batch of size b ≥ 1 before communication. This scheme is implemented in state-of-the-art distributed deep learning frameworks (Abadi et al., 2016; Paszke et al., 2017; Seide & Agarwal, 2016). Recent work in (You et al., 2017; Goyal et al., 2017) explores various limitations of this approach, as in general it is reported that performance degrades for too large mini-batch sizes (Keskar et al., 2016; Ma et al., 2018; Yin et al., 2018).
In this work we follow an orthogonal approach, still with the goal to increase the compute to communication ratio: Instead of increasing the mini-batch size, we reduce the communication frequency. Rather than keeping the sequences on different machines in sync, we allow them to evolve locally on each machine, independent from each other, and only average the sequences once in a while (local SGD). Such strategies have been explored widely in the literature, under various names.
An extreme instance of this concept is one-shot SGD (McDonald et al., 2009; Zinkevich et al., 2010) where the local sequences are only exchanged once, after the local runs have converged. Zhang
et al. (2013) show statistical convergence (see also (Shamir & Srebro, 2014; Godichon-Baggioni & Saadane, 2017; Jain et al., 2018)), but the analysis restricts the algorithm to at most one pass over the data, which is in general not enough for the training error to converge. More practical are schemes that perform more frequent averaging of the parallel sequences, as e.g. (McDonald et al., 2010) for perceptron training (iterative parameter mixing), see also (Coppola, 2015), (Zhang et al., 2014; Bijral et al., 2016; Zhang et al., 2016) for the training of deep neural networks (model averaging) or in federated learning (McMahan et al., 2017).
The question of how often communication rounds need to be initiated has eluded a concise theoretical answer so far. Whilst there is practical evidence, the theory does not even resolve the question whether averaging helps when optimizing convex functions. Concretely, whether running local SGD on K workers is K times faster than running just a single instance of SGD on one worker.1
We fill this gap in the literature and provide a concise convergence analysis of local SGD. We show that averaging helps. Frequent synchronization of K local sequences increases the convergence rate by a factor of K, i.e. a linear speedup can be attained. Thus, local SGD is as efficient as parallel mini-batch SGD in terms of computation, but the communication cost can be drastically reduced.

heading: 1.1 CONTRIBUTIONS
text: We consider finite-sum convex optimization problems f : Rd → R of the form
f(x) = 1
n n∑ i=1 fi(x) , x ∗ := arg minx∈Rd f(x) , f ? := f(x?) , (2)
where f is L-smooth2 and µ-strongly convex3. We consider K parallel mini-batch SGD sequences with mini-batch size b that are synchronized (by averaging) after at most every H iterations. For appropriate chosen stepsizes and an averaged iterate x̂T after T steps (for T sufficiently large, see Section 3 below for the precise statement of the convergence result with bias and variance terms) and synchronization delay H = O( √ T/(Kb)) we show convergence
E f(x̂T )− f? = O ( G2
µbKT
) , (3)
with second moment bound G2 ≥ E ‖∇fi(x)‖2. Thus, we see that compared to parallel minibatch SGD the communication rounds can be reduced by a factor H = O( √ T/(Kb)) without hampering the asymptotic convergence. Equation (3) shows perfect linear speedup in terms of computation, but with much less communication that mini-batch SGD. The resulting speedup when taking communication cost into account is illustrated in Figure 1 (see also Section D below). Under the assumption that (3) is tight, one has thus now two strategies to improve the compute to communication ratio (denoted by ρ): (i) either to increase the mini-batch size b or (ii) to increase the communication interval H . Both strategies give the same improvement when b and H are small (linear speedup). Like mini-batch SGD that faces some limitations for b 1 (as discussed in e.g. (Dekel et al., 2012; Ma et al., 2018; Yin et al., 2018)), the parameter H cannot be chosen too large in local SGD. We give some pratical guidelines in Section 4.
Our proof is simple and straightforward, and we imagine that—with slight modifications of the proof—the technique can also be used to analyze other variants of SGD that evolve sequences on
1On convex functions, the average of the K local solutions can of course only decrease the objective value, but convexity does not imply that the averaged point is K times better.
2f(y) ≤ f(x) + 〈∇f(x),y − x〉+ L 2 ‖y − x‖2, ∀x,y ∈ Rd. 3f(y) ≥ f(x) + 〈∇f(x),y − x〉+ µ 2 ‖y − x‖2, ∀x,y ∈ Rd.
different worker that are not perfectly synchronized. Although we do not yet provide convergence guarantees for the non-convex setting, we feel that the positive results presented here will spark further investigation of local SGD for this important application (see e.g. (Yu et al., 2018)).

heading: 1.2 RELATED WORK
text: A parallel line of work reduces the communication cost by compressing the stochastic gradients before communication. For instance, by limiting the number of bits in the floating point representation (Gupta et al., 2015; Na et al., 2017; Sa et al., 2015), or random quantization (Alistarh et al., 2017; Wen et al., 2017). The ZipML framework applies this technique also to the data (Zhang et al., 2017). Sparsification methods reduce the number of non-zero entries in the stochastic gradient (Alistarh et al., 2017; Wangni et al., 2017). A very aggressive—and promising—sparsification method is to keep only very few coordinates of the stochastic gradient by considering only the coordinates with the largest magnitudes (Seide et al., 2014; Strom, 2015; Dryden et al., 2016; Aji & Heafield, 2017; Sun et al., 2017; Lin et al., 2018b; Stich et al., 2018).
Allowing asynchronous updates provides an alternative solution to disguise the communication overhead to a certain amount (Niu et al., 2011; Sa et al., 2015; Lian et al., 2015), though alternative strategies might be better when high accuracy is desired (Chen et al., 2016). The analysis of Agarwal & Duchi (2011) shows that asynchronous SGD on convex functions can tolerated delays up to O( √ T/K), which is identical to the maximal length of the local sequences in local SGD. Asynchronous SGD converges also for larger delays (see also (Zhou et al., 2018)) but without linear speedup, a similar statement holds for local SGD (see discussion in Section 3). The current frameworks for the analysis of asynchronous SGD do not cover local SGD. A fundamental difference is that asynchronous SGD maintains a (almost) synchronized sequence and gradients are computed with respect this unique sequence (but just applied with delays), whereas each worker in local SGD evolves a different sequence and computes gradient with respect those iterates.
For the training of deep neural networks, Bijral et al. (2016) discuss a stochastic averaging schedule whereas Zhang et al. (2016) study local SGD with more frequent communication at the beginning of the optimization process. The elastic averaging technique (Zhang et al., 2015) is different to local SGD, as it uses the average of the iterates only to guide the local sequences but does not perform a hard reset after averaging. Among the first theoretical studies of local SGD in the non-convex setting are (Coppola, 2015; Zhou & Cong, 2018) that did not establish a speedup, in contrast to two more recent analyses (Yu et al., 2018; Wang & Joshi, 2018). Yu et al. (2018) show linear speedup of local SGD on non-convex functions for H = O(T 1/4K−3/4), which is more restrictive than the constraint on H in the convex setting. Lin et al. (2018a) study empirically hierarchical variants of local SGD.
Local SGD with averaging in every step, i.e. H = 1, is identical to mini-batch SGD. Dekel et al. (2012) show that batch sizes b = T δ , for δ ∈ (0, 12 ) are asymptotically optimal for mini-batch SGD, however they also note that this asymptotic bound might be crude for practical purposes. Similar considerations might also apply to the asymptotic upper bounds on the communication frequency H derived here. Local SGD with averaging only at the end, i.e. H = T , is identical to one-shot SGD. Jain et al. (2018) give concise speedup results in terms of bias and variance for one-shot SGD with constant stepsizes for the optimization of quadratic least squares problems. In contrast, our upper bounds become loose when H → T and our results do not cover one-shot SGD. Recently, Woodworth et al. (2018) provided a lower bound for parallel stochastic optimization (in the convex setting, and not for strongly convex functions as considered here). The bound is not known to be tight for local SGD.

heading: 1.3 OUTLINE
text: We formally introduce local SGD in Section 2 and sketch the convergence proof in Section 3. In Section 4 show numerical results to illustrate the result. We analyze asynchronous local SGD in Section 5. The proof of the technical results, further discussion about the experimental setup and implementation guidelines are deferred to the appendix.
Algorithm 1 LOCAL SGD
1: Initialize variables xk0 = x0 for workers k ∈ [K] 2: for t in 0 . . . T − 1 do 3: parallel for k ∈ [K] do 4: Sample ikt uniformly in [n] 5: if t+ 1 ∈ IT then 6: xkt+1 ← 1K ∑K k=1 ( xkt − ηt∇fikt (x k t ) )
. global synchronization 7: else 8: xkt+1 ← xkt − ηt∇fikt (x k t ) . local update
9: end if 10: end parallel for 11: end for

heading: 2 LOCAL SGD
text: The algorithm local SGD (depicted in Algorithm 1) generates in parallel K sequences {xkt }Tt=0 of iterates, k ∈ [K]. Here K denotes the level of parallelization, i.e. the number of distinct parallel sequences and T the number of steps (i.e. the total number of stochastic gradient evaluations is TK). Let IT ⊆ [T ] with T ∈ IT denote a set of synchronization indices. Then local SGD evolves the sequences {xkt }Tt=0 in the following way:
xkt+1 :=
{ xkt − ηt∇fikt (x k t ) , if t+ 1 /∈ IT
1 K ∑K k=1 ( xkt − ηt∇fikt (x k t ) ) if t+ 1 ∈ IT (4)
where indices ikt ∼u.a.r. [n] and {ηt}t≥0 denotes a sequence of stepsizes. If IT = [T ] then the synchronization of the sequences is performed every iteration. In this case, (4) amounts to parallel or mini-batch SGD with mini-batch size K.4 On the other extreme, if IT = {T}, the synchronization only happens at the end, which is known as one-shot averaging.
In order to measure the longest interval between subsequent synchronization steps, we introduce the gap of a set of integers. Definition 2.1 (gap). The gap of a set P := {p0, . . . , pt} of t + 1 integers, pi ≤ pi+1 for i = 0, . . . , t− 1, is defined as gap(P) := maxi=1,...,t(pi − pi−1).

heading: 2.1 VARIANCE REDUCTION IN LOCAL SGD
text: Before jumping to the convergence result, we first discuss an important observation. Parallel (mini-batch) SGD. For carefully chosen stepsizes ηt, SGD converges at rate O ( σ2
T
) 5 on
strongly convex and smooth functions f , where σ2 ≥ E‖∇fikt (x k t )−∇f(xkt )‖2 for t > 0, k ∈ [K] is an upper bound on the variance, see for instance (Zhao & Zhang, 2015). By averaging K stochastic gradients—such as in parallel SGD—the variance decreases by a factor of K, and we conclude that parallel SGD converges at a rate O ( σ2
TK
) , i.e. achieves a linear speedup.
Towards local SGD. For local SGD such a simple argument is elusive. For instance, just capitalizing the convexity of the objective function f is not enough: this will show that the averaged iterate of K independent SGD sequences converges at rate O ( σ2
T
) , i.e. no speedup can be shown in this way.
This indicates that one has to show that local SGD decreases the variance σ2 instead, similar as in parallel SGD. Suppose the different sequences xkt evolve close to each other. Then it is reasonable to assume that averaging the stochastic gradients ∇fikt (x k t ) for all k ∈ [K] can still yield a reduction in the variance by a factor of K—similar as in parallel SGD. Indeed, we will make this statement precise in the proof below.
4For the ease of presentation, we assume here that each worker in local SGD only processes a mini-batch of size b = 1. This can be done without loss of generality, as we discuss later in Remark 2.4.
5For the ease of presentation, we here assume that the bias term is negligible compared to the variance term.

heading: 2.2 CONVERGENCE RESULT AND DISCUSSION
text: Theorem 2.2. Let f be L-smooth and µ-strongly convex, Ei ∥∥∇fi(xkt )−∇f(xkt )∥∥2 ≤ σ2,
Ei ∥∥∇fi(xkt )∥∥2 ≤ G2, for t = 0, . . . , T − 1, where {xkt }Tt=0 for k ∈ [K] are generated according to (4) with gap(IT ) ≤ H and for stepsizes ηt = 4µ(a+t) with shift parameter a > max{16κ,H}, for κ = Lµ . Then
E f(x̂T )− f? ≤ µa3
2ST ‖x0 − x?‖2 +
4T (T + 2a)
µKST σ2 +
256T µ2ST G2H2L , (5)
where x̂T = 1KST ∑K k=1 ∑T−1 t=0 wtx k t , for wt = (a+ t) 2 and ST = ∑T−1 t=0 wt ≥ 1 3T 3.
We were not especially careful to optimize the constants (and the lower order terms) in (5), so we now state the asymptotic result. Corollary 2.3. Let x̂T be as defined as in Theorem 2.2, for parameter a = max{16κ,H}. Then
E f(x̂T )− f? = O ( 1
µKT + κ+H µKT 2
) σ2 +O ( κH2
µT 2 + κ3 +H3 µT 3
) G2 . (6)
For the last estimate we used Eµ ‖x0 − x?‖ ≤ 2G for µ-strongly convex f , as derived in (Rakhlin et al., 2012, Lemma 2). Remark 2.4 (Mini-batch local SGD). So far, we assumed that each worker only computes a single stochastic gradient. In mini-batch local SGD, each worker computes a mini-batch of size b in each iteration. This reduces the variance by a factor of b, and thus Theorem (2.2) gives the convergence rate of mini-batch local SGD when σ2 is replaced by σ 2
b .
We now state some consequences of equation (6). For the ease of the exposition we omit the dependency on L, µ, σ2 and G2 below, but depict the dependency on the local mini-batch size b.
Convergence rate. For T large enough and assuming σ > 0, the very first term is dominating in (6) and local SGD converges at rate O(1/(KTb)). That is, local SGD achieves a linear speedup in both, the number of workers K and the mini-batch size b.
Global synchronization steps. It needs to hold H = O( √ T/(Kb)) to get the linear speedup. This
yields a reduction of the number of communication rounds by a factor O( √ T/(Kb)) compared
to parallel mini-batch SGD without hurting the convergence rate. Extreme Cases. We have not optimized the result for extreme settings of H , K, L or σ. For
instance, we do not recover convergence for the one-shot averaging, i.e. the setting H = T (though convergence for H = o(T ), but at a lower rate).
Unknown Time Horizon/Adaptive Communication Frequency Zhang et al. (2016) empirically observe that more frequent communication at the beginning of the optimization can help to get faster time-to-accuracy (see also Lin et al. (2018a)). Indeed, when the number of total iterations T is not known beforehand (as it e.g. depends on the target accuracy, cf. (6) and also Section 4 below), then increasing the communication frequency seems to be a good strategy to keep the communication low, why still respecting the constraint H = O( √ T/(Kb)) for all T .

heading: 3 PROOF OUTLINE
text: We now give the outline of the proof. The proofs of the lemmas are given in Appendix A.
Perturbed iterate analysis. Inspired by the perturbed iterate framework of (Mania et al., 2017) we first define a virtual sequence {x̄t}t≥0 in the following way:
x̄0 = x0 , x̄t = 1
K K∑ k=1 xkt , (7)
where the sequences {xkt }t≥0 for k ∈ [K] are the same as in (4). Notice that this sequence never has to be computed explicitly, it is just a tool that we use in the analysis. Further notice that x̄t = xkt for
k ∈ [K] whenever t ∈ IT . Especially, when IT = [T ], then x̄t ≡ xkt for every k ∈ [K], t ∈ [T ]. It will be useful to define
gt := 1
K K∑ k=1 ∇fikt (x k t ) , ḡt := 1 K K∑ k=1 ∇f(xkt ) . (8)
Observe x̄t+1 = x̄t − ηtgt and Egt = ḡt. Now the proof proceeds as follows: we show (i) that the virtual sequence {x̄t}t≥0 almost behaves like mini-batch SGD with batch size K (Lemma 3.1 and 3.2), and (ii) the true iterates {xkt }t≥0,k∈[K] do not deviate much from the virtual sequence (Lemma 3.3). These are the main ingredients in the proof. To obtain the rate we exploit a technical lemma from (Stich et al., 2018). Lemma 3.1. Let {xt}t≥0 and {x̄t}t≥0 for k ∈ [K] be defined as in (4) and (7) and let f be L-smooth and µ-strongly convex and ηt ≤ 14L . Then
E ‖x̄t+1 − x?‖2 ≤ (1− µηt)E ‖x̄t − x?‖2 + η2t E ‖gt − ḡt‖ 2
− 1 2 ηt E(f(x̄t)− f?) + 2ηt L K K∑ k=1 E ∥∥x̄t − xkt ∥∥2 . (9)
Bounding the variance. From equation (9) it becomes clear that we should derive an upper bound on E ‖gt − ḡt‖2. We will relate this to the variance σ2.
Lemma 3.2. Let σ2 ≥ Ei‖∇fi(xkt )−∇f(xkt )‖2 for k ∈ [K], t ∈ [T ]. Then E ‖gt − ḡt‖ 2 ≤ σ
2
K .
Bounding the deviation. Further, we need to bound 1K ∑K k=1 E ∥∥x̄t − xkt ∥∥2. For this we impose a condition on IT and an additional condition on the stepsize ηt. Lemma 3.3. If gap(IT ) ≤ H and sequence of decreasing positive stepsizes {ηt}t≥0 satisfying ηt ≤ 2ηt+H for all t ≥ 0, then
1
K K∑ k=1 E ∥∥x̄t − xkt ∥∥2 ≤ 4η2tG2H2 , (10)
where G2 is a constant such that Ei‖∇fi(xkt )‖2 ≤ G2 for k ∈ [K], t ∈ [T ].
Optimal Averaging. Similar as in (Lacoste-Julien et al., 2012; Shamir & Zhang, 2013; Rakhlin et al., 2012) we define a suitable averaging scheme for the iterates {x̄t}t≥0 to get the optimal convergence rate. In contrast to (Lacoste-Julien et al., 2012) that use linearly increasing weights, we use quadratically increasing weights, as for instance (Shamir & Zhang, 2013; Stich et al., 2018). Lemma 3.4 ((Stich et al., 2018)). Let {at}t≥0, at ≥ 0, {et}t≥0, et ≥ 0 be sequences satisfying
at+1 ≤ (1− µηt) at − ηtetA+ η2tB + η3tC , (11)
for ηt = 4µ(a+t) and constants A > 0, B,C ≥ 0, µ > 0, a > 1. Then
A
ST T−1∑ t=0 wtet ≤ µa3 4ST a0 + 2T (T + 2a) µST B + 16T µ2ST C , (12)
for wt = (a+ t)2 and ST := ∑T−1 t=0 wt = T 6 ( 2T 2 + 6aT − 3T + 6a2 − 6a+ 1 ) ≥ 13T 3.
Proof. This is a reformulation of Lemma 3.3 in (Stich et al., 2018). Proof of Theorem 2.2. By convexity of f we have E f(x̂T )− f? ≤ 1ST ∑T−1 t=0 wt E ( f(x̄t)− f? ) . The proof of the theorem thus follows immediately from the four lemmas that we have presented, i.e. by Lemma 3.4 with et := E(f(x̄t)− f?) and constants A = 12 , (Lemma 3.1), B = σ2
K , (Lemma 3.2) and C = 8G2H2L, (Lemma 3.3). Observe that the stepsizes ηt = 4µ(a+t) satisfy both the conditions of Lemma 3.1 (η0 = 4µa ≤ 1 4L , as a ≥ 16κ) and of Lemma 3.3 ( ηt ηt+H = a+t+Ha+t ≤ 2, as a ≥ H ) .

heading: 4 NUMERICAL ILLUSTRATION
text: In this section we show some numerical experiments to illustrate the results of Theorem 2.2.
Speedup. When Algorithm 1 is implemented in a distributed setting, there are two components that determine the wall-clock time: (i) the total number of gradient computations, TK, and (ii) the total time spend for communication. In each communication round 2(K − 1) vectors need to be exchanged, and there will be T/H communication rounds. Typically, the communication is more expensive than a single gradient computation. We will denote this ratio by a factor ρ ≥ 1 (in practice, ρ can be 10–100, or even larger on slow networks). The parameter T depends on the desired accuracy > 0, and according to (6) we roughly have T ( ,H,K) ≈ 1K ( 1 2 + 1 2 √ 1 + (1 +H +H2K) ) .
Thus, the theoretical speedup S(K) of local SGD on K machines compared to SGD on one machine (H = 1, K = 1) is
S(K) = K(
1 2 + 1 2
√ 1 + (1 +H +H2K) )( 1 + 2ρ (K−1)H ) . (13) Theoretical. Examining (13), we see that (i) increasing H can reduce negative scaling effects due to parallelization (second bracket in the denominator of (13)), and (ii) local SGD only shows linear scaling for 1 (i.e. T large enough, in agreement with the theory). In Figure 2 we depict S(K), once for = 0 in Figure 2b, and for positive > 0 in Figure 2a under the assumption ρ = 25. We see that for = 0 the largest values of H give the best speedup, however, when only a few epochs need to be performed, then the optimal values of H change with the number of workers K. We also see that for a small number of workers H = 1 is never optimal. If T is unknown, then these observations seem to indicate that the technique from (Zhang et al., 2016), i.e. adaptively increasing H over time seems to be a good strategy to get the best choice of H when the time horizon is unknown.
Experimental. We examine the practical speedup on a logistic regression problem, f(x) = 1 n ∑n i=1 log(1 + exp(−bia>i x)) + λ 2 ‖x‖
2, where ai ∈ Rd and bi ∈ {−1,+1} are the data samples. The regularization parameter is set to λ = 1/n. We consider the w8a dataset (Platt, 1999) (d = 300, n = 49749). We initialize all runs with x0 = 0d and measure the number of iterations to reach the target accuracy . We consider the target accuracy reached, when either the last iterate, the uniform average, the average with linear weights, or the average with quadratic weights (such as in Theorem 2.2) reaches the target accuracy. By extensive grid search we determine for each configuration (H,K,B) the best stepsize from the set {min(32, cnt+1 ), 32c}, where c can take the values c = 2i for i ∈ Z. For more details on the experimental setup refer Section D in the appendix. We depict the results in Figure 3, again under the assumption ρ = 25.
Algorithm 2 ASYNCHRONOUS LOCAL SGD (SCHEMATIC) 1: Initialize variables xk0 = x0, r
k = 0 for k ∈ [K], aggregate x̄ = x0. 2: parallel for k ∈ [K] do 3: for t in 0 . . . T − 1 do 4: Sample ikt uniformly in [n] 5: xkt+1 ← xkt − ηt∇fikt (x k t ) . local update 6: if t+ 1 ∈ IkT then 7: x̄← add(x̄, 1K (x k t+1 − xkrk)) . atomic aggregation of the updates 8: xkt+1 ← read(x̄); 9: rk ← t+ 1 . iteration/time of last read
10: end if 11: end for 12: end parallel for
Conclusion. The restriction on H imposed by theory is not severe for T →∞. Thus, for training that either requires many passes over the data or that is performed only on a small cluster, large values of H are advisable. However, for smaller T (few passes over the data), the O(1/ √ K) dependency shows significantly in the experiment. This has to be taken into account when deploying the algorithm on a massively parallel system, for instance through the technique mentioned in (Zhang et al., 2016).

heading: 5 ASYNCHRONOUS LOCAL SGD
text: In this section we present asynchronous local SGD that does not require that the local sequences are synchronized. This does not only reduce communication bottlenecks, but by using load-balancing techniques the algorithm can optimally be tuned to heterogeneous settings (slower workers do less computation between synchronization, and faster workers do more). We will discuss this in more detail in Section C.
Asynchronous local SGD generates in parallel K sequences {xkt }Tt=0 of iterates, k ∈ [K]. Similar as in Section 2 we introduce sets of synchronization indices, Ikt ⊆ [T ] with T ∈ IkT for k ∈ [K]. Note that the sets do not have to be equal for different workers. Each worker k evolves locally a sequence xkt in the following way:
xkt+1 =
{ xkt − γt∇fikt (x k t ) if t+ 1 /∈ IkT
x̄kt+1 if t+ 1 ∈ IkT (14)
where x̄kt+1 denotes the state of the aggregated variable at the time when worker k reads the aggregated variable. To be precise, we use the notation
x̄kt = x0 − 1
K K∑ h=1 t−1∑ j=0 1j∈Wk,ht (γj∇fikj (x k j )) , (15)
whereWk,ht ⊆ [T ] denotes all updates that have been written at the time the read takes place. The sets Wk,ht are indexed by iteration t, worker k that initiates the read and h ∈ [K]. Thus W k,h t denotes all updates of the local sequence {xht }t≥0, that have been reported back to the server at the time worker k reads (in iteration t). This notation is necessary, as we don’t necessarily have Wk,ht =W k′,h t for k 6= k′. We haveW k,h t ⊆ W k,h t′ for t
′ ≥ t, as updates are not overwritten. When we cast synchronized local SGD in this notation, then it holdsWk,ht =W k′,h′ t for all k, h, k ′, h′, as all the writes and reads are synchronized. Theorem 5.1. Let f , σ, G and κ be as in Theorem 5.1 and sequences {xkt }Tt=0 for k ∈ [K] generated according to (14) with gap(IkT ) ≤ H for k ∈ K and for stepsizes ηt = 4µ(a+t) with shift parameter a > max{16κ,H + τ} for delay τ > 0. IfWk,ht ⊇ [t− τ ] for all k, h ∈ [K], t ∈ [T ], then
E f(x̂T )− f? ≤ µa3
2ST ‖x0 − x?‖2 +
4T (T + 2a)
µKST σ2 +
768T µ2ST G2(H + σ)2L , (16)
where x̂T = 1KST ∑K k=1 ∑T−1 t=0 wtx k t , for wt = (a+ t) 2 and ST = ∑T−1 t=0 wt ≥ 1 3T 3.
Hence, for T large enough and (H + τ) = O( √ T/K), asynchronous local SGD converges with rate
O ( G2
KT
) , the same rate as synchronous local SGD.

heading: 6 CONCLUSION
text: We prove convergence of synchronous and asynchronous local SGD and are the first to show that local SGD (for nontrivial values of H) attains theoretically linear speedup on strongly convex functions when parallelized among K workers. We show that local SGD saves up to a factor of O(T 1/2) in global communication rounds compared to mini-batch SGD, while still converging at the same rate in terms of total stochastic gradient computations.
Deriving more concise convergence rates for local SGD could be an interesting future direction that could deepen our understanding of the scheme. For instance one could aim for a more fine grained analysis in terms of bias and variance terms (similar as e.g. in Dekel et al. (2012); Jain et al. (2018)), relaxing the assumptions (here we relied on the bounded gradient assumption), or investigating the data dependence (e.g. by considering data-depentent measures like e.g. gradient diversity Yin et al. (2018)). There are also no apparent reasons that would limit the extension of the theory to non-convex objective functions; Lemma 3.3 does neither use the smoothness nor the strong convexity assumption, so this can be applied in the non-convex setting as well. We feel that the positive results shown here can motivate and spark further research on non-convex problems. Indeed, very recent work (Zhou & Cong, 2018; Yu et al., 2018) analyzes local SGD for non-convex optimization problems and shows convergence of SGD to a stationary point, though the restrictions on H are stronger than here.

heading: ACKNOWLEDGMENTS
text: The author thanks Jean-Baptiste Cordonnier, Tao Lin and Kumar Kshitij Patel for spotting various typos in the first versions of this manuscript, as well as Martin Jaggi for his support.

heading: A MISSING PROOFS FOR SYNCHRONIZED LOCAL SGD
text: In this section we provide the proofs for the three lemmas that were introduced in Section 3.
Proof of Lemma 3.1. Using the update equation (7) we have
‖x̄t+1 − x?‖2 = ‖x̄t − ηtgt − x?‖2 = ‖x̄t − ηtgt − x? − ηtḡt + ηtḡt‖2 (17) = ‖x̄t − x? − ηtḡt‖2 + η2t ‖gt − ḡt‖ 2 + 2ηt 〈x̄t − x? − ηtḡt, ḡt − gt〉 . (18)
Observe that
‖x̄t − x? − ηtḡt‖2 = ‖x̄t − x?‖2 + η2t ‖ḡt‖ 2 − 2ηt 〈x̄t − x?, ḡt〉 (19)
= ‖x̄t − x?‖2 + η2t ‖ḡt‖ 2 − 2ηt
1
K K∑ k=1 〈 x̄t − x?,∇f(xkt ) 〉 (20)
≤ ‖x̄t − x?‖2 + η2t 1
K K∑ k=1 ∥∥∇f(xkt )∥∥2 − 2ηt 1
K K∑ k=1 〈 x̄t − xtk + xtk − x?,∇f(xkt ) 〉 (21)
= ‖x̄t − x?‖2 + η2t 1
K K∑ k=1 ∥∥∇f(xkt )−∇f(x?)∥∥2 − 2ηt 1
K K∑ k=1 〈 xtk − x?,∇f(xkt ) 〉 − 2ηt 1 K K∑ k=1 〈 x̄t − xtk,∇f(xkt ) 〉 ,
(22) where we used the inequality ‖ ∑K i=1 ai‖2 ≤ K ∑K i=1 ‖ai‖
2 in (21). By L-smoothness,∥∥∇f(xkt )−∇f(x?)∥∥2 ≤ 2L(f(xkt )− f?) , (23) and by µ-strong convexity
− 〈 xkt − x?,∇f(xkt ) 〉 ≤ −(f(xkt )− f?)− µ
2 ∥∥xkt − x?∥∥2 . (24) To estimate the last term in (22) we use 2 〈a,b〉 ≤ γ ‖a‖2 + γ−1 ‖b‖2, for γ > 0. This gives
−2 〈 x̄t − xtk,∇f(xkt ) 〉 ≤ 2L ∥∥x̄t − xtk∥∥2 + 12L ∥∥∇f(xkt )∥∥2 (25) = 2L
∥∥x̄t − xtk∥∥2 + 12L ∥∥∇f(xkt )−∇f(x?)∥∥2 (26) ≤ 2L
∥∥x̄t − xtk∥∥2 + (f(xkt )− f?) , (27) where we have again used (23) in the last inequality. By applying these three estimates to (22) we get
‖x̄t − x? − ηtḡt‖2 ≤ ‖x̄t − x?‖2 + 2ηt L
K K∑ k=1 ∥∥x̄t − xtk∥∥2 + 2ηt 1
K K∑ k=1 (( ηtL− 1 2 ) (f(xkt )− f?)− µ 2 ∥∥xkt − x?∥∥2) . (28)
For ηt ≤ 14L it holds ( ηtL− 12 ) ≤ − 14 . By convexity of a (f(x)− f ?) + b ‖x− x?‖2 for a, b ≥ 0:
− 1 K K∑ k=1 ( a(f(xkt )− f?) + b ∥∥xkt − x?∥∥2) ≤ −(a(f(x̄t)− f?) + b ‖x̄t − x?‖2) , (29)
hence we can continue in (28) and obtain
‖x̄t − x? − ηtḡt‖2 ≤ (1− µηt) ‖x̄t − x?‖2 − 1
2 ηt(f(x̄t)− f?) + 2ηt
L
K K∑ k=1 ∥∥x̄t − xkt ∥∥2 . (30) Finally, we can plug (30) back into (18). By taking expectation we get
E ‖x̄t+1 − x?‖2 ≤ (1− µηt)E ‖x̄t − x?‖2 + η2t E ‖gt − ḡt‖ 2
− 1 2 ηt E(f(x̄t)− f?) + 2ηt L K K∑ k=1 E ∥∥x̄t − xkt ∥∥2 .
Proof of Lemma 3.2. By definition of gt and ḡt we have E ‖gt − ḡt‖2 = E ∥∥∥ 1 K K∑ k=1 ( ∇fikt (x k t )−∇f(xkt ) )∥∥∥2= 1 K2 K∑ k=1 E ∥∥∥∇fikt (xkt )−∇f(xkt )∥∥∥2 ≤ σ2K ,
(31)
where we used Var( ∑K k=1Xk) = ∑K k=1 Var(Xk) for independent random variables.
Proof of Lemma 3.3. As the gap(IT ) ≤ H , there is an index t0, t− t0 ≤ H such that x̄t0 = xkt0 for k ∈ [K]. Observe, using E ‖X − EX‖2 = E ‖X‖2 − ‖EX‖2 and ‖ ∑H i=1 ai‖2 ≤ H ∑H i=1 ‖ai‖ 2,
1
K K∑ k=1 E ∥∥x̄t − xkt ∥∥2 = 1K K∑ k=1 E ∥∥xkt − xt0 − (x̄t − xt0)∥∥2 (32)
≤ 1 K K∑ k=1 E ∥∥xkt − xt0∥∥2 (33)
≤ 1 K K∑ k=1 Hη2t0 t−1∑ h=t0 E ∥∥∥∇fikh(xkh)∥∥∥2 (34)
≤ 1 K K∑ k=1 H2η2t0G 2 , (35)
where we used ηt ≤ ηt0 for t ≥ t0 and the assumption E‖∇fikh(x k h)‖2 ≤ G2. Finally, the claim follows by the assumption on the stepsizes, ηt0ηt ≤ 2.

heading: B MISSING PROOF FOR ASYNCHRONOUS LOCAL SGD
text: In this Section we prove Theorem 5.1. The proof follows closely the proof presented in Section 3. We again introduce the virtual sequence
x̄t = x0 − 1
K K∑ h=1 t−1∑ j=0 ηj∇fikj (x k j ) , (36)
as before. By the property T ∈ IkT for k ∈ K we know that all workers will have written their updates when the algorithm terminates. This assumption is not very critical and could be relaxed, but it facilitates the (already quite heavy) notation in the proof.
Observe, that Lemmas 3.1 and 3.2 hold for the virtual sequence {x̄t}Tt=0. Hence, all we need is a refined version of Lemma 3.3 that bounds how far the local sequences can deviate from the virtual average.
Lemma B.1. If gap(IkT ) ≤ H and ∃τ > 0, s.t. W k,h t ⊇ [t − τ ] for all k, h ∈ [K], t ∈ [T ], and sequence of decreasing positive stepsizes {ηt}t≥0 satisfying ηt ≤ 2ηt+H+τ for all t ≥ 0, then
1
K K∑ k=1 E ∥∥x̄t − xkt ∥∥2 ≤ 12η2tG2(H + τ)2 , (37)
where G2 is a constant such that Ei‖∇fi(xkt )‖2 ≤ G2 for k ∈ [K], t ∈ [T ].
Here we use the notation [s] = {} for s < 0, such that [t− τ ] is also defined for t < τ .
Proof. As gap(IkT ) ≤ H there exists for every k ∈ K a tk, t − tk ≤ H , such that xktk = x̄ k tk . Let t0 := min{t1, . . . , tK} and observe t0 ≥ t−H . Let t′0 = max{t0 − τ, 0}. AsW k,h t ⊇ [t− τ ] for all k, h ∈ [K], t ∈ [T ], it holds
x̄ktk = x̄t′0 − 1
K K∑ h=1 tk−1∑ j=t′0 1j∈Wk,htk (ηj∇fikj (x k j )) , (38)
for each k ∈ [K]. In other words, all updates up to iteration t′0 have been written to the aggregated sequence.
We decompose the error term as∥∥x̄t − xkt ∥∥2 ≤ 3(∥∥xkt − xktk∥∥2 + ∥∥xktk − x̄t′0∥∥2 + ∥∥x̄t′0 − x̄t∥∥2) . (39) Now, using ηt ≥ ηt+1, and t− tk ≤ H , we conclude (as in (35))∥∥xkt − xktk∥∥2 ≤ η2tkH2G2 ≤ η2t′0H2G2 . (40)

heading: As tk − t′0 ≤ τ , ∥∥xktk − x̄t′0∥∥2 ≤ η2t′0τ2G2 , (41)
text: and similarly, as t− t′0 ≤ H + τ ,∥∥x̃t′0 − x̃t∥∥2 ≤ η2t′0(H + τ)2G2 . (42) Finally, as
ηt′0 ηt ≤ 2, we can conclude∥∥x̄t − xkt ∥∥2 ≤ 12η2t (H + τ)2G2 . (43)
and the lemma follows.
Now the proof of Theorem 5.1 follows immediately.
Proof of Theorem 5.1. As in the proof of Theorem 2.2 we rely on Lemma 3.4 to derive the convergence rate. Again, we have A = 12 , B = σ2 K , and C = LG 2(H + τ)2 (Lemma B.1). It is easy to see that the stepsizes satisfy the condition of Lemma B.1, as clearly ηt′0 ηt ≤ ηt′0 ηt′0+H+τ
= a+t+H+τa+t ≤ 2, as a ≥ H + τ .

heading: C COMMENTS ON IMPLEMENTATION ISSUES
text: C.1 SYNCHRONOUS LOCAL SGD
In Theorem 5 we do not prove convergence of the sequences {xkt }t≥0 of the iterates, but only convergence of a weighted average of all iterates. In practice, the last iterate might often be sufficient, but we like to remark that the weighted average of the iterates can easily be tracked on the fly with an auxiliary sequence {yt}t>0, y0 = x0, without storing all intermediate iterates, see Table 1 for some examples.
C.2 ASYNCHRONOUS LOCAL SGD
As for synchronous local SGD, the weighted averages of the iterates (if needed), can be tracked on each worker locally by a recursive formula as explained above.
A more important aspect that we do not have discussed yet, is that Algorithm 2 allows for an easy procedure to balance the load in heterogeneous settings. In our notation, we have always associated the local sequences {xkt } with a specific worker k. However, the computation of the sequences does not need to be tied to a specific worker. Thus, a fast worker k that has advanced his local sequence too much already, can start computing updates for another sequence k′ 6= k, if worker k′ is lagged behind. This was not possible in the synchronous model, as there all communications had to happen in sync. We demonstrate this principle in Table 2 below for two workers. Note that also the running averages can still be maintained.

heading: D DETAILS ON EXPERIMENTS
text: We here state the precise procedure that was used to generate the figures in this report. As briefly stated in Section 4 we examine empirically the speedup on a logistic regression problem, f(x) = 1 n ∑n i=1 log(1 + exp(−bia>i x)) + λ 2 ‖x‖
2, where ai ∈ Rd and bi ∈ {−1,+1} are the data samples. The regularization parameter is set to λ = 1/n. We consider the small scale w8a dataset (Platt, 1999) (d = 300, n = 49749).
For each run, we initialize x0 = 0d and measure the number of iterations6 (and number of stochastic gradient evaluations) to reach the target accuracy ∈ {0.005, 0.0001}. As we prove convergence only for a special weighted sum of the iterates in Theorem 2.2 and not for standard criteria (last iterate or uniform average), we evaluate the function value for different weighted averages yt = 1∑t i=0 wi ∑t i=0 wixt, and consider the accuracy reached when one of the averages satisfies f(yt)− f? ≤ , with f? := 0.126433176216545 (numerically determined). The precise formulas for the averages that we used are given in Table 1.
For each configuration (K,H, b, ), we report the best result found with any of the following two stepsizes: ηt := min(32, cnt+1 ) and ηt = 32c. Here c is a parameter that can take the values c = 2
i for i ∈ Z. For each stepsize we determine the best parameter c by a grid search, and consider parameter c optimal, if parameters {2−2c, 2−1c, 2c, 22c} yield worse results (i.e. more iterations to reach the target accuracy).
6Note, that besides the randomness involved the stochastic gradient computations, the averaging steps of synchronous local SGD are deterministic. Hence, these results (convergence in terms if numbers of iterations) can be reproduced by just simulating local SGD by using virtual workers (which we did for large number of K). For completeness, we report that all experiments were run on an an Ubuntu 16.04 machine with a 24 cores processor Intel R© Xeon R© CPU E5-2680 v3 @ 2.50GHz.
In Figures 4 and 5 we give additional results for mini-batch sizes b ∈ {1, 16}.

Review summaries:
The authors of this paper analyze a well known technique for parallel training, where each compute node locally trains a model with SGD, and once in a while the K compute nodes average their models. Local SGD, although not as widely used as mini-batch SGD, can provide some gains in terms of the cost of communication. This can be achieved by decreasing the frequency of synchronization, while locally also increasing the minibatch.