Local SGD Converges Fast and Communicates Little

Let eight workers train alone and meet only now and then. Stich proves they still learn as fast as workers that meet at every step, with far fewer meetings.

Learn why a group of machines can skip most of their talking, how often they may meet, and what the proof says.

Pick how often the eight workers meet, then press New noise a few times. Watch the loss curve barely move while the meetings drop from 600 to 2. Then we build, piece by piece, the baseline, the method, the theorem, its proof, the budget of meetings and the experiments.

You need a feel for a slope (the direction that makes a number smaller) and a little Python for the code. We build the rest from zero, including every word of distributed training.

Based on Local SGD Converges Fast and Communicates Little by Sebastian U. Stich (EPFL), arXiv 1805.09767, version 3 of 3 May 2019. Read here as background for the Core Automation post The Hitchhiker’s Guide to Training on Compute Islands. Every idea is re-taught in our own words and devices.

Meet less, learn the same

A real run in your browser, not a recording: ridge regression (a least-squares fit with a small penalty) on 200 made-up examples with 10 features, a fresh random draw each press, averaged over 6 runs. H is the number of steps between meetings. The step size is the paper’s schedule 4 / (µ(a + t)). Toy data, the paper’s algorithm.

Chapter 0

Why Talking Is the Slow Part

See why eight machines that must agree at every step spend most of their time waiting on the network

Eight machines train one model together. Each machine looks at a different slice of the data. After every single step, all eight must stop and agree on what they learned. Then they take the next step.

Now put four machines in one building and four in another, a long way off. The link between the buildings is thin and slow. The eight machines still stop and agree at every step. Most of the clock now ticks away while they wait for messages to cross that link.

The Core Automation post on compute islands states the goal in two sentences:

“Within an island of compute, use the fast interconnect aggressively. Across islands of compute, exchange updates on a slower schedule.”Rohan Anil, The Hitchhiker’s Guide to Training on Compute Islands (Core Automation, 2 November 2026)

This lesson reads the paper that first proved the second sentence is safe. Sebastian Stich asked a plain question: if workers skip most of their meetings, do they still learn as fast? His answer is yes, for a clear class of problems, and he proves how rarely they may meet.

The words you need, in plain order

A model is a long list of numbers, called weights. We write the list as x. The loss is one number that says how wrong the model is on the data. Training means changing x until the loss is small.

The gradient is the slope of the loss. It tells each weight which way to move to cut the loss. A step moves every weight a small distance against the slope. The distance is set by the learning rate.

Computing the exact slope needs the whole dataset, which is far too slow. So we use a stochastic gradient: the slope from one small random sample. It is noisy, but on average it points the right way. Stepping with it is stochastic gradient descent, or SGD. Chapter 1 writes it as an equation.

A worker is one machine (or one group of machines) that computes gradients. Many workers can share a job. In data-parallel training, every worker holds a full copy of the model and reads different data. If you want the full picture, the lesson on data parallelism and all-reduce builds it from zero, and this overview of distributed training shows the wider map.

What one meeting costs

To agree, the workers run an all-reduce: every worker sends its numbers, and every worker ends with the average. The average of a model-sized list moves through the network each time. How long that takes depends on bandwidth, the number of bits a link carries each second. The bandwidth lesson does the arithmetic.

The paper packs the cost into one ratio, ρ (the Greek letter rho). It is the time of one exchange divided by the time of one gradient computation. The paper says ρ is often 10 to 100 in practice, and larger still on slow networks. A round is one meeting where the workers exchange and average.

Try the clock below. Slide ρ to 25, then change how often the workers meet.

Count the time spent talking

Each bar is the time for one step on average. Blue is computing a gradient. Yellow is talking. The top bar meets at every step. The bottom bar meets every H steps. Move both sliders.

25
16

Illustrative model: one gradient takes 1 time unit, one meeting takes ρ units, and a meeting happens once every H steps, so a step costs 1 + ρ/H on average. The paper’s own cost model, with the number of vectors exchanged, comes in Chapter 6.

At ρ = 25, meeting every step makes 26 time units for one unit of real work. The machines compute for under 4% of the time. Meeting every 16 steps drops a step to about 2.6 units. The machines compute for 39% of the time. Meeting every 256 steps lifts it to about 91%.

The catch is plain. If workers meet less often, their models drift apart between meetings. Each one follows its own noisy path. Will the average of those paths still be a good model? That is the question the paper answers.

The road

  1. Parallel SGD: the every-step baseline, and why averaging gradients helps.
  2. Local SGD: the method, in one algorithm and one equation.
  3. The theorem: what the bound promises, and what each term means.
  4. The proof: a virtual average, a variance lemma and a drift lemma.
  5. The meeting budget: how rarely the workers may meet.
  6. The speedup model: gains once talking has a price.
  7. The experiments: what the paper’s figures show, rebuilt in miniature.
  8. Asynchronous local SGD: no waiting at all, and balancing slow machines.
  9. Field guide: numbers, checklist, code and where to go next.

The background lesson Local SGD and model averaging teaches the idea at a gentler pace. This lesson reads the paper itself.

Eight machines meet to average their models after every step, and the network is slow. What goes wrong first?

Chapter 1

Parallel SGD: Many Hands, One Step

