Local SGD Converges Fast and Communicates Little

Sebastian U. Stich

Introduction

Stochastic Gradient Descent (SGD) consists of iterations of the form

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 where the local sequences are only exchanged once, after the local runs have converged. Zhang et al. show statistical convergence (see also ), 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. for perceptron training (iterative parameter mixing), see also , for the training of deep neural networks (model averaging) or in federated learning .

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 KK workers is KK times faster than running just a single instance of SGD on one worker.On convex functions, the average of the KK local solutions can of course only decrease the objective value, but convexity does not imply that the averaged point is KK times better.

We fill this gap in the literature and provide a concise convergence analysis of local SGD. We show that averaging helps. Frequent synchronization of KK local sequences increases the convergence rate by a factor of KK, 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.

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

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 , or random quantization . The ZipML framework applies this technique also to the data . Sparsification methods reduce the number of non-zero entries in the stochastic gradient . 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 .

Allowing asynchronous updates provides an alternative solution to disguise the communication overhead to a certain amount , though alternative strategies might be better when high accuracy is desired . The analysis of Agarwal & Duchi shows that asynchronous SGD on convex functions can tolerated delays up to O(T/K)O(\sqrt{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 ) 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. discuss a stochastic averaging schedule whereas Zhang et al. study local SGD with more frequent communication at the beginning of the optimization process. The elastic averaging technique 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 that did not establish a speedup, in contrast to two more recent analyses . Yu et al. show linear speedup of local SGD on non-convex functions for H=O(T1/4K3/4)H=O(T^{1/4}K^{-3/4}), which is more restrictive than the constraint on HH in the convex setting. Lin et al. study empirically hierarchical variants of local SGD.

Local SGD with averaging in every step, i.e. H=1H=1, is identical to mini-batch SGD. Dekel et al. show that batch sizes b=Tδb=T^{\delta}, for δ(0,12)\delta\in(0,\tfrac{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 HH derived here. Local SGD with averaging only at the end, i.e. H=TH=T, is identical to one-shot SGD. Jain et al. 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 HTH\to T and our results do not cover one-shot SGD.

Recently, Woodworth et al. 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.

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.

Local SGD

The algorithm local SGD (depicted in Algorithm 1) generates in parallel KK sequences {xtk}t=0T\{\mathbf{x}_{t}^{k}\}_{t=0}^{T} of iterates, k[K]k\in[K]. Here KK denotes the level of parallelization, i.e. the number of distinct parallel sequences and TT the number of steps (i.e. the total number of stochastic gradient evaluations is TKTK). Let IT[T]\mathcal{I}_{T}\subseteq[T] with TITT\in\mathcal{I}_{T} denote a set of synchronization indices. Then local SGD evolves the sequences {xtk}t=0T\{\mathbf{x}_{t}^{k}\}_{t=0}^{T} in the following way:

where indices itku.a.r.[n]i_{t}^{k}\sim_{\rm u.a.r.}[n] and {ηt}t0\{\eta_{t}\}_{t\geq 0} denotes a sequence of stepsizes. If IT=[T]\mathcal{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 KK.For the ease of presentation, we assume here that each worker in local SGD only processes a mini-batch of size b=1b=1. This can be done without loss of generality, as we discuss later in Remark 2.4. On the other extreme, if IT={T}\mathcal{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.

The gap of a set P:={p0,,pt}\mathcal{\mathcal{P}}:=\{p_{0},\dots,p_{t}\} of t+1t+1 integers, pipi+1p_{i}\leq p_{i+1} for i=0,,t1i=0,\dots,t-1, is defined as gap(P):=maxi=1,,t(pipi1)\operatorname{gap}(\mathcal{P}):=\max_{i=1,\dots,t}(p_{i}-p_{i-1}).

Before jumping to the convergence result, we first discuss an important observation.

Towards local SGD.

For local SGD such a simple argument is elusive. For instance, just capitalizing the convexity of the objective function ff is not enough: this will show that the averaged iterate of KK independent SGD sequences converges at rate \mathcal{O}\bigl{(}\frac{\sigma^{2}}{T}\bigr{)}, i.e. no speedup can be shown in this way.

This indicates that one has to show that local SGD decreases the variance σ2\sigma^{2} instead, similar as in parallel SGD. Suppose the different sequences xtk\mathbf{x}_{t}^{k} evolve close to each other. Then it is reasonable to assume that averaging the stochastic gradients fitk(xtk)\nabla f_{i_{t}^{k}}(\mathbf{x}_{t}^{k}) for all k[K]k\in[K] can still yield a reduction in the variance by a factor of KK—similar as in parallel SGD. Indeed, we will make this statement precise in the proof below.

2 Convergence Result and Discussion

where x^T=1KSTk=1Kt=0T1wtxtk\hat{\mathbf{x}}_{T}=\frac{1}{KS_{T}}\sum_{k=1}^{K}\sum_{t=0}^{T-1}w_{t}\mathbf{x}_{t}^{k}, for wt=(a+t)2w_{t}=(a+t)^{2} and ST=t=0T1wt13T3S_{T}=\sum_{t=0}^{T-1}w_{t}\geq\frac{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.

Let x^T\hat{\mathbf{x}}_{T} be as defined as in Theorem 2.2, for parameter a=max{16κ,H}a=\max\{16\kappa,H\}. Then

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 bb in each iteration. This reduces the variance by a factor of bb, and thus Theorem (2.2) gives the convergence rate of mini-batch local SGD when σ2\sigma^{2} is replaced by σ2b\frac{\sigma^{2}}{b}.

We now state some consequences of equation (6). For the ease of the exposition we omit the dependency on LL, μ\mu, σ2\sigma^{2} and G2G^{2} below, but depict the dependency on the local mini-batch size bb.

For TT large enough and assuming σ>0\sigma>0, the very first term is dominating in (6) and local SGD converges at rate O(1/(KTb))O(1/(KTb)). That is, local SGD achieves a linear speedup in both, the number of workers KK and the mini-batch size bb.

It needs to hold H=O(T/(Kb))H=O(\sqrt{T/(Kb)}) to get the linear speedup. This yields a reduction of the number of communication rounds by a factor O(T/(Kb))O(\sqrt{T/(Kb)}) compared to parallel mini-batch SGD without hurting the convergence rate.

We have not optimized the result for extreme settings of HH, KK, LL or σ\sigma. For instance, we do not recover convergence for the one-shot averaging, i.e. the setting H=TH=T (though convergence for H=o(T)H=o(T), but at a lower rate).

Zhang et al. empirically observe that more frequent communication at the beginning of the optimization can help to get faster time-to-accuracy (see also ). Indeed, when the number of total iterations TT 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))H=O(\sqrt{T/(Kb)}) for all TT.

Proof Outline

We now give the outline of the proof. The proofs of the lemmas are given in Appendix A.

Inspired by the perturbed iterate framework of we first define a virtual sequence {xˉt}t0\{\bar{\mathbf{x}}_{t}\}_{t\geq 0} in the following way:

where the sequences {xtk}t0\{\mathbf{x}_{t}^{k}\}_{t\geq 0} for k[K]k\in[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=xtk\bar{\mathbf{x}}_{t}=\mathbf{x}_{t}^{k} for k[K]k\in[K] whenever tITt\in\mathcal{I}_{T}. Especially, when IT=[T]\mathcal{I}_{T}=[T], then xˉtxtk\bar{\mathbf{x}}_{t}\equiv\mathbf{x}_{t}^{k} for every k[K],t[T]k\in[K],t\in[T]. It will be useful to define

Now the proof proceeds as follows: we show (i) that the virtual sequence {xˉt}t0\{\bar{\mathbf{x}}_{t}\}_{t\geq 0} almost behaves like mini-batch SGD with batch size KK (Lemma 3.1 and 3.2), and (ii) the true iterates {xtk}t0,k[K]\{\mathbf{x}_{t}^{k}\}_{t\geq 0,k\in[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 .

Let {xt}t0\{\mathbf{x}_{t}\}_{t\geq 0} and {xˉt}t0\{\bar{\mathbf{x}}_{t}\}_{t\geq 0} for k[K]k\in[K] be defined as in (4) and (7) and let ff be LL-smooth and μ\mu-strongly convex and ηt14L\eta_{t}\leq\frac{1}{4L}. Then

Bounding the variance.

Bounding the deviation.

If gap(IT)H\operatorname{gap}(\mathcal{I}_{T})\leq H and sequence of decreasing positive stepsizes {ηt}t0\{\eta_{t}\}_{t\geq 0} satisfying ηt2ηt+H\eta_{t}\leq 2\eta_{t+H} for all t0t\geq 0, then

Optimal Averaging.

Similar as in we define a suitable averaging scheme for the iterates {xˉt}t0\{\bar{\mathbf{x}}_{t}\}_{t\geq 0} to get the optimal convergence rate. In contrast to that use linearly increasing weights, we use quadratically increasing weights, as for instance .

Let {at}t0\{a_{t}\}_{t\geq 0}, at0a_{t}\geq 0, {et}t0\{e_{t}\}_{t\geq 0}, et0e_{t}\geq 0 be sequences satisfying

for ηt=4μ(a+t)\eta_{t}=\frac{4}{\mu(a+t)} and constants A>0A>0, B,C0B,C\geq 0, μ>0\mu>0, a>1a>1. Then

for wt=(a+t)2w_{t}=(a+t)^{2} and ST:=t=0T1wt=T6(2T2+6aT3T+6a26a+1)13T3S_{T}:=\sum_{t=0}^{T-1}w_{t}=\frac{T}{6}\left(2T^{2}+6aT-3T+6a^{2}-6a+1\right)\geq\frac{1}{3}T^{3}.

This is a reformulation of Lemma 3.3 in . ∎

Proof of Theorem 2.2.

Numerical Illustration

In this section we show some numerical experiments to illustrate the results of Theorem 2.2.

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, TKTK, and (ii) the total time spend for communication. In each communication round 2(K1)2(K-1) vectors need to be exchanged, and there will be T/HT/H communication rounds. Typically, the communication is more expensive than a single gradient computation. We will denote this ratio by a factor ρ1\rho\geq 1 (in practice, ρ\rho can be 10–100, or even larger on slow networks). The parameter TT depends on the desired accuracy ϵ>0\epsilon>0, and according to (6) we roughly have T(ϵ,H,K)1Kϵ(12+121+ϵ(1+H+H2K))T(\epsilon,H,K)\approx\frac{1}{K\epsilon}\left(\tfrac{1}{2}+\tfrac{1}{2}\sqrt{1+\epsilon(1+H+H^{2}K)}\right). Thus, the theoretical speedup S(K)S(K) of local SGD on KK machines compared to SGD on one machine (H=1H=1, K=1K=1) is

Theoretical.

Examining (13), we see that (i) increasing HH 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\epsilon\ll 1 (i.e. TT large enough, in agreement with the theory). In Figure 3 we depict S(K)S(K), once for ϵ=0\epsilon=0 in Figure 2(b), and for positive ϵ>0\epsilon>0 in Figure 2(a) under the assumption ρ=25\rho=25. We see that for ϵ=0\epsilon=0 the largest values of HH give the best speedup, however, when only a few epochs need to be performed, then the optimal values of HH change with the number of workers KK. We also see that for a small number of workers H=1H=1 is never optimal. If TT is unknown, then these observations seem to indicate that the technique from , i.e. adaptively increasing HH over time seems to be a good strategy to get the best choice of HH when the time horizon is unknown.

Experimental.

Conclusion.

The restriction on HH imposed by theory is not severe for TT\to\infty. Thus, for training that either requires many passes over the data or that is performed only on a small cluster, large values of HH are advisable. However, for smaller TT (few passes over the data), the O(1/K)O(1/\sqrt{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 .

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 KK sequences {xtk}t=0T\{\mathbf{x}_{t}^{k}\}_{t=0}^{T} of iterates, k[K]k\in[K]. Similar as in Section 2 we introduce sets of synchronization indices, Itk[T]\mathcal{I}_{t}^{k}\subseteq[T] with TITkT\in\mathcal{I}_{T}^{k} for k[K]k\in[K]. Note that the sets do not have to be equal for different workers. Each worker kk evolves locally a sequence xtk\mathbf{x}_{t}^{k} in the following way:

where xˉˉt+1k\bar{\bar{\mathbf{x}}}_{t+1}^{k} denotes the state of the aggregated variable at the time when worker kk reads the aggregated variable. To be precise, we use the notation

where Wtk,h[T]\mathcal{W}_{t}^{k,h}\subseteq[T] denotes all updates that have been written at the time the read takes place. The sets Wtk,h\mathcal{W}_{t}^{k,h} are indexed by iteration tt, worker kk that initiates the read and h[K]h\in[K]. Thus Wtk,h\mathcal{W}_{t}^{k,h} denotes all updates of the local sequence {xth}t0\{\mathbf{x}_{t}^{h}\}_{t\geq 0}, that have been reported back to the server at the time worker kk reads (in iteration tt). This notation is necessary, as we don’t necessarily have Wtk,h=Wtk,h\mathcal{W}_{t}^{k,h}=\mathcal{W}_{t}^{k^{\prime},h} for kkk\neq k^{\prime}. We have Wtk,hWtk,h\mathcal{W}_{t}^{k,h}\subseteq\mathcal{W}_{t^{\prime}}^{k,h} for ttt^{\prime}\geq t, as updates are not overwritten. When we cast synchronized local SGD in this notation, then it holds Wtk,h=Wtk,h\mathcal{W}_{t}^{k,h}=\mathcal{W}_{t}^{k^{\prime},h^{\prime}} for all k,h,k,hk,h,k^{\prime},h^{\prime}, as all the writes and reads are synchronized.

Let ff, σ\sigma, GG and κ\kappa be as in Theorem 5.1 and sequences {xtk}t=0T\{\mathbf{x}_{t}^{k}\}_{t=0}^{T} for k[K]k\in[K] generated according to (14) with gap(ITk)H\operatorname{gap}(\mathcal{I}_{T}^{k})\leq H for kKk\in K and for stepsizes ηt=4μ(a+t)\eta_{t}=\frac{4}{\mu(a+t)} with shift parameter a>max{16κ,H+τ}a>\max\{16\kappa,H+\tau\} for delay τ>0\tau>0. If Wtk,h[tτ]\mathcal{W}_{t}^{k,h}\supseteq[t-\tau] for all k,h[K]k,h\in[K], t[T]t\in[T], then

where x^T=1KSTk=1Kt=0T1wtxtk\hat{\mathbf{x}}_{T}=\frac{1}{KS_{T}}\sum_{k=1}^{K}\sum_{t=0}^{T-1}w_{t}\mathbf{x}_{t}^{k}, for wt=(a+t)2w_{t}=(a+t)^{2} and ST=t=0T1wt13T3S_{T}=\sum_{t=0}^{T-1}w_{t}\geq\frac{1}{3}T^{3}.

Hence, for TT large enough and (H+τ)=O(T/K)(H+\tau)=O(\sqrt{T/K}), asynchronous local SGD converges with rate O\bigl{(}\frac{G^{2}}{KT}\bigr{)}, the same rate as synchronous local SGD.

Conclusion

We prove convergence of synchronous and asynchronous local SGD and are the first to show that local SGD (for nontrivial values of HH) attains theoretically linear speedup on strongly convex functions when parallelized among KK workers. We show that local SGD saves up to a factor of O(T1/2)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 ), 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 ). 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 analyzes local SGD for non-convex optimization problems and shows convergence of SGD to a stationary point, though the restrictions on HH are stronger than here.

Acknowledgments

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.

References

Appendix A Missing Proofs for Synchronized Local SGD

In this section we provide the proofs for the three lemmas that were introduced in Section 3.

where we used the inequality i=1Kai2Ki=1Kai2\lVert\sum_{i=1}^{K}\mathbf{a}_{i}\rVert^{2}\leq K\sum_{i=1}^{K}\left\lVert\mathbf{a}_{i}\right\rVert^{2} in (21). By LL-smoothness,

To estimate the last term in (22) we use 2a,bγa2+γ1b22\left\langle\mathbf{a},\mathbf{b}\right\rangle\leq\gamma\left\lVert\mathbf{a}\right\rVert^{2}+\gamma^{-1}\left\lVert\mathbf{b}\right\rVert^{2}, for γ>0\gamma>0. This gives

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

For ηt14L\eta_{t}\leq\frac{1}{4L} it holds \bigl{(}\eta_{t}L-\frac{1}{2}\bigr{)}\leq-\frac{1}{4}. By convexity of a(f(x)f)+bxx2a\left(f(\mathbf{x})-f^{\star}\right)+b\left\lVert\mathbf{x}-\mathbf{x}^{\star}\right\rVert^{2} for a,b0a,b\geq 0:

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

By definition of gt\mathbf{g}_{t} and gˉt\bar{\mathbf{g}}_{t} we have

where we used Var(k=1KXk)=k=1KVar(Xk)\operatorname{Var}(\sum_{k=1}^{K}X_{k})=\sum_{k=1}^{K}\operatorname{Var}(X_{k}) for independent random variables. ∎

Appendix 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

as before. By the property TITkT\in\mathcal{I}_{T}^{k} for kKk\in 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=0T\{\bar{\mathbf{x}}_{t}\}_{t=0}^{T}. 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.

If gap(ITk)H\operatorname{gap}(\mathcal{I}^{k}_{T})\leq H and τ>0\exists\tau>0, s.t. Wtk,h[tτ]\mathcal{W}_{t}^{k,h}\supseteq[t-\tau] for all k,h[K]k,h\in[K], t[T]t\in[T], and sequence of decreasing positive stepsizes {ηt}t0\{\eta_{t}\}_{t\geq 0} satisfying ηt2ηt+H+τ\eta_{t}\leq 2\eta_{t+H+\tau} for all t0t\geq 0, then

Here we use the notation [s]={}[s]=\{\} for s<0s<0, such that [tτ][t-\tau] is also defined for t<τt<\tau.

As gap(ITk)H\operatorname{gap}(\mathcal{I}^{k}_{T})\leq H there exists for every kKk\in K a tkt_{k}, ttkHt-t_{k}\leq H, such that xtkk=xˉˉtkk\mathbf{x}_{t_{k}}^{k}=\bar{\bar{x}}_{t_{k}}^{k}. Let t0:=min{t1,,tK}t_{0}:=\min\{t_{1},\dots,t_{K}\} and observe t0tHt_{0}\geq t-H. Let t0=max{t0τ,0}t_{0}^{\prime}=\max\{t_{0}-\tau,0\}. As Wtk,h[tτ]\mathcal{W}_{t}^{k,h}\supseteq[t-\tau] for all k,h[K]k,h\in[K], t[T]t\in[T], it holds

for each k[K]k\in[K]. In other words, all updates up to iteration t0t_{0}^{\prime} have been written to the aggregated sequence.

Now, using ηtηt+1\eta_{t}\geq\eta_{t+1}, and ttkHt-t_{k}\leq H, we conclude (as in (36))

and similarly, as tt0H+τt-t_{0}^{\prime}\leq H+\tau,

Finally, as ηt0ηt2\frac{\eta_{t_{0}^{\prime}}}{\eta_{t}}\leq 2, we can conclude

Now the proof of Theorem 5.1 follows immediately.

As in the proof of Theorem 2.2 we rely on Lemma 3.4 to derive the convergence rate. Again, we have A=12A=\frac{1}{2}, B=σ2KB=\frac{\sigma^{2}}{K}, and C=LG2(H+τ)2C=LG^{2}(H+\tau)^{2} (Lemma B.1). It is easy to see that the stepsizes satisfy the condition of Lemma B.1, as clearly ηt0ηtηt0ηt0+H+τ=a+t+H+τa+t2\frac{\eta_{t_{0}^{\prime}}}{\eta_{t}}\leq\frac{\eta_{t_{0}^{\prime}}}{\eta_{t_{0}^{\prime}+H+\tau}}=\frac{a+t+H+\tau}{a+t}\leq 2, as aH+τa\geq H+\tau. ∎

Appendix C Comments on Implementation Issues

In Theorem 5 we do not prove convergence of the sequences {xtk}t0\{\mathbf{x}_{t}^{k}\}_{t\geq 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\{\mathbf{y}_{t}\}_{t>0}, y0=x0\mathbf{y}_{0}=\mathbf{x}_{0}, 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 {xtk}\{\mathbf{x}_{t}^{k}\} with a specific worker kk. However, the computation of the sequences does not need to be tied to a specific worker. Thus, a fast worker kk that has advanced his local sequence too much already, can start computing updates for another sequence kkk^{\prime}\neq k, if worker kk^{\prime} 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.

Appendix D Details on Experiments

For each run, we initialize x0=0d\mathbf{x}_{0}=\mathbf{0}_{d} and measure the number of iterationsNote, 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 KK). For completeness, we report that all experiments were run on an an Ubuntu 16.04 machine with a 24 cores processor Intel® Xeon® CPU E5-2680 v3 @ 2.50GHz. (and number of stochastic gradient evaluations) to reach the target accuracy ϵ{0.005,0.0001}\epsilon\in\{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=1i=0twii=0twixt\mathbf{y}_{t}=\frac{1}{\sum_{i=0}^{t}w_{i}}\sum_{i=0}^{t}w_{i}\mathbf{x}_{t}, and consider the accuracy reached when one of the averages satisfies f(yt)fϵf(\mathbf{y}_{t})-f^{\star}\leq\epsilon, with f:=0.126433176216545f^{\star}:=0.126433176216545 (numerically determined). The precise formulas for the averages that we used are given in Table 1.

In Figures 4 and 5 we give additional results for mini-batch sizes b{1,16}b\in\{1,16\}.