Title: LOCAL SGD CONVERGES FAST AND COMMUNICATES LITTLE

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 1/2 -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.

1. INTRODUCTION:

Stochastic Gradient Descent (SGD) (Robbins & Monro, 1951) consists of iterations of the form

EQUATION

for iterates (weights) x t , x t+1 ∈ R d , stepsize (learning rate) η t > 0, and stochastic gradient g t ∈ R d with the property E g t = ∇f (x t ), for a loss function f : R d → R. This scheme can easily be parallelized by replacing g t 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 x t+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.

1.1. CONTRIBUTIONS:

We consider finite-sum convex optimization problems f : R d → R of the form

EQUATION

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 xT 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

EQUATION

with second moment bound G 2 ≥ E ∇f i (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 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) ).

1.2. RELATED WORK:

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/4 K -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, 1 2 ) 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.

1.3. OUTLINE:

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 x k 0 = x 0 for workers k ∈ [K] 2: for t in 0 . . . T -1 do 3: parallel for k ∈ [K] do 4: Sample i k t uniformly in [n] 5: if t + 1 ∈ I T then 6: x k t+1 ← 1 K K k=1 x k t -η t ∇f i k t (x k t ) global synchronization 7:

else 8:

x k t+1 ← x k t -η t ∇f i k t (x k t ) local update 9:

end if 10:

end parallel for 11: end for

2. LOCAL SGD:

The algorithm local SGD (depicted in Algorithm 1) generates in parallel

K sequences {x k t } T t=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 T K). Let I T ⊆ [T ] with T ∈ I T denote a set of synchronization indices. Then local SGD evolves the sequences {x k t } T t=0 in the following way:

EQUATION

where indices i k t ∼ u.a.r.

[n] and {η t } t≥0 denotes a sequence of stepsizes. If I T = [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 I T = {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 := {p 0 , . . . , p t } of t + 1 integers, p i ≤ p i+1 for i = 0, . . . , t -1, is defined as gap(P) := max i=1,...,t (p i -p i-1 ).

2.1. VARIANCE REDUCTION IN LOCAL SGD:

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 T5 on strongly convex and smooth functions f , where

σ 2 ≥ E ∇f i k t (x k t ) -∇f (x k t ) 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 T K , 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 x k t evolve close to each other. Then it is reasonable to assume that averaging the stochastic gradients ∇f i k t (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.

2.2. CONVERGENCE RESULT AND DISCUSSION:

Theorem 2.2. Let f be L-smooth and µ-strongly convex,

E i ∇f i (x k t ) -∇f (x k t ) 2 ≤ σ 2 , E i ∇f i (x k t ) 2 ≤ G 2 , for t = 0, . . . , T -1, where {x k t } T t=0 for k ∈ [K]

are generated according to (4) with gap(I T ) ≤ H and for stepsizes η t = 4 µ(a+t) with shift parameter a > max{16κ, H}, for κ

EQUATION

where xT = 1

KS T K k=1 T -1 t=0 w t x k t , for w t = (a + t) 2 and S T = T -1 t=0 w t ≥ 1 3 T 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 xT be as defined as in Theorem 2.2, for parameter a = max{16κ, H}. Then

EQUATION

)

For the last estimate we used E µ x 0 -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 G 2 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/(KT b)). 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 .

3. PROOF OUTLINE:

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:

EQUATION

where the sequences {x k t } 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 xt = x k t for k ∈ [K] whenever t ∈ I T . Especially, when

I T = [T ], then xt ≡ x k t for every k ∈ [K], t ∈ [T ].

It will be useful to define

EQUATION

Observe xt+1 = xt -η t g t and E g t = ḡ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 {x k t } 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 {x t } 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 ≤ 1 4L . Then

EQUATION

)

Bounding the variance. From equation ( 9) it becomes clear that we should derive an upper bound on E g t -ḡt 2 . We will relate this to the variance σ 2 .

Lemma 3.2. Let σ 2 ≥ E i ∇f i (x k t ) -∇f (x k t ) 2 for k ∈ [K], t ∈ [T ]. Then E g t -ḡt 2 ≤ σ 2 K .

Bounding the deviation. Further, we need to bound 1

K K k=1 E xt -x k t 2

. For this we impose a condition on I T and an additional condition on the stepsize η t . Lemma 3.3. If gap(I T ) ≤ H and sequence of decreasing positive stepsizes {η t } t≥0 satisfying η t ≤ 2η t+H for all t ≥ 0, then

EQUATION

)

where G 2 is a constant such that

E i ∇f i (x k t ) 2 ≤ G 2 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 {a t } t≥0 , a t ≥ 0, {e t } t≥0 , e t ≥ 0 be sequences satisfying

EQUATION

)

EQUATION

for w t = (a + t) 2 and S T :=