Write down the every-step baseline and see why averaging many noisy gradients gives a clearer one

You are walking down a foggy hill to reach the valley. You cannot see the whole slope. At each spot you poke the ground near your feet and feel which way it tilts. That poke is cheap, but it is a little wrong each time.

That is SGD. The hill is the loss. Your position is the model x. The poke is a stochastic gradient. The paper writes one step as one line:

xt
The model after t steps: a list of d numbers (the paper writes xt ∈ ℜd).
ηt
The learning rate at step t, a small positive number. It may shrink as t grows.
gt
The stochastic gradient: a list of d numbers with the property that its average equals the true slope, E gt = ∇f(xt). The letter E means “the average over the randomness”.
xt+1
The model after the step. The sign := means “is set to”.

The property E gt = ∇f(xt) has a name: gt is unbiased. A single poke can be far off, yet the pokes do not lean one way. Over many pokes the errors cancel.

Parallel SGD: let K workers poke at once

Now give the hill to K walkers who stand at the same spot. Each pokes a different patch of ground. They shout their results, average them, and all take the same step. This is parallel SGD. The paper writes it by replacing gt with the average of K gradients computed on K workers.

Why does averaging help? Each poke has some wobble around the truth. The size of that wobble is the variance, written σ² in the paper. It is the average squared distance between a poke and the true slope. When you average K independent pokes, the wobbles partly cancel. The variance of the average is σ²/K.

Try it. The pile below shows 400 averages of K pokes. The true slope is 1.

Average more pokes, wobble less

Each bar counts how many of 400 averages landed in that range. The purple line marks the true slope, 1. Slide K and watch the pile get narrower.

1

Illustrative: one poke is the true slope 1 plus a Gaussian wobble with spread (standard deviation) σ = 3, so σ² = 9. The same 400 × 64 random draws are reused for every K, so the pile changes smoothly.

At K = 1 the pokes spread over a wide range, and some even point the wrong way. At K = 16 the spread is four times narrower. The spread shrinks by √K, the variance by K. That is the rule behind the paper’s statement that parallel SGD “achieves a linear speedup”.

What “linear speedup” means

SGD with one worker reaches loss error of about σ²/T after T steps, when the starting error has faded. The paper takes this from the standard analysis. With K workers the variance in each step drops by K, and the error falls to about σ²/(TK).

Read that again. K workers for T steps reach the error that one worker reaches in TK steps. The number of gradients is the same. The time is K times shorter. That is linear speedup: double the workers, halve the time.

A mini-batch is another way to average. One worker computes b gradients before each step and averages them. The variance drops by b. The paper says its results cover mini-batches too (Remark 2.4): replace σ² by σ²/b. So K workers with batch b act like one big batch of Kb.

The data flow of one parallel step

Each worker holds the same model x, a list of d floats. It reads b examples and computes its gradient, again d floats. Then an all-reduce adds the K gradient lists and divides by K. Every worker receives the same averaged list of d floats. All K workers apply the same step, so their copies stay identical without any other message.

The price: a meeting at every step

To take one step, every worker needs the average of all K gradients. So the workers must meet after each gradient. The paper calls out the cost: “in each iteration the results of the computations on the workers have to be shared with the other workers to compute the next iterate.”

The usual fix is a bigger mini-batch: compute more gradients per worker between meetings. That raises the compute-to-communication ratio. But the paper notes that quality tends to degrade when the batch grows too large. Stich proposes a different knob. Keep the batch small. Meet less often.

The failure mode, as a symptom, a measurement and a fix:

Each stochastic gradient has variance σ² = 9. What is the variance of the average of 9 independent ones?

Chapter 2

Local SGD: Walk Alone, Meet Now and Then

Let each worker take H steps by itself, then average the models, and see where the paths go

Four hikers start at the same rock on a foggy hill. Each one walks down on their own, poking the ground for hints. Every ten minutes they stop, stand together, and agree on the middle of the four positions. Then all four walk on from that one spot.

This is local SGD. Each worker keeps its own copy of the model. It takes ordinary SGD steps on its own random samples. After H steps, the workers average their models. The paper’s name for the group is a “synchronization”, and we say a meeting.

The algorithm, line by line

The paper’s Algorithm 1 has K workers. Worker k holds a model xkt at step t. All start from the same x0. At each step each worker does the same four things:

  1. Draw one random example ikt from the n examples.
  2. Compute the gradient of the loss on that example at its own model.
  3. Step against the gradient with learning rate ηt.
  4. If this is a meeting step, replace the result by the average over all K workers.

As one equation, this is the paper’s equation (4):

local update
Worker k takes its own SGD step. The gradient is of the single example ikt, so each worker sees different data. No network is used.
IT
The set of meeting steps, a list of integers up to T. T itself is always in it, so the run ends on an average.
meeting update
Every worker takes its step, then all K results are averaged. Every worker ends with the same model.
xkt+1
The model of worker k after step t. Each is a list of d numbers.

The paper measures the longest gap between meetings with one definition. The gap of a set of integers is the largest difference between neighbours. If you meet every H steps, gap(IT) = H. All the theory uses the bound gap(IT) ≤ H.

The two extremes

Two settings of H are special. If IT holds every step, then H = 1, and equation (4) is parallel mini-batch SGD with batch size K. That is Chapter 1. If IT holds only the last step, then H = T. The workers never talk until the end. The paper calls this one-shot averaging.

Local SGD sits between them. The paper adds a warning in its related work: its bounds “become loose when H → T and our results do not cover one-shot SGD”.

One meeting with real numbers

Take K = 2 workers, one weight, learning rate 0.1, and both start at x = 1.0. We give the gradients by hand. The numbers are illustrative.

  1. Step 1. Worker A feels gradient 0.8 and moves to 1.0 − 0.1 × 0.8 = 0.92. Worker B feels 1.5 and moves to 0.85.
  2. Step 2 is a meeting step. A feels 1.2 at 0.92 and would move to 0.80. B feels 0.9 at 0.85 and would move to 0.76.
  3. The meeting averages them: (0.80 + 0.76) / 2 = 0.78. Both workers now hold 0.78.

The workers disagreed a little between meetings (0.92 against 0.85). The average pulled them together. Note one send of one number each way. With a model of d numbers, the meeting moves d numbers per worker.

Now watch it on a real picture. The ellipses are level lines of a loss. The green ring is the best model. Four workers start at the top left.

Walk alone, then meet

Blue lines are the four workers’ paths. The warm star is their average. Pick H, then press Replay. Rings mark each meeting.

Toy: a 2-D bowl f(x) = ½(x1² + 0.15 x2²), gradient noise of spread 0.8, learning rate 0.12, 4 workers, 120 steps. Constant learning rate, so it differs from the paper’s schedule. Same algorithm.

With H = 1 the four paths are one path. With H = 6 they fan out a little between rings, then collapse. With H = 30 they wander for a long time before they meet. They all still head to the green ring, because every worker uses the true slope on average.

Why the proof is not easy

For parallel SGD the proof is one line: the average of K gradients has variance σ²/K. For local SGD the gradients are taken at different points, so that line breaks. The paper notes that convexity alone gives only the rate σ²/T for the averaged model, “i.e. no speedup”.

The paper’s insight: “Suppose the different sequences evolve close to each other. Then it is reasonable to assume that averaging the stochastic gradients … can still yield a reduction in the variance by a factor of K.” Chapters 3 and 4 turn that into a theorem.

The method as code

pythondef local_sgd(x0, grad_fn, K, H, T, lr):       # x0: (d,) float array
    X = np.tile(x0, (K, 1))                    # K copies of the model, shape (K, d)
    for t in range(T):
        for k in range(K):                        # runs in parallel on K machines
            X[k] -= lr(t) * grad_fn(X[k])          # one example's gradient, shape (d,)
        if (t + 1) % H == 0:                      # a meeting: one all-reduce of d floats
            X[:] = X.mean(axis=0)                  # every row becomes the average
    return X.mean(axis=0)
Local SGD with K workers and a meeting after every single step (H = 1) is the same as which method?

Chapter 3

The Theorem: What the Bound Promises

Read the paper’s main result one term at a time, and see where linear speedup hides inside it

A shipping company promises a parcel arrives in “two days plus a delay that grows if you pick the cheap carrier”. To judge the offer you need the terms: the base time, the delay, and when each one matters. A convergence theorem is the same kind of promise. It says how far from the best model you will be, as a sum of terms.

The paper proves such a promise for local SGD. First we fix the setting. Then we read the result.

The setting, in plain words

The loss is an average over n examples: f(x) = (1/n) Σi fi(x). The best model is x*, and f* is the loss there. The paper assumes four things about the problem.

The ratio κ = L/μ is the condition number. A narrow, stretched valley has a large κ. A round bowl has κ = 1. In our toy problem κ is about 17.

Theorem 2.2

Run local SGD with the learning rate ηt = 4 / (μ(a + t)), where the shift a is larger than both 16κ and H. Let H be the gap between meetings. Output a weighted average of all the workers’ models over time, with weights (a + t)² that grow with t. Then the paper’s equation (5) says:

E f(x̂T) − f*
How much worse the output is than the best possible loss, on average over the randomness. Smaller is better.
bias term
The cost of starting far from x*. It shrinks like 1/T³ the start fades fast.
variance term
The cost of noisy gradients. K divides it. This is where linear speedup lives.
drift term
The cost of meeting less often. It grows with H² and G², and has no K in the bottom.

Here ST is the sum of the weights, and the paper shows ST ≥ T³/3. The averaged output x̂T weights later steps more. The paper chose quadratic weights, as other works do, to get the best rate.

The paper does not optimise the constants. So it states the shape in Corollary 2.3, equation (6), with a = max{16κ, H}:

first term
The leading one. It has K and T side by side: K workers for T steps act like one worker for KT steps.
second term
A smaller variance term that adds H. It decays like 1/T².
third term
The drift between workers. It carries H² and decays like 1/T².
fourth term
A leftover from the start. It decays like 1/T³.

The paper then reads off its main claims. For T large enough the first term dominates, and local SGD converges at rate O(1/(KTb)): a linear speedup in both the number of workers K and the mini-batch size b. To keep the first term in charge the paper needs H = O(√(T/(Kb))).

Where the condition on H comes from

Set the leading term and the drift term side by side. Drop the constants to see the shape. The leading term is 1/(KT). The drift term is κH²/T². The ratio is drift over leading = κKH²/T.