T -1

t=0 w t = T 6 2T 2 + 6aT -3T + 6a 2 -6a + 1 ≥ 1 3 T 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 ≤ 1 S T

T -1 t=0 w t 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 e t := E(f (x t ) -f ) and constants A = 1 2 , (Lemma 3.1), B = σ 2 K , (Lemma 3.2) and C = 8G 2 H 2 L, (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. (a) Theoretical speedup S(K) ( > 0, T small). 

4. NUMERICAL ILLUSTRATION:

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, T K, 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)

≈ 1 K 1 2 + 1 2 1 + (1 + H + H 2 K) .

Thus, the theoretical speedup S(K) of local SGD on K machines compared to SGD on one machine (H = 1, K = 1) is

EQUATION

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(-b i a i x)) + λ 2 x 2

, where a i ∈ R d and b i ∈ {-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 x 0 = 0 d 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, cn t+1 ), 32c}, where c can take the values c = 2 i 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 x k 0 = x 0 , r k = 0 for k ∈ [K], aggregate x = x 0 . 2: parallel for k ∈ [K] do 3: for t in 0 . . . T -1 do 4: Sample i k t uniformly in [n] 5: x k t+1 ← x k t -η t ∇f i k t (x k t ) local update 6: if t + 1 ∈ I k T then 7: x ← add( x, 1 K (x k t+1 -x k r k ))

atomic aggregation of the updates 8:

x k t+1 ← read( x); 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) .

5. ASYNCHRONOUS LOCAL SGD:

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 {x k t } T t=0 of iterates, k ∈ [K].

Similar as in Section 2 we introduce sets of synchronization indices,

I k t ⊆ [T ] with T ∈ I k T for k ∈ [K]

. Note that the sets do not have to be equal for different workers. Each worker k evolves locally a sequence x k t in the following way:

EQUATION

)

where xk t+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

EQUATION

where W k,h t ⊆ [T ] denotes all updates that have been written at the time the read takes place. The sets W k,h t 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 {x h t } 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

W k,h t = W k ,h t for k = k . We have W 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 holds W k,h t = 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 {x k t } T t=0 for k ∈ [K] generated according to (14) with gap(I k T ) ≤ H for k ∈ K and for stepsizes η t = 4 µ(a+t) with shift parameter a > max{16κ, H + τ } for delay τ > 0.

EQUATION

where xT = 1

KS T K k=1 T -1 t=0 w t x k t , for w t = (a + t) 2 and S T = T -1 t=0 w t ≥ 1 3 T 3 .

Hence, for T large enough and (H + τ ) = O( T /K), asynchronous local SGD converges with rate O G 2 KT , the same rate as synchronous local SGD.

6. CONCLUSION:

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.

A MISSING PROOFS FOR SYNCHRONIZED LOCAL SGD:

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

EQUATION

EQUATION

EQUATION

where we used the inequality

EQUATION

and by µ-strong convexity

EQUATION

)

To estimate the last term in ( 22) we use 2 a, b ≤ γ a 2 + γ -1 b 2 , for γ > 0. This gives

EQUATION

where we have again used (23) in the last inequality. By applying these three estimates to ( 22) we get

EQUATION

EQUATION

)

hence we can continue in ( 28) and obtain

xt -x -η t ḡt 2 ≤ (1 -µη t ) xt -x 2 - 1 2 η t (f (x t ) -f ) + 2η t L K K k=1 xt -x k t 2 . (30)

Finally, we can plug (30) back into (18) . By taking expectation we get

E xt+1 -x 2 ≤ (1 -µη t ) E xt -x 2 + η 2 t E g t -ḡt 2 - 1 2 η t E(f (x t ) -f ) + 2η t L K K k=1 E xt -x k t 2 .

Proof of Lemma 3.2. By definition of g t and ḡt we have

EQUATION

where we used Var(

K k=1 X k ) = K k=1

Var(X k ) for independent random variables.

Proof of Lemma 3.3. As the gap(I T ) ≤ H, there is an index t 0 , t -

EQUATION

where we used η t ≤ η t0 for t ≥ t 0 and the assumption

E ∇f i k h (x k h ) 2 ≤ G 2 .

Finally, the claim follows by the assumption on the stepsizes,

ηt 0 ηt ≤ 2.

B MISSING PROOF FOR ASYNCHRONOUS LOCAL SGD:

In this Section we prove Theorem 5.1. The proof follows closely the proof presented in Section 3. We again introduce the virtual sequence

EQUATION

as before. By the property T ∈ I k T 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 } T t=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(I k T ) ≤ 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

EQUATION

)

where G 2 is a constant such that

E i ∇f i (x k t ) 2 ≤ G 2 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(I k T ) ≤ H there exists for every k

EQUATION

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

EQUATION