The drift term stays smaller than the leading term when κKH² ≤ T. So H must stay below √(T/(κK)). Take T = 1,000,000 steps, K = 16 and κ = 10. Then H ≤ √(1,000,000 / 160) = √6,250, about 79. This is the paper’s scaling H = O(√(T/(Kb))) with b = 1, and with the constants put back in. The numbers are illustrative.

Try it. The plot shows each term as a curve over T, with every constant set to 1.

Watch the terms trade places

Both axes are logarithmic. The warm line is the leading term. Yellow lines are the terms that depend on H. Purple is their sum. The vertical line is your T. Raise H and watch yellow rise above warm.

16
64
8
10^5

Illustrative: this plots the four terms of Corollary 2.3 (equation 6) with μ = σ² = G² = 1 and every hidden constant set to 1. The paper does not optimise its constants, so read the order in which terms take over, not the heights.

At small T the H terms win, and the bound is poor. Past a crossover the leading term takes over. The larger H, the later the crossover. That matches what Chapter 0 said: meeting less often is free only once you run long enough.

The failure mode, in three beats. Symptom: the bound is far above the leading term. Measurement: the ratio κKH²/T is well above 1. Fix: lower H, or run more steps.

In the paper’s bound, which term carries the factor K in its denominator and so gives the linear speedup?

Chapter 4

The Proof in Three Moves

Invent a model nobody computes, show it behaves like parallel SGD, and bound how far the real workers stray from it

Four hikers walk on their own. Their gradients are taken at four different places. How can the paper still claim the clean variance drop of parallel SGD? The trick is to ask a different question. Where is the middle of the four hikers, and how does that middle move?

Move 1: a virtual average

The paper defines a virtual sequence: x̄t is the plain average of the K workers’ models at step t. Nobody ever computes it, except at meetings, when it equals every worker’s model. It is a tool for the proof.

Two more averages are needed. gt is the average of the K stochastic gradients that the workers actually used. ḡt is the average of the K true gradients at the same K places. Each worker steps by −ηt times its gradient, so the middle steps by the average of those:

x̄t
The middle of the K workers at step t: (1/K) Σk xkt, a list of d numbers.
gt
The average of the K stochastic gradients used at step t. Its own average is ḡt, the mean of the true gradients at the K places.
x̄t+1
The middle after one step. This holds at every step, meeting or not, because averaging the workers does not move their middle.

This line looks exactly like SGD with a batch of K. The only difference: the gradients are taken at the workers’ places, not at the middle. The paper then proves two things. The middle behaves almost like batch-K SGD (Lemmas 3.1 and 3.2). The workers stay near the middle (Lemma 3.3).

Move 2: the middle is nearly batch-K SGD

Lemma 3.1 is the algebra of one SGD step, with error terms kept. For a step size ηt ≤ 1/(4L) it says:

contraction
Strong convexity pulls the middle toward x*. The distance shrinks by the factor (1 − μηt) every step.
noise
The cost of noisy gradients: the squared distance between the stochastic and the true average gradient.
progress
A bonus: the loss gap of the middle is subtracted. This is the quantity the theorem bounds.
spread
The price of taking gradients at the workers’ places instead of at the middle. It is the squared distance of each worker to the middle, averaged over workers.

Two terms are left to control: the noise and the spread. Each gets one lemma.

Lemma 3.2: the noise divides by K

The K stochastic gradients come from K independent random draws. The variance of a sum of independent things is the sum of their variances. Each gradient has variance at most σ². So:

E‖gt − ḡt‖² = (1/K²) Σk E‖∇fi(xkt) − ∇f(xkt)‖² ≤ Kσ²/K² = σ²/K

This is the same fact as Chapter 1. Now it holds for the workers’ different places, because each gradient is compared with the true gradient at its own place. The factor 1/K² comes from the average, and the sum has K terms.

Lemma 3.3: the workers stay near the middle

Choose a step t. Because the gap between meetings is at most H, the last meeting was at a step t0 with t − t0 ≤ H. At t0 all workers equal the middle. After that, worker k took at most H steps alone:

  1. Its distance from the middle is at most the distance from t0’s model, because the mean minimises squared distance.
  2. That distance is a sum of at most H steps, each of size η times a gradient.
  3. Squaring a sum of H terms costs at most a factor H: ‖Σai‖² ≤ HΣ‖ai‖².
  4. Each squared gradient is at most G², and the learning rate at t0 is at most twice that at t, which the paper assumes in the form ηt ≤ 2ηt+H.

Put together, H terms each costing η²G², times H, times 4 for the rate: the paper’s equation (10),

(1/K) Σk E‖x̄t − xkt‖² ≤ 4ηt² G² H²

Note that this lemma never uses smoothness or strong convexity. The paper points this out as a reason to expect the same idea to reach non-convex problems.

Now see it with data. The device runs real local SGD on the toy problem with 8 workers, measures the squared spread at every step, and draws the bound 4ηt²G²H² above it.

Measure the drift, then the bound

Blue is the measured squared distance of the workers from their average, at every step. It grows after a meeting and resets. The purple dashed line is the bound from Lemma 3.3. Move H.

16

Real runs of the paper’s algorithm on the toy ridge problem: 8 workers, 300 steps, average of 4 runs. G² is the largest value of the exact average squared gradient that worker 1 met in any run. The lemma holds for any such bound, so the dashed line is a true upper bound here.

The measured spread stays far below the bound. The reason is plain: the bound squares a sum of H steps, as if all the noise lined up. Real noise partly cancels, so the true spread grows closer to H than to H². The bound is safe and loose.

Move 3: stitch the pieces

Plug Lemma 3.2 (noise ≤ σ²/K) and Lemma 3.3 (spread ≤ 4η²G²H²) into Lemma 3.1. You get a recursion of the form at+1 ≤ (1 − μηt)at − ηtetA + ηt²B + ηt³C. Here B = σ²/K and C = 8G²H²L. A technical lemma from earlier work (Lemma 3.4) turns such a recursion into a bound on the weighted average of the et. The weights (a + t)² are what that lemma needs. The result is Theorem 2.2.

The noise term η²B carries 1/K. The spread term η³C carries H². One has a K that helps, the other an H that hurts. The theorem balances them.

Lemma 3.3 bounds how far the workers stray from their average. Which two things make that bound grow?

Chapter 5

How Rarely Can You Talk?

Turn the theorem into a meeting budget and count how many rounds it saves

You run a long training job. A friend asks how many times the machines must meet. You do not want the answer “every step”. You want a number you can plan around. The paper gives one, and it depends on three things you know before you start.

The rule

From Chapter 3, the leading term wins when the drift term stays smaller. That needs H = O(√(T/(Kb))). Here T is the number of steps each worker takes. K is the number of workers. b is the mini-batch size: how many gradients each worker averages per step. The total number of gradients is TKb.

The paper states the payoff in words: 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.” The abstract says it in one phrase: up to a factor of T1/2.

H
The longest allowed gap between meetings, in steps. The O( ) hides constants the paper did not optimise.
T
Steps each worker takes in the whole run.
K
Number of workers.
b
Mini-batch size per worker per step.
rounds
Meetings in the whole run. Mini-batch SGD needs T. Local SGD needs T/H.

A worked budget

Take T = 1,000,000 steps, K = 16 workers and b = 1. We set the hidden constant to 1, which is a guess, so the numbers are illustrative.

  1. Compute T/(Kb) = 1,000,000 / 16 = 62,500.
  2. Take the square root: H = 250.
  3. Count the rounds: 1,000,000 / 250 = 4,000.
  4. Compare: mini-batch SGD would meet 1,000,000 times. The saving is a factor 250.

Now make the batch four times larger, b = 4. Then T/(Kb) = 15,625 and H = 125. Rounds are 8,000. A bigger batch eats part of the budget, because it already averages more noise inside each step. The saving in meetings halves, from 250 to 125.

The device lets you change T, K and b. The bars show the rounds on a log scale.

Budget your meetings

The warm bar is the rounds that every-step mini-batch SGD needs. The teal bar is the rounds that local SGD needs at the largest allowed H. Both axes are logarithmic.

10^6
16
1

Illustrative: H = √(T/(Kb)) with the hidden constant set to 1 and H never below 1. The paper proves the order of H, not this constant. The total number of gradients, TKb, is the same for both bars.

Two patterns stand out. More steps T buy a bigger H, because a long run washes out the drift. More workers or bigger batches shrink H, because the leading variance term is already small and the drift term catches up sooner. The method pays best for long runs on few workers.

Count the bytes too. A model with 1 billion weights stored in 16-bit numbers is 2 GB. If each meeting moves one such vector, 4,000 meetings move 8 TB, and 1,000,000 meetings move 2 PB. The numbers are illustrative, but the ratio is the same 250.

Meet often early, rarely later

The theory fixes H for the whole run, but T may not be known in advance. The paper discusses the case where the horizon depends on the target accuracy. Its advice follows Zhang et al.: communicate more often at the start, then less often. Increasing H over time keeps meetings few while still respecting H = O(√(T/(Kb))) at every T.

How this compares

Dekel et al. note that such asymptotic bounds may be crude in practice, and the paper says the same applies here. Treat √(T/(Kb)) as a guide for where to start, then measure.

For compute islands the shape is useful. A slow link between sites makes ρ large. The rule says a longer run lets the sites meet less often, and a bigger group of workers shortens the allowed gap. The Core Automation post builds on this trade. The DiLoCo lesson shows how modern training puts it to work.

The failure mode: symptom, the loss curve of local SGD lags the every-step curve early on (the hero showed this at step 50); measurement, compare at equal gradient counts; fix, meet more often at the start.

You double the number of workers K and keep T and b fixed. By the rule H = O(√(T/(Kb))), how does the allowed H change?

Chapter 6

Speedup With a Price on Talking

Put a clock on both computing and communicating, and see when more machines actually finish sooner

A moving company sends K trucks. Each truck carries a load in the same time, so K trucks move K loads at once. But the trucks must meet at a depot after every trip to share a map. If the depot is far, the meetings cost more than the trips. Adding trucks then makes the whole job slower.

Chapter 3 counted only gradients. That hides the cost of meetings. Section 4 of the paper adds it back, and gives one formula for the real speedup.

The cost model

Wall-clock time has two parts. The first is the gradient work: each worker takes T steps, so computing costs time proportional to T. The second is communication. The paper counts it this way: in each round, 2(K − 1) vectors are exchanged, and there are T/H rounds. A vector here is a model-sized list of numbers.

The paper sets the cost of one such vector against one gradient computation with the ratio ρ from Chapter 0. It notes ρ ≥ 1, and “in practice, ρ can be 10 to 100, or even larger on slow networks”.

The number of steps T needed depends on the accuracy ε you want. From the corollary the paper estimates the steps to reach ε:

T(ε, H, K)
Steps each worker must take to reach loss error ε, with gap H and K workers. Smaller is better.
1/(Kε)
The ideal count. It comes from setting the leading term 1/(KT) of Chapter 3 equal to ε. K workers cut the steps by K.
correction
The price of the other terms. It equals 1 when ε is tiny. It grows with H and K when ε is large, that is, when you stop early.

The speedup S(K) compares K workers with local SGD against one worker with H = 1. Dividing the single-worker time by the K-worker time, and charging the communication, gives the paper’s equation (13):

S(K)
How many times faster than one worker. S = 1 means no gain. S < 1 means slower than a single machine.
K
The perfect speedup, in the numerator.
correction
The step-count penalty from the formula above.
communication
One unit of computing plus the talking, spread over H steps: 2(K − 1) vectors, each costing ρ, once every H steps.

Three numbers by hand

Let ε = 0 (a long run), ρ = 25 and K = 16. Then the correction is 1, and S = 16 / (1 + 50 × 15 / H) = 16 / (1 + 750/H).

  1. H = 1: S = 16 / 751 = 0.021. Sixteen machines run 47 times slower than one.
  2. H = 16: S = 16 / (1 + 46.9) = 0.33. Still slower than one machine.
  3. H = 256: S = 16 / (1 + 2.93) = 4.1. Now a clear gain.

The gain comes entirely from the 750/H term. Raising H shrinks it. At ε = 0 the best H is the largest one.

Plot the speedup formula

Warm is meeting every step (H = 1). Teal is the H you pick. The dashed purple line is perfect speedup, S = K. Move ρ and ε, then look at where the teal line sits.

25
about 0
16

Equation (13) of the paper as printed, plotted in your browser. The paper’s Figure 2 uses ρ = 25 and shows ε = 0 and one unstated ε > 0. We did not match our heights against the printed curves point by point; the lines of the figure that we read sit higher than this formula gives at ρ = 25, so read the trend (larger H helps) and not the heights.

A link speed shows how ρ arises. The post describes a run over a 25 Gbps link between two clusters. A 2 GB vector is 16 gigabits, so it needs 0.64 s to cross. If one gradient step takes 0.05 s, one vector costs about 13 steps of compute. That is ρ ≈ 13 for one vector, an illustrative figure. A slower link or a shorter step makes ρ larger.

What Figure 2 shows

Figure 2a plots S(K) for ε > 0 with a small number of steps. The paper’s reading: “when only a few epochs need to be performed, then the optimal values of H change with the number of workers K”. Also, for a small number of workers, H = 1 is never the best choice.

Figure 2b plots S(K) for ε = 0, the limit T → ∞. Here the paper says “the largest values of H give the best speedup”. As we read the figure, the H = 256 curve runs close to the ideal line.

The paper draws a practical lesson. If you do not know T ahead, increase H over time: meet often at the start, rarely later. That matches the advice of Chapter 5.

The failure mode: symptom, adding workers makes the job slower (S < 1); measurement, the communication factor 1 + 2ρ(K − 1)/H is far above 1; fix, raise H until that factor is near 1, as long as the budget of Chapter 5 allows it.

At ε = 0 and a fixed ρ, which change raises S(K) the most as K grows large?

Chapter 7

What the Experiments Show

Read the paper’s test setup and figures, then rebuild a small version and measure the speedup yourself

A theorem says what must hold. An experiment says what happens. The paper’s Section 4 runs local SGD on a real dataset and counts how many steps it needs to reach a target. Let us read exactly what it did, so a reader could repeat it.

The setup

The measured quantity is iterations to the target. The paper turns it into a speedup against K = 1, H = 1, and charges communication with ρ = 25 (Chapter 6).

What the figures show

As we read Figure 3, the curves of the stricter target (ε = 0.0001) climb further with K than those of the looser target (ε = 0.005), which flatten out early. That is the O(1/√K) effect: a run with few steps is dominated by the starting distance and not by the noise, so more workers help little. The authors advise a fix: use more frequent meetings at the start when training on a massive cluster.

A small replication

We cannot run w8a in a page, so the device uses the toy ridge problem from the hero. It uses the paper’s algorithm and its learning-rate schedule. For each K and H it counts the steps until the average of the workers is within ε of the best loss, over 6 seeds. Then it divides the count for one worker by that count.

Measure the speedup yourself

Each dot is the mean of 6 real runs. Warm is meeting every step. Teal is the H you pick. Dashed purple is perfect speedup. Pick a stricter target and watch the lines climb.

A real simulation, in your browser, on the toy ridge problem (200 examples, 10 features), not on w8a. Speedup is steps for K = 1 divided by steps for K workers, in iterations; it does not charge for communication, which the paper’s Figure 3 does with ρ = 25. We test the plain average of the workers, not the best of four averages.