Now, using η t ≥ η t+1 , and t -t k ≤ H, we conclude (as in ( 35))

EQUATION

EQUATION

and similarly, as t -t 0 ≤ H + τ ,

EQUATION

)

Finally, as

EQUATION

)

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 = 1 2 , 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 + τ . C COMMENTS ON IMPLEMENTATION ISSUES C.1 SYNCHRONOUS LOCAL SGD

In Theorem 5 we do not prove convergence of the sequences {x k t } 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 {y t } t>0 , y 0 = x 0 , without storing all intermediate iterates, see 

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 {x k t } 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 = 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. 

wall clock time → → → → → → worker 1 x 1 H ← U( x) x 1 2H ← U( x) x 1 3H ← U( x) x 2 2H ← U( x) x 2 4H ← U( x) x 1 4H ← U( x) • • • worker 2 x 2 H ← U( x) x 2 3H ← U( x) • • •

D DETAILS ON EXPERIMENTS:

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(-b i a i x)) + λ 2 x 2 , where a i ∈ R d and b i ∈ {-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 x 0 = 0 d 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 y t = 1 t i=0 wi t i=0 w i x t , and consider the accuracy reached when one of the averages satisfies f (y t )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, cn t+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 -2 c, 2 -1 c, 2c, 2 2 c} yield worse results (i.e. more iterations to reach the target accuracy).

:

On 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.

f (y) ≤ f (x) + ∇f (x), yx + L 2 yx 2 , ∀x, y ∈ R d .

f (y) ≥ f (x) + ∇f (x), yx + µ 2 yx 2 , ∀x, y ∈ R d .

For 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.

For the ease of presentation, we here assume that the bias term is negligible compared to the variance term.

Note, 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.

Figures and Tables:

Figure 1: Illustration of the speedup (3) for time-to-accuracy when either increasing mini-batch size b (1 → 2) or communication inverval H (1 → 2), for compute to communication ratio ρ = 25.

speedup S(K) ( = 0, T → ∞).

Figure 2: Theoretical speedup of local SGD for different numbers of workers K and H.

Figure 3: Measured speedup of local SGD with mini-batch b = 4 for different numbers of workers K and parameters H.

) 2 x i y t = 6(t+1) (t+2)(2t+3) x t + t(1+2t)6+7t+2t 2 y t-1

Table content: <table><tr><td>for some</td></tr></table>

Formulas to recursively track weighted averages.

Table content: <table/>

Simple load balancing. The faster worker can advance both sequences, even when the slower worker has not yet finished the computation. In the example each worker does H steps of local SGD (denoted by the operator U : R d → R d ) before writing back the updates to the aggregate x. Due to the load balancing, τ ≤ 3H.

Table content: <table/>

Peer review (iclr2019):
 This paper presents an analysis of "local SGD", which averages estimators obtained by running SGD in separate machines once in a while. The paper presents bounds on "how frequent" the estimators required to be averaged in order to yield linear parallelization speedups. This is an interesting paper, but I have some concerns that I will elaborate on below: [1] This paper*s assumption of bounded variance of Stochastic Gradients and drawing conclusions about frequency of averaging does not reflect practical implementations of SGD for Machine Learning contexts. For example, note that in this oracle model, there exists bound on batch size (T^alpha, alpha.in[1/3,1/2]) that yield linear parallelization speedups (for example, see Dekel et al. (2012)); however, as Dekel et al (2012) note, such bounds are fairly crude estimates on a per-problem basis for practical purposes. These issues naturally continue to exist with regards to the upperbound on the frequency of communication as argued by this paper. [2] Furthermore, the claim that such a bound on frequency of communication for local SGD which is not known before is not really true. In the convex case, the paper of Jain et al. (2016) presents a precise characterization of when to average of iterates across machines to obtain linear parallelization speedups, and this is a problem dependent quantity that works without assumptions such as bounded variance of stochastic gradients for the least squares problem. Note that, as reflective in practice, this result conveys that averaging the solutions of multiple independent runs of SGD does not help anything when the bias (initial error) dominates the variance. [3] Note that local SGD has been known for a while and is referred to as Iterative Parameter Mixing in the literature. An example of this is the thesis of Greg Coppola (2015). A more careful literature search can provide more references/results on this topic. [4] This paper claims that (in page 2) in order to "improve computation versus communication tradeoff, one can increase the batch size or increase communication interval". This appears to be an imprecise statement. For example, if I kept increasing batchsize without any limit, and the bias in my problem is much larger than the variance (where bias and variance follows definitions from Bach and Moulines (2011,2013)), this does not lead to any parallelization speedup. This is in contrast to when the variance dominates the bias, wherein, model averaging/increasing batch size helps. What is the reason for the authors to conclude that increasing batch size is equivalent to increasing communication interval?