Look at the strict target. The measured speedup grows with K, then bends away from the dashed line. That bend is the paper’s point: with a fixed budget of steps, more workers stop paying. The H lines stay close to the H = 1 line, so skipping meetings costs little. These are the two messages of the paper’s Figure 3, on a different problem.

Tracking the weighted average without storing iterates

Appendix C notes that the weighted average of the theorem does not need all past iterates. Keep one running average and fold each new model in. For the plain average the update is yt = xt/(t+1) + t yt−1/(t+1). For linear weights it is yt = 2xt/(t+2) + t yt−1/(t+2). The paper’s Table 1 lists these and the quadratic one. The cost is one extra copy of the model.

Limits of the evidence

The paper is open about this. It states the theory as a guide for deep learning, and the experiments as an illustration.

Why do the measured speedups flatten at large K when the target accuracy is loose?

Chapter 8

Asynchronous Local SGD and Load Balancing

Remove the last wait: let each worker meet the shared model whenever it is ready, and see what the proof still allows

A relay team of four runners has a rule: nobody may start the next lap until all four have crossed the line. Three runners are fast. One is slow. Every lap the fast runners stand and wait. Most of the team’s time is spent standing still.

Synchronous local SGD has this rule. Even with few meetings, each meeting is a barrier: every worker must arrive before any worker leaves. In a compute island setting the workers differ. Their chips differ, their links differ, and one may stall. Chapter 5 saved meetings. This chapter saves waiting.

The algorithm, in words

The paper’s Section 5 and Algorithm 2 remove the barrier. There is one shared copy of the model, the aggregate, which we call x̄̄. Each worker k works like this:

  1. Take local SGD steps on its own copy, as in Chapter 2.
  2. At its own meeting time (each worker has its own set of meeting steps), compute how far it moved since its last read: (xknow − xklast read) / K.
  3. Add that change to the aggregate in one atomic step. Atomic means no other write can land halfway through.
  4. Read the aggregate into its own copy, and carry on. It does not wait for anyone.

The paper writes this as equation (14): a worker either takes an SGD step, or, at a meeting step, jumps to the aggregate it reads. The read may be out of date. It holds every update that other workers have reported by then, and perhaps not the newest ones.

Delay, and what the proof asks

The paper calls the number of missing steps the delay, written τ (the Greek letter tau). The theorem needs one condition on what a worker reads: it must contain all updates from steps up to t − τ. Updates newer than that may or may not be there.

Theorem 5.1 then repeats the form of Theorem 2.2. The learning-rate shift becomes a > max{16κ, H + τ}. The drift term has (H + τ)² where the synchronous one had H². So delay and local steps are the same kind of cost. The paper concludes: for T large enough and H + τ = O(√(T/K)), asynchronous local SGD converges at the same rate as synchronous local SGD.

Compare with Chapter 5. There, H alone had to stay under √(T/(Kb)). Here the sum H + τ has the same limit. Waiting less is free as long as the total lag stays inside the same budget.

H + τ
Local steps between meetings, plus the delay of the shared model that a worker reads. Together they set how far a worker can stray.
T
Steps each worker takes.
K
Workers. The limit is the same as for the synchronous method.

Feel the cost of waiting

The device shows four workers, one of them slow. Each block is H = 4 steps of work. Blue blocks are work. Grey hatching is waiting.

Wait for the slow worker, or not

Three workers run at full speed. Slide the fourth worker’s speed down. The window shows three rounds of the slow worker.

0.40

Illustrative schedule, not a measurement: three workers at speed 1, one at the speed you set, H = 4 steps per block, and no time charged for the meeting itself. The delay is counted as the steps a fast worker takes while the slow worker finishes one block.

At speed 0.4, a synchronous round lasts as long as the slow worker needs: 10 time units for a block of 4 steps. The three fast workers finish in 4 and then wait 6. In the asynchronous mode there is no grey. The fast workers run on. The cost shows up as delay: when the slow worker finally writes, the others have moved on by about 10 steps.

Balancing load

Appendix C.2 adds a clever step. The local sequences do not have to be tied to a worker. A fast worker that has finished its own block can pick up the sequence of a laggard and advance it. The paper’s Table 2 shows two workers: worker 1 computes blocks for its own sequence and then for sequence 2, with the aggregate updated after each block of H steps. In that example the delay satisfies τ ≤ 3H.

Why can this work? In synchronous local SGD the sequences must stay in lock step, because the meeting needs all of them. In the asynchronous version each sequence only needs to eventually reach the aggregate. So any machine may compute it. Slower workers do less between meetings, faster ones do more, and the running averages of Chapter 7 can still be tracked.

For compute islands this matters. Islands differ in chip type and in link speed. The post describes runs across clusters of different sizes and GPU types. A method that does not wait for the slowest island, and that spends the extra work of the fast one, uses the sites better.

The failure mode: symptom, fast workers show idle time in a profile; measurement, the idle share of the barrier, which the device reads out; fix, drop the barrier or balance the load, and keep H + τ inside the budget.

In asynchronous local SGD, which pair of quantities must stay below O(√(T/K)) to keep the same rate as the synchronous method?

Chapter 9

Field Guide

Keep the numbers, the terms, a checklist and the core code, then follow the links onward

Sebastian Stich asked whether workers that rarely meet can still learn K times faster than one. On strongly convex problems with bounded gradients, he proved they can. Local SGD, where every worker takes H ordinary steps and then the models are averaged, matches the rate of parallel mini-batch SGD in terms of gradients, while the meetings drop by up to a factor of √(T/(Kb)). The proof compares the workers’ average with batch-K SGD and bounds the drift of the workers with H²G². The same holds for an asynchronous version when H + τ stays under O(√(T/K)).

The numbers that matter

WhatNumberWhy it matters
Rate of local SGDO(1/(KTb)) for large TLinear speedup in workers and batch size
Largest gap between meetingsH = O(√(T/(Kb)))The meeting budget
Saving in roundsup to a factor √(T/(Kb))Fewer meetings, same rate
Learning rateηt = 4/(μ(a + t)), a > max{16κ, H}The schedule the proof needs
Outputaverage of all iterates, weights (a + t)²Quadratic weights give the best rate
Noise lemmaE‖gt − ḡt‖² ≤ σ²/KWhere the factor K comes from
Drift lemmaspread ≤ 4ηt²G²H²Where the price of H comes from
Cost modelT/H rounds, 2(K − 1) vectors each, ρ often 10 to 100Turns steps into wall-clock time
Speedup, equation (13)K / [ (½ + ½√(1 + ε(1 + H + H²K))) (1 + 2ρ(K − 1)/H) ]Larger H helps when talking is costly
Experimentw8a, d = 300, n = 49,749, λ = 1/n, ε = 0.005 and 0.0001Speedup flattens for short runs
Asynchronous conditionH + τ = O(√(T/K))Delay counts like local steps
Non-convex, other workH = O(T1/4K−3/4) (Yu et al.)A stricter limit than the convex one

The terms, in plain words

TermPlain meaning
WorkerOne machine with its own copy of the model.
Stochastic gradientThe slope from one random example. Noisy, but right on average.
Parallel (mini-batch) SGDAll workers average their gradients before every step.
Local SGDEach worker takes H steps alone, then the models are averaged.
Meeting, round, synchronizationOne exchange where all workers end with the same model.
H, the gapThe longest run of steps between two meetings.
Variance σ²How far one gradient wobbles from the true slope.
G²An upper bound on the squared size of a gradient.
κ = L/μHow stretched the valley is. Larger means harder.
Virtual sequenceThe average of the workers, used only in the proof.
ρTime of one exchange divided by time of one gradient.
Delay τHow many steps out of date the shared model a worker reads can be.

The core as code

This is a sketch for a strongly convex problem. grad returns the gradient of one random example. On a real cluster the K rows live on K machines, and the averaging line is the only network call.

pythondef local_sgd(x0, grad, K, H, T, mu, L):        # x0: (d,)  grad(x) -> (d,)
    a = max(16 * L / mu, H)                      # shift: a > max(16 kappa, H)
    X = np.tile(x0, (K, 1))                     # K local models, shape (K, d)
    y, S = x0.copy(), 0.0                         # running quadratic-weighted average
    for t in range(T):
        eta = 4 / (mu * (a + t))                  # the schedule of Theorem 2.2
        for k in range(K):                          # in parallel, no network
            X[k] -= eta * grad(X[k])
        if (t + 1) % H == 0 or t + 1 == T:       # a meeting: one all-reduce of d floats
            X[:] = X.mean(axis=0)
        w = (a + t) ** 2; S += w                   # weights (a + t)^2, as in the theorem
        y += (w / S) * (X.mean(axis=0) - y)       # fold the virtual average into y
    return y                                      # shape (d,)

A checklist before you rely on it

What the paper leaves open

Where this sits

The Core Automation post lists the foundations under today’s methods. One line reads “Local updates. Local SGD and federated averaging take many steps between exchanges.” Its history table dates this paper’s analysis to 2018 and describes it as the “convergence analysis and the empirical case for infrequent averaging”, next to the work of Lin et al.

Keep going

The takeaway. Meetings are a cost, and the gradients are the work. Stich shows that on a well-behaved problem the work can run alone for about √(T/(Kb)) steps at a time without losing the K-fold speedup. The averaging of the workers plays the part of a big batch, and the drift between meetings is the price.

Now press Present or Teach and explain it out loud, from memory: why averaging K gradients cuts the variance by K, what the virtual sequence is, how Lemma 3.3 bounds the drift, and how to pick H. Then go back to the eight workers at the top, choose H = 300, and say why the curve still ends close to the every-step baseline.

Credit: Local SGD Converges Fast and Communicates Little, Sebastian U. Stich, EPFL (arXiv 1805.09767v3, 3 May 2019). Context: Rohan Anil, The Hitchhiker’s Guide to Training on Compute Islands, Core Automation, 2 November 2026. All quotations are short and credited. The devices are our own toys, and every illustrative number is marked.

A team runs local SGD on 16 workers for T = 1,000,000 steps with b = 1. Using the rule of Chapter 5 with the constant set to 1, about how many meetings do they need?
Local SGD Converges Fast and Communicates Little
Read the paper · Back to the background lesson · The Core Automation post