Let each worker train alone for H steps, then average the weights. See how much talking you save, and where the average starts to drift away from the truth.
Pick H and watch four workers pull the shared model toward their own data. Then we build, piece by piece, the averaging ideas that let clusters train one model over a thin link.
You need the idea of a gradient step (a small move downhill on a loss) and an average. We build the rest from zero.
Prerequisite 06 of Training on Compute Islands, written for Rohan Anil’s post The Hitchhiker’s Guide to Training on Compute Islands (Core Automation, 2 Nov 2026). Sources: Zinkevich et al. 2010, Zhang et al. 2015, McMahan et al. 2017, Stich 2019, Hsu et al. 2019. Full list in the Field Guide.
Toy problem, not a neural network: two weights, four workers, each with its own bowl-shaped loss (the dot is the bottom of its bowl). Steps are full-batch with size 0.1, 200 steps from one shared start. “Gap” is the shared model’s loss minus the best shared loss, 1.075. All numbers are illustrative and computed live.
Chapter 0
See why two clusters on opposite sides of the world cannot talk after every step, and what a worker can do instead
Picture two machine rooms. One is in the United States, the other in Asia, about 9,000 miles apart. Each holds 160 graphics chips. A single cable route joins them, and it can carry 25 Gbps in each direction. Rohan Anil’s post The Hitchhiker’s Guide to Training on Compute Islands describes a team that trained one 32-billion-parameter model across exactly this pair.
Why would anyone train across two rooms? The post gives the market answer: training compute rarely arrives as one big block. It comes as scattered clusters of a few hundred to a few thousand chips, spread over many small cloud companies that the post calls neoclouds. Each cluster is a compute island: fast inside, far from the others. Add the islands together and the total is large. The hard part is making them act as one machine.
That sentence hides three words most readers have not met. This chapter defines each one with a number, because the rest of the lesson is built on them.
Bandwidth is how much data a link can carry each second. Think of a water pipe: a wide pipe moves more litres per second than a narrow one. Computers count data in bits, the 0s and 1s. Eight bits make one byte.
Gbps means gigabits per second: one billion bits each second. So 25 Gbps is 25 billion bits per second. Divide by eight and you get 3.125 billion bytes per second, or 3.125 GB/s. A good home fibre line is about 1 Gbps. This link is 25 times wider, and it is still thin.
Why thin? Look at what has to cross it. A model is a long list of numbers called parameters (or weights). This one has about 32 billion of them. Store each in 2 bytes, a common choice, and the list is 64 GB. We assume 2 bytes here as an illustration; the post does not state the byte size.
Sending 64 GB over 3.125 GB/s takes 64 ÷ 3.125 = 20.48 seconds. That is one whole model, one way, with nothing else on the link.
Now ask how ordinary training uses the link. In data-parallel training, every worker holds a full copy of the model and reads different training examples. After each step every worker has its own gradient: a list of numbers that says which way to nudge each parameter to lower the loss.
The workers must agree before they move. So they run an all-reduce. Every worker puts its list in a hat, the hat averages the lists, and every worker takes the same average out. After that, all copies stay identical. Prerequisite 02 builds this in detail, and prerequisite 04 does the bandwidth arithmetic.
Inside one building the hat is cheap, because chips talk over links hundreds of times wider than 25 Gbps. Across an ocean the hat is a disaster. The workers would send tens of gigabytes after every step, then wait.
Let each worker take H steps on its own, with no talking at all. Then everyone meets once, averages the weights (not the gradients), and starts again from the average. This is local SGD. SGD stands for stochastic gradient descent, the basic training move: nudge the weights a little downhill on a loss, again and again.
Why average weights and not gradients? A gradient only makes sense at the weights where it was measured. After H local steps each worker stands at a different place. The honest thing to share is where it ended up.
The post lists this first among the four old ideas behind low-communication training:
“Local updates. Local SGD and federated averaging take many steps between exchanges.”Rohan Anil, Core Automation, 2 Nov 2026
In the post’s own run, the two sites exchanged updates on a 50-step schedule. That one number turns a constant stream into a short burst every 50 steps. Try it below.
Each bar is 256 steps of training. Teal is time spent computing. Yellow is time spent waiting while the model crosses the link. Drag H, then change the link speed.
Illustrative: a 32-billion-parameter model at 2 bytes each is 64 GB, sent once per meeting with no compression and no overlap. One step of work is assumed to take 2 s; the post gives neither number. The 25 Gbps link is the post’s.
At 25 Gbps and H = 1, the workers spend 91% of their time waiting. At H = 64 the waiting drops to 14%. That is the whole motive for this lesson: more local steps, fewer meetings, fewer idle chips.
Use the numbers above. A meeting costs 20.48 s. One step of work costs 2 s, an assumed figure. Now count a whole cycle: H steps of work, then one meeting.
At H = 1 the cycle is 2 s of work plus 20.48 s of waiting, 22.48 s in all. Waiting is 20.48 ÷ 22.48 = 91%. At H = 16 the cycle is 32 s of work plus 20.48 s, and waiting falls to 39%. At H = 50, the post’s schedule, work takes 100 s and waiting is 17%. At H = 64 it is 14%.
Traffic falls the same way. One meeting moves 64 GB. Spread over H steps, that is 64 GB per step at H = 1, 4 GB per step at H = 16, and 1.28 GB per step at H = 50. These are worst cases, with no compression and no overlap. The post compressed its exchanges and overlapped them with work, and it gives no timing for either. So its real waiting share is not stated.
Nothing is free. While a worker walks alone, it sees only its own data. It drifts toward what its data likes, away from what the whole group wants. The longer the walk, the bigger the drift. The hero at the top of this page shows it: with H = 64 the warm trail stops short of the green star.
Each of the next chapters answers one question about this trade. How do you average? How rarely may you meet? What goes wrong when workers hold different data? And what can the meeting itself do to repair the damage?
Chapter 1
Build the algorithm from the one you know, work a two-worker example by hand, and see exactly what crosses the link
Four hikers stand in fog on four different hillsides. Each can feel only the slope under their own boots. Each hiker wants the lowest point, but the group will share one spot, so what they really want is the lowest point of the average of the four hillsides.
One plan: after every single step, all four shout their slope to each other, average it, and each takes the same step. That is ordinary data-parallel training. Another plan: each hiker walks H steps downhill alone, then all four meet and stand at the average of where they ended. That is local SGD.
In ordinary training, a loss scores how wrong the model is, and a gradient g is the slope of the loss: it points uphill, so we step the other way. The learning rate η sets the step size. With K workers, each computes a gradient on its own batch of examples, and the all-reduce averages them:
Local SGD changes one thing. A round has three parts. First, every worker starts from the same weights w. Second, every worker takes H ordinary SGD steps on its own data, each from its own current weights, with no network at all. Third, the workers average their weights.
Take one weight, two workers, and learning rate η = 0.5. Worker 1 has the loss ½(w − 2)2, a bowl with its bottom at 2. Worker 2 has ½(w − 6)2, a bowl with its bottom at 6. Both start at w = 0. The slope of a bowl at w is (w − bottom).
Ordinary plan, two steps. Step 1: the slopes are −2 and −6, the average is −4, so w = 0 − 0.5 × (−4) = 2. Step 2: the slopes at 2 are 0 and −4, the average is −2, so w = 2 + 1 = 3.
Local plan, H = 2. Worker 1 goes 0, then 0 + 0.5 × 2 = 1, then 1 + 0.5 × 1 = 1.5. Worker 2 goes 0, then 0 + 0.5 × 6 = 3, then 3 + 0.5 × 3 = 4.5. Meet: (1.5 + 4.5) / 2 = 3. The same answer.
That is not luck. Here each slope is a straight-line function of w, and an average of straight-line updates is the same as the update of the average. Now give worker 2 a steeper bowl, 1.5 × ½(w − 6)2. The ordinary plan reaches 3.7813. The local plan reaches 3.5625. Play with it.
Bowl bottoms sit at 2 and 6. Warm is local SGD after H steps and one meeting. The grey ring is the ordinary plan after the same H steps. Choose the bowls, set H, press Walk.
Toy: one weight, learning rate 0.5, both workers start at 0, full-batch steps, so there is no sampling noise. The equal-bowl case is the worked example above.
With equal bowls the two plans never part, for any H. With different bowls they part more and more as H grows. Chapter 5 shows where that leads.
Where does each worker’s loss come from? From its own shard: the slice of the training data that worker reads. If the shards are shuffled copies of one big pile, the four losses are alike and the walks differ only by noise. If the shards differ in kind, the bowls differ in shape and position. Chapter 6 takes that case apart.
Give worker 2 the steeper bowl, 1.5 × ½(w − 6)2. Its slope at w is 1.5 (w − 6). Both plans start at 0 with η = 0.5. Here is each plan in full.
Ordinary plan. Step 1: the slopes are −2 and −9, the average is −5.5, so w = 0 + 0.5 × 5.5 = 2.75. Step 2: the slopes at 2.75 are +0.75 and −4.875, the average is −2.0625, so w = 2.75 + 1.03125 = 3.78125.
Local plan, H = 2. Worker 1 goes 0, 1, 1.5, as before. Worker 2 feels slope −9 at 0, so it jumps to 4.5. There its slope is 1.5 × (−1.5) = −2.25, so it lands on 4.5 + 1.125 = 5.625. Meet: (1.5 + 5.625) ÷ 2 = 3.5625.
The answers differ by about 0.22. The reason is who gets heard. In the ordinary plan, worker 2 still stands far from its bottom at step 2, so its steep slope still pulls hard. In the local plan, worker 2 has already walked close to its bottom, where its slope is small. The steep bowl lost part of its vote. That is drift in miniature.
Now the data flow. Each worker holds the weights as one flat vector of P numbers, shape [P]. A local step reads a batch of examples, for a language model shape [B, T] token numbers, computes the loss, and updates the vector in place. No byte leaves the machine.
At the meeting, the workers all-reduce that one vector. The traffic per round is P numbers, the same as one gradient all-reduce. But a round now covers H steps. So traffic per step falls to P / H. At H = 50, it is fifty times less.
pythondef local_sgd(model, opt, batches, H, rounds): for r in range(rounds): for _ in range(H): # H steps, no network x, y = next(batches) # x: [B, T] tokens, this worker's own data loss = loss_fn(model(x), y) loss.backward(); opt.step(); opt.zero_grad() for p in model.parameters(): # the meeting: P numbers cross the link dist.all_reduce(p.data, op=dist.ReduceOp.SUM) p.data /= dist.get_world_size()
One detail hides in that code. The optimizer’s own memory, such as the running averages inside Adam, stays on each worker and is not averaged here. Prerequisite 05 explains that state. Chapter 7 shows a different use of the meeting.
A related lesson, Distributed training, covers the ordinary all-reduce plan in depth. The same averaging idea also appears in distributed training on small devices.
The symptom: the training loss falls nicely on every worker, then jumps up right after a meeting. The measurement: evaluate each worker and the averaged model on the same held-out batch. If the average is worse than every worker, the workers have walked into different valleys. The fix: start every worker from identical weights, shorten H, or lower the learning rate. Chapter 2 shows why the identical start matters so much.
Chapter 2
Push H to the limit, train alone to the end, and learn when one meeting is enough and when it breaks the model
It is 2010. A web company holds terabytes of data on many cheap machines. Reading a single 2 TB disk at 100 MB/s takes at least six hours, so one machine cannot walk through all the data. The data must stay where it is, and the training must come to the data.
The tool of the day was MapReduce: a way to split a big job over many machines. A map step runs on each machine’s slice of the data. A reduce step combines the answers. Combining answers across machines needs the network, and the network is the slow part. Martin Zinkevich and colleagues asked: what if there were only one combine step?
Local SGD has a dial, H, the number of steps between meetings. Turn it all the way up. Each of k machines runs ordinary SGD on its own slice, from the same start w0, for the whole run of T steps. Only at the very end do the machines meet, once, and average their final weights. This is one-shot averaging, also called parallelized SGD.
The paper says the algorithm “requires no communication between machines until the end.” Communication cost is one transfer of P numbers in total. On our 64 GB model and 25 Gbps link, that is about 20 seconds for a whole run. Compare it with 20 seconds per step for the ordinary plan.
Zinkevich et al. also proved something: for loss functions shaped like a single bowl (convex losses), the averaged answer converges, with a guarantee that improves with the number of machines. They describe it as the first parallel SGD algorithm with both a detailed analysis and experimental evidence.
Why can averaging never hurt in a bowl? Take two points on a bowl-shaped curve and look at the point halfway between them. The curve there sits at or below the straight line joining the two heights. In symbols, for any convex loss f:
So in a bowl, the averaged model is at least as good as the typical worker. The statement is a promise about convex problems only.
Count the traffic for 10,000 steps on the 64 GB model at 25 Gbps. These are illustrative numbers. The ordinary plan meets 10,000 times: 10,000 × 20.48 s = 204,800 s, about 57 hours of pure waiting. Local SGD with H = 50 meets 200 times: 4,096 s, about 68 minutes. One-shot averaging meets once: 20.48 s.
The saving has a price, even in a bowl. Take the pair from Chapter 5: steepness 1 with bottom 2, and steepness 0.25 with bottom 6. Run to the end alone and the workers sit at 2 and 6. Their average is 4. The best shared model is 2.8.
Score the three points on the shared loss, the average of the two workers’ losses. Worker 1’s end point scores 1.0 and worker 2’s scores 4.0, so the typical worker scores 2.5. The average at 4 scores 1.25, better than typical, as the convex rule promises. But the best shared model at 2.8 scores 0.80. One-shot averaging ends 56% above the best loss. Averaging beats the typical worker and can still miss the best model.
A neural network’s loss has many valleys. Two networks trained from different random starts often settle in different valleys, and the straight line between them crosses a hill. Average them and you land on the hill. McMahan and colleagues measured this on MNIST (handwritten digits): two small networks, each trained with SGD at learning rate 0.1 for 240 updates on a separate set of 600 examples. Started from different random seeds, the average was a poor model. Started from the same seed, the average beat either parent.
The lesson for this course: every worker must start from the same weights. That is why each round of local SGD begins with a copy of one shared w. The next device reproduces the effect in a toy with two valleys.
Two workers train on their own data. Top: the map of the loss, with each worker’s path. Bottom: the loss along the line between the two final models. Choose how they start, then drag the mixing weight.
Toy, not the paper’s MNIST models: a loss with two valleys, x = −1 and x = +1, plus a small tilt that gives each worker its own data. 400 steps of size 0.05. The qualitative result (different seeds break averaging, a shared seed helps) is McMahan et al.’s Figure 1. Numbers are computed live.
Slide the weight to 0.5. With different starts the middle sits high on the hill. With a shared start both workers fall into the same valley, and the middle is lower than either end.
Here is a useful way to see local SGD. It is a chain of short one-shot runs. Each round starts from a shared copy, runs alone for H steps, and averages once. Because every round restarts from the average, the workers never get a chance to wander into different valleys for long. One-shot averaging is the case where the chain has a single, very long link. That is why shorter links are safer, and why the rest of this lesson asks how short is short enough.
The symptom: after a one-shot run on k machines, the averaged model is about as good as a model trained on a single machine’s slice. The measurement: McMahan et al. note that for one-shot averaging in the worst case, “the global model produced is no better than training a model on a single client.” Compare the average with each worker on a shared held-out set. If it does not beat the best worker, the extra machines bought nothing. The fix: meet more than once. The next chapters do exactly that.
python# Zinkevich et al. 2010, Algorithm 2: one meeting at the very end def parallel_sgd(slices, T, eta, w0): finals = [sgd(s, T, eta, w0) for s in slices] # k machines, in parallel, no talking return sum(finals) / len(finals) # the only network step: P numbers per machine
This idea is the first entry in the post’s timeline of foundations. The paper itself has its own lesson. For the all-reduce view of the same machines, see prerequisite 02.
Chapter 3
Take local SGD to phones, count the rounds it saves, and find the point where more local work stops paying
Your phone keyboard guesses the next word. To guess better, it should learn from what millions of people type. But what people type is private, and uploading it all is both rude and slow. The paper limits training to phones that are charged, plugged in and on an unmetered Wi-Fi connection.
In 2016 H. Brendan McMahan and colleagues at Google turned local SGD into a recipe for exactly this world. They called it federated learning: the data stays on the devices, and only model updates travel. The algorithm is federated averaging, or FedAvg. The post lists it among the old ideas that low-communication training stands on.
A client is one device with its own data: a phone, or, for us, a whole cluster. A server keeps the shared model. A round is one trip: the server sends the model down, clients train, clients send their models up, the server averages. The paper’s key remark is about cost:
“In data center optimization, communication costs are relatively small, and computational costs dominate … In contrast, in federated optimization communication costs dominate.”McMahan et al., AISTATS 2017, Section 1
If talking is the expensive part, computing is cheap by comparison. So spend more of it. The paper says its goal is “to use additional computation in order to decrease the number of rounds of communication.” Three dials control the extra work:
The ordinary plan is the corner case E = 1, B = ∞. The paper calls it FedSGD: one step per round, which is plain gradient averaging.
Clients differ in how much data they hold. A client with 10,000 examples should count for more than one with 10. So the server weights each client by its share of the data:
Worked count. The paper splits MNIST’s 60,000 training digits over K = 100 clients, so each holds 600. With E = 5 and B = 50, a client takes u = 5 × 600 / 50 = 60 local steps per round. With E = 20 and B = 10, it takes u = 20 × 600 / 10 = 1,200.
The paper counts how many rounds each setting needs to reach 99% test accuracy with a small convolutional network (CNN) on MNIST. The baseline, FedSGD, needs 626 rounds on evenly mixed (IID) data. With E = 20 and B = 10, FedAvg needs 18. That is 34.8 times fewer. The abstract states the headline: the rounds needed fell by a factor of 10 to 100 against synchronized SGD.
Bars show rounds to 99% test accuracy, on a log scale: shorter is better. Pick E, the epochs per round, and B, the batch size. Grey is FedSGD, one step per round. Warm is your pick.
Numbers are McMahan et al., Table 2, MNIST CNN, target 99% test accuracy, 100 clients with 600 examples each, C = 0.1. “Split by digit” is the paper’s pathological non-IID partition: every client holds only two digits. The table lists 1000 rounds for E = 5, B = ∞ on that split. Speed-ups are computed from the rounds.
Look at the pattern. On evenly mixed data, more local work helps a lot, then flattens: E = 20 with B = 50 needs 32 rounds, no better than E = 5 with B = 50 at 29. With one big batch it even turns bad: E = 20 needs 234 rounds, worse than E = 5 at 179. Local work has a limit. Chapter 5 shows why.
On the pathological split, where each client holds only two digits, the gains shrink. The best case is 2.8 times, and some settings do worse than FedSGD (0.5 times to 0.8 times). Yet averaging still worked when it could have diverged. The paper calls this strong evidence of robustness. Chapter 6 returns to this split.
The same recipe helped a language model. Take a next-word LSTM trained on the Complete Works of Shakespeare, with one client per speaking role. FedAvg with E = 5 and B = 10 reached 54% accuracy in 41 rounds. FedSGD needed 3,906: 95.3 times more.
Take three clients with n = 600, 300 and 100 examples. The total is 1,000, so the weights nk/n are 0.6, 0.3 and 0.1. After local training, one weight sits at 1.0, 2.0 and 5.0 on the three clients. The server computes 0.6 × 1.0 + 0.3 × 2.0 + 0.1 × 5.0 = 0.6 + 0.6 + 0.5 = 1.7. A plain mean would give 2.67 and let the 100-example client count as much as the 600-example one.
Use the MNIST table. There are 100 clients and C = 0.1, so 10 clients join each round. Each round moves 10 downloads and 10 uploads, 20 model transfers. FedSGD needs 626 rounds, so 626 × 20 = 12,520 transfers. FedAvg with E = 20 and B = 10 needs 18 rounds, so 18 × 20 = 360 transfers. Transfers fell by the same 34.8 times as rounds.
Computation rose. A chosen client now takes 1,200 local steps per round, where FedSGD took 1. FedAvg buys fewer rounds by paying in local work. That is the right trade only when talking costs more than computing, which is the case on a thin link.
pythondef fedavg(w_server, clients, rounds, C, E, B, eta): for t in range(rounds): S = random.sample(clients, max(1, int(C * len(clients)))) # a random fraction C joins n = sum(c.n for c in S) w_new = zeros_like(w_server) for c in S: # runs on the client; P numbers come down w = w_server.copy() for _ in range(E): for batch in c.batches(B): # u = E * n_k / B steps in all w -= eta * grad(w, batch) w_new += (c.n / n) * w # P numbers go back up, weighted by data share w_server = w_new
Per round, each chosen client downloads P numbers and uploads P numbers. Nothing else crosses. A compute island plays the client: it trains for u steps on its own shard, then trades its model with the others. The post’s run used u = 50 steps. The FedAvg paper has its own lesson in this series.
The symptom: you double E and the run needs more rounds, not fewer. The measurement: count rounds to a fixed accuracy, as the table does, rather than judging a single curve. The fix: lower E or raise B, and decay the learning rate over rounds, which the paper does with a factor of 0.99 per round in its CIFAR runs.
Chapter 4
Tie each worker to a shared centre copy with a spring, and see what the spring trades between agreement and freedom
Go back to the four hikers. In local SGD, a meeting is a teleport: everyone is snatched to the average and set down together. That is blunt. Now imagine something gentler. A stake stands at base camp. Each hiker wears an elastic rope tied to the stake. They roam freely, but the further one strays, the harder the rope pulls back.
Sixin Zhang, Anna Choromanska and Yann LeCun proposed exactly this in 2015 and called it Elastic Averaging SGD, or EASGD. The post lists it in its table of foundations: workers “loosely tied to a central copy, so they tolerate delay and drift.”
Each worker keeps its own weights xi, the local variables. A parameter server, a machine that stores the shared model and answers requests for it, keeps one more copy, the center variable x̃. The paper adds a cost for distance. Each worker minimizes its loss plus a spring term:
Take one gradient step on that cost and you get two update rules, with α = ηρ (the moving rate) and β = pα:
Notice the symmetry. The pull on a worker, α(xi − x̃), is equal and opposite to its share of the pull on the centre. The paper calls this the elastic symmetry, and it matters for stability. Set β = 1 and the centre becomes the plain average of the workers, as in local SGD.
Worked numbers, with α = 0.1, p = 4 so β = 0.4, and gradient terms left out. The centre is at 0. The four workers sit at 1.2, 1.0, 0.8 and 1.0. Each moves 10% of its distance toward 0: they become 1.08, 0.90, 0.72 and 0.90. The workers’ average is 1.0, so the centre becomes 0.6 × 0 + 0.4 × 1.0 = 0.4. The rope is slack at the middle and tight at the ends.
A worker need not tug the rope every step. Each worker counts its own steps, and every τ steps (the communication period) it exchanges with the server. Between tugs it is plain SGD. This is where the communication is saved, and it is the same dial as H in Chapter 1.
One exchange goes in four moves. The worker asks the server for the centre. The server sends it. The worker computes the pull α(xi − x̃), applies it to itself, and sends the same pull back. The server adds it to the centre. So an exchange moves P numbers each way.
Because workers run on their own clocks, a worker may read a centre that others have already moved. That is staleness: working from an out-of-date copy. The spring tolerates it because the pull is gentle and small. Chapter 5 and prerequisite 09 return to staleness.
Four noisy workers roll downhill in a loss with two valleys, at −1 and +1 (green lines). The thick warm line is the centre copy. Tighten the spring, or tug it more often, and watch the workers and the centre.
Toy, not the paper’s CIFAR runs: loss (x² − 1)² in one weight, step size 0.02, noisy gradients (standard deviation 2.2), 600 steps, p = 4 workers that start at −1.3, −0.4, 0.5 and 1.4. Both updates are the equations above, applied every τ steps. Same noise on every setting. Numbers are computed live.
The toy shows both ends of the dial. With the spring at zero, the workers fall into different valleys, and the centre sits on the hill between them: the Chapter 2 failure again. A stiff spring drags the whole group into one valley, and the centre becomes a good model. Tug too rarely and a stiff spring cannot help.
Continue the numbers from above, still with no gradient terms. After the first tug the workers sit at 1.08, 0.90, 0.72 and 0.90, and the centre at 0.4. Their average is 0.90.
Tug again, using these values for both updates. Each worker moves 10% of its distance to 0.4: 1.08 becomes 1.012, 0.90 becomes 0.85, 0.72 becomes 0.688, and the last 0.90 becomes 0.85. The centre becomes 0.6 × 0.4 + 0.4 × 0.90 = 0.60.
Watch the spread, the gap between the highest and lowest worker. It was 0.40, then 0.36, then 0.324. Each tug multiplies it by 1 − α = 0.9. After ten tugs, 0.910 = 0.35 of it remains. Meanwhile the workers keep their own positions, unlike a reset.
Traffic follows τ. One exchange moves P numbers down and P up. At τ = 1 that is 2P per step. At τ = 10 it is 0.2P per step. On a 64 GB model, that is 128 GB per step against 12.8 GB per step, as an illustration.
The paper’s argument runs the other way for deep networks: because the loss has many local valleys, a looser spring that lets workers explore can pay off. In its experiments, EASGD and its momentum version EAMSGD used τ = 10, while the baseline DOWNPOUR (a design in which workers send updates to a server on every step, covered in the DistBelief paper lesson) used τ = 1. They ran on CIFAR-10 with p = 4, 8 and 16 workers and on ImageNet with p = 4 and 8. The authors report faster training than DOWNPOUR with much less communication, and a lowest test error that falls as p grows, which they link to more exploration.
python# worker i of asynchronous EASGD (Zhang et al. 2015, Algorithm 1), simplified def worker(x, server, eta, alpha, tau): for t in count(1): x -= eta * grad(x, next_batch()) # plain SGD between tugs if t % tau == 0: center = server.read() # P numbers down pull = alpha * (x - center) x -= pull # the worker moves toward the centre server.add(pull) # P numbers up; the centre moves toward the worker
For the full paper, see its own lesson.
The symptom: workers train well, but the centre copy scores badly. The measurement: log the spread, the typical distance of a worker from the centre, next to the centre’s loss on held-out data. A large spread with a poor centre means the rope is too loose. The fix: raise α or lower τ, so the workers come back together before they settle in different valleys.
Chapter 5
Measure how far local SGD settles from the best shared model, and learn the two knobs that move it: H and the step size
Imagine two workers sharing a model. Worker 1 has a steep, narrow loss: a small error costs it a lot. Worker 2 has a wide, shallow one: it barely notices an error. The best shared model should sit close to worker 1’s preference, because worker 1 has more to lose.
Now let both walk alone for a long time. A steep bowl pulls hard and its worker reaches the bottom in a few steps. A shallow bowl pulls gently and its worker is still on its way. Given enough steps, both stand at the bottoms of their own bowls. Steepness no longer matters. The average of the two bottoms is the plain midpoint, and the midpoint is the wrong place.
Drift is the gap between where workers end up after H solo steps and where one shared walk would have taken them. It has two faces. Inside a round, the workers fan out. Across rounds, the average settles at a point that is not the best shared model, even if you wait for ever. That last point is the fixed point: the place where one more round changes nothing.
In real training, the bowls stand for the workers’ losses on their own shards of data. Shards drawn from one shuffled pile give bowls that look alike, so the offset is small. Shards of different kinds give bowls with different bottoms and different steepness, and the offset grows. Chapter 6 measures that on real image data.
Take a worker whose loss is a bowl with its bottom at c and steepness a. One step of size η moves it a fraction ηa of the way to the bottom. So after H steps from w, the distance to the bottom has shrunk by a factor of (1 − ηa), H times over:
Average this over the workers and repeat the round, and the process settles at a fixed point. Two limits tell the story:
For any H in between, the fixed point slides smoothly from the first to the second. Take the two-worker example from before: worker 1 has steepness 1 and bottom 2, worker 2 has steepness 0.25 and bottom 6, and η = 0.5. The best shared model is (1×2 + 0.25×6) / 1.25 = 2.8. The midpoint of the bottoms is 4.
Running the rule gives these fixed points: H = 1 gives 2.800, H = 4 gives 3.225, H = 16 gives 3.875, and H = 100 gives 4.000. The shared loss at the fixed point rises from 0.800 to 0.856 (H = 4), to 1.161 (H = 16), and to 1.250. The drift is real, and it grows with H.
Top: the map of two weights from the hero. The dotted curve is the fixed point as H grows from 1 to 256. The warm dot is your H. Thin lines fan out to where each worker ends one round. Bottom: the gap at the fixed point for every H.
Toy: the hero’s four workers, full-batch steps, so the fixed point is exact and not sampled. “Gap” is the shared loss at the fixed point minus the best shared loss, 1.075. Illustrative numbers, computed live.
Use the pair again: steepness 1 with bottom 2, steepness 0.25 with bottom 6, η = 0.5, H = 4. Worker 1 keeps (1 − 0.5 × 1)4 = 0.0625 of its distance. Worker 2 keeps (1 − 0.5 × 0.25)4 = 0.8754 = 0.5862.
Start a round at w = 3.225. Worker 1 ends at 2 + 0.0625 × 1.225 = 2.0766. Worker 2 ends at 6 − 0.5862 × 2.775 = 4.3733. The average is (2.0766 + 4.3733) ÷ 2 = 3.225. The round changed nothing, so 3.225 is a fixed point.
Now start at the true best, 2.8. Worker 1 ends at 2 + 0.0625 × 0.8 = 2.05. Worker 2 ends at 6 − 0.5862 × 3.2 = 4.1242. The average is 3.0871, which is not 2.8. The best model is not a resting place for H = 4. The next rounds walk it right, toward 3.225.
Step the slider from H = 1 up. At first nothing happens: H = 4 sits within 0.07 of the star. Then the distance doubles each time H doubles (0.16, 0.33, 0.64), and the gap roughly quadruples (0.007, 0.030, 0.110). A loss gap grows with the square of the distance. Past H = 100 the curve flattens, because the fixed point has reached the average of the bottoms and cannot go further.
Now switch the step size. Doubling η at H = 16 gives the same fixed point as H = 32 at the original η. What matters is the product ηH: how far a worker can walk before it meets the others. That is why teams lower the learning rate when they raise H.
The symptom: the training loss stops improving at a level that depends on H. A run with H = 64 flattens higher than a run with H = 8, and more steps do not close the gap. The measurement: train the same model for the same number of steps at two values of H and compare the final loss, as the bottom chart does. The fix: lower H later in training, lower the learning rate, or let the meeting do more than average (Chapter 7).
This is not only a toy effect. Sebastian Stich’s analysis of local SGD (its lesson) shows that for convex problems the cost of drift stays small as long as H is not too large for the run length. Chapter 8 gives his rule.
python# exact fixed point of local SGD on K bowls f_k(w) = 0.5 * a_k * (w - c_k)^2 def fixed_point(a, c, eta, H): m = [(1 - eta * ak) ** H for ak in a] # how much of the distance each worker keeps mean = lambda xs: sum(xs) / len(xs) return (mean(c) - mean([mk * ck for mk, ck in zip(m, c)])) / (1 - mean(m))
Chapter 6
Turn a dial from identical data to one-class-per-worker, and watch what averaging does to accuracy on real images
Ten photo apps share one model. App 1 users photograph mostly dogs. App 2 users photograph mostly trucks. App 3 users photograph mostly boats. Each app trains on its own pictures, then the apps average. Each local bowl now has its bottom somewhere different: “always say dog” is a fine model for App 1 and a poor one for everybody else.
Chapter 5 showed drift when bowls differ. This chapter shows where the difference comes from in practice, and how much it costs on a real task.
Statisticians call data IID when every example is drawn independently from the same pile. Shuffle one big dataset and deal it to workers like cards, and each worker holds IID data. Each worker’s loss is a small copy of the whole. The data is non-IID (non-identical) when the workers’ piles differ in kind.
The McMahan paper from Chapter 3 lists this as the first property of its setting: any one user’s data “will not be representative of the population distribution.” In data-centre training, you can shuffle at will. For islands that each own a shard, how alike the shards are decides which half of this chapter applies.
Why would different piles hurt? Each worker’s gradient points toward the model that suits its own pile. For IID piles those arrows agree, up to noise, so averaging them loses almost nothing. For skewed piles the arrows disagree, and every solo step walks further from what the group wants.
Early papers made non-IID data by sorting: put all the 0 digits on one client, all the 1s on another. That is extreme and unrealistic. Tzu-Ming Harry Hsu, Hang Qi and Matthew Brown built a smooth dial instead.
Each client gets a class mix: ten shares, one per class, adding up to 1. The paper draws that mix from a Dirichlet distribution. Think of a random way to slice a pie into ten pieces. A number α sets how even the slices are. With α very large, every client gets nearly equal slices, the same as the whole pile. With α near 0, each client gets one big slice: one class only.
The paper uses CIFAR-10, with 50,000 training images in 10 classes, split over 100 clients of 500 images each, and sweeps eight values of α from 100 down to 0. Each client then trains with FedAvg for 10,000 rounds.
Top: ten example clients. Each mini chart shows one client’s share of each of the ten classes. Bottom: the paper’s test accuracy for each α. Choose α, the local epochs E and the clients per round C.
Accuracy numbers are Hsu et al. 2019, Figure 2: CIFAR-10, 100 clients with 500 images each, batch size 64, 10,000 rounds, best learning rate for each cell, mean of 5 runs; chance is 10%. The mini charts are an illustrative seeded draw from a Dirichlet distribution, not the paper’s clients. At α = 0 each client holds one random class.
Read the bottom chart left to right. With 40 clients per round and E = 1, accuracy slides from 83.9% at α = 100 to 65.9% at α = 0. The paper notes that significant changes in accuracy occur around low α, when clients come close to one class. With 40 clients the fall is mild. Switch to 5 clients and E = 5 to see it steepen.
Now compare the chips. Fewer clients per round is worse everywhere, and much worse on skewed data: at α = 0 with E = 1, 5 clients per round reach 40.7%, against 65.9% with 40. A small group of clients has a skewed average, and the shared model lurches round to round. The paper also sees “more volatile training error” as data grows less identical.
And look at local work. With 40 clients, E = 5 beats E = 1 on identical data (84.7% against 83.9%) but loses on skewed data: 64.7% against 70.3% at α = 0.05. Chapter 5 predicted it. Longer solo walks drift further when the bowls differ. At the extreme, 5 clients with E = 5 fall to 26.8%, close to the chance level of 10%.
Back to the four-worker toy. The slider scales how far apart the workers’ bowl bottoms are, from 0 (identical) to 1.5. Each bar is the gap at the fixed point for one H.
Toy: each bowl bottom is moved to mean + s × (original bottom − mean); steepness is unchanged; η = 0.1. The gap is the shared loss at the fixed point minus the best shared loss for the same bowls. Computed live; s = 1 is the hero’s toy.
With s = 0 the bowls share one bottom and every H is perfect. As the bottoms spread, the bars grow, and the largest H grows fastest. Doubling the spread quadruples each gap. Drift scales with how different the data is, times how long the workers walk.
Take the extreme end, α = 0, where each client holds one random class out of ten. A round with 5 clients can cover at most 5 classes, so at least half of the world is missing from that round’s average. The chance that one given class is missing is 0.95 = 59%. With 40 clients it is 0.940 = 1.5%.
So with 5 clients the shared model lurches toward a different half of the classes each round. With 40 it sees nearly all of them every time. This is a clean reason for the paper’s result that small groups of clients do far worse on skewed data.
Use the pair from Chapter 5 and move both bowl bottoms toward or away from their midpoint 4, with steepness unchanged, η = 0.5 and H = 4. With bottoms 3 and 5, half the spread, the fixed point is 3.6125 and the gap to the best loss is 0.0141. With bottoms 2 and 6 the gap is 0.0564. With bottoms 0 and 8, double the spread, it is 0.2257.
Each doubling of the spread multiplies the gap by four. That matches the toy below. It is also why the post’s question about its two sites matters. The post does not say how it split its data. Each site trained on its own shard. If the shards were alike, drift stays small. If they differ in kind, expect the spread, and the gap, to grow.
pythonimport numpy as np def dirichlet_clients(n_clients=100, per_client=500, n_classes=10, alpha=0.1, seed=0): rng = np.random.default_rng(seed) prior = np.full(n_classes, 1 / n_classes) # the whole pile: 10% of each class mixes = rng.dirichlet(alpha * prior, size=n_clients) # [100, 10]: each row sums to 1 return [rng.multinomial(per_client, q) for q in mixes] # images of each class per client
The paper writes q ~ Dir(αp), where p holds the pile’s class shares, here 0.1 for each of the ten classes. The code follows it exactly. The paper has its own lesson.
The symptom: test accuracy is lower than a centralized run, and the curve jumps around from round to round. The measurement: sweep α as the paper does, or compare each client’s class mix with the pile. If a few classes dominate each client, expect drift. The fixes: more clients per round, a smaller E, a smaller learning rate, and server momentum. The paper reports that server momentum lifted accuracy in the most skewed setting from 30.1% to 76.9%. Chapter 7 shows how.
Chapter 7
Read the change a round made as a gradient, and let a second optimizer decide how far to move along it
A round ends. The four workers have walked H steps alone, and their weights average to a new point. So far we have jumped straight there. But look at the trip. The shared model began the round at w and the average landed at some other place. The arrow from one to the other tells us which way the whole group moved.
Ask a new question. Why must we accept that arrow at face value? We could take half of it, or one and a half times it, or blend it with the last few arrows so that a jittery direction smooths out. That idea is one of the two ingredients the post says federated learning added to the four old lines of work:
“Federated learning added two more ingredients: treat each worker’s parameter change between exchanges as a pseudo-gradient, and apply a separate outer optimizer to it.”Rohan Anil, Core Automation, 2 Nov 2026
Let w be the shared weights at the start of a round and wk the weights of worker k at its end. Define the round’s change as the starting point minus the average end point:
Reddi and colleagues, in their paper on adaptive federated optimization, made this precise: “the server update in FedAvg is equivalent to applying SGD to the pseudo-gradient −Δt with learning rate η = 1.” The word pseudo is honest. A true gradient is measured at one point. Δ is the sum of H steps taken at many different points by different workers, so it only behaves like a gradient.
Two vocabulary words follow. The inner optimizer is what each worker runs during its H local steps. The outer optimizer is whatever the shared model does with Δ. The Reddi paper names this family FedOpt. Any optimizer can fill either role.
Hsu and colleagues, the same authors as Chapter 6, put momentum on the outer step. Momentum keeps a running memory of past steps, like a ball that keeps rolling. Their rule is:
Worked count. Suppose every round the change is the same, Δ = 0.5, and β = 0.9. The velocity grows round by round: 0.5, then 0.9 × 0.5 + 0.5 = 0.95, then 0.9 × 0.95 + 0.5 = 1.355, then 1.7195, then 2.0476. It climbs toward 0.5 / (1 − 0.9) = 5, ten times the plain step. If the changes zigzag, the up and down parts cancel inside v while the shared direction adds up.
In the paper this mattered most on skewed data. Server momentum lifted CIFAR-10 accuracy in the most skewed setting from 30.1% to 76.9%. They called the method FedAvgM.
Now apply the rule to the four-worker toy from the hero. Pick the local steps H, the momentum β and the outer step size αout. The chart shows the gap after each round, for plain averaging (grey) and for your choice (warm).
Each round runs H local steps on the four workers, forms the change Δ, and takes an outer step with momentum. The dashed green line is the lowest gap this H can reach. Settling means staying within 0.05 of that line.
Toy: the hero’s four workers, full-batch steps of 0.1, start (1.0, −2.7), plain momentum as in the equation above (not Nesterov). Rounds to settle are computed live over 300 rounds. The momentum rule is Hsu et al.’s; the toy settings are illustrative.
Three things show up. At H = 2 each round covers little ground, so momentum helps: plain averaging settles in 22 rounds, and β = 0.5 with αout = 1 settles in 9. At H = 8 the plain average is already quick, at 7 rounds, and a big β with a full outer step overshoots and rings for dozens of rounds. And the dashed floor never moves: when Δ is zero, the velocity dies out, so momentum cannot remove the Chapter 5 bias. It only changes how fast and how smoothly you arrive. A larger β needs a smaller αout.
Reuse Chapter 1’s round: the shared weight w = 0, and after H = 2 the workers stand at 1.5 and 4.5. Their mean is 3. The change is Δ = 0 − 3 = −3, negative because the group moved up.
With αout = 1 the new weight is 0 − 1 × (−3) = 3, the plain average. With αout = 0.5 it is 1.5, half the way. With αout = 1.5 it is 4.5, an overshoot past the average. Same Δ, three different moves.
Now add momentum β = 0.9 and suppose the change is −3 again next round, as an illustration. Round 1: v = −3, so w moves by 3. Round 2: v = 0.9 × (−3) + (−3) = −5.7, so w moves by 5.7, almost twice the plain step.
The extra memory costs nothing on the link. Every worker receives the same mean, so every worker can compute the same v alone. It only needs one more list of P numbers in memory.
Three later methods in the post’s timeline follow this recipe. FedOpt (Reddi et al.) lets the server use adaptive optimizers. SlowMo (Wang et al.) applies a slow momentum buffer to periodic averages, and the paper notes it recovers large-batch SGD with momentum when it syncs every step. DiLoCo (Douillard et al., 2023) uses AdamW as the inner optimizer and Nesterov momentum as the outer one. It takes hundreds of local steps between meetings. With 8 workers it matched fully synchronous training while communicating 500 times less. Prerequisite 10 builds DiLoCo from these pieces. The papers have their own lessons: FedAvgM, FedOpt, SlowMo and DiLoCo.
pythondef outer_step(w, local_models, v, beta, outer_lr): mean = sum(local_models) / len(local_models) # the only thing that crosses the link: [P] delta = w - mean # the pseudo-gradient, shape [P] v = beta * v + delta # one more [P] vector of memory, same on every worker return w - outer_lr * v, v
The symptom: the loss swings up and down across rounds, with a period of a few rounds. The measurement: plot the gap per round, as the chart does. A ringing curve means momentum is too high for the outer step. The fix: lower β or αout, so that αout / (1 − β) stays near the step size you trust.
Chapter 8
Put the price of waiting and the price of drifting side by side, and see how the best H depends on the link and on the accuracy you want
You now hold two bills. Chapter 0 showed the cost of meeting: every meeting makes the chips wait, so meet less. Chapters 5 and 6 showed the cost of walking alone: the longer the walk, the further the average settles from the truth, so meet more.
A good engineer does not pick H by feel. The right H is where the two bills together are smallest, and that spot moves when the link changes or when the target accuracy changes.
Sebastian Stich proved a clean result for convex problems. Run local SGD for T total steps on K workers with mini-batch size b. Let H be at most about √(T / (K b)). Then local SGD converges as fast as mini-batch SGD that talks every step, counted in gradients computed. The abstract states it plainly: the number of communication rounds can be reduced by up to a factor of T1/2.
Read the formula. More workers K or larger batches b shrink the allowed H. A longer run T grows it. Put in numbers: T = 1,000,000 steps gives √T = 1,000, so in theory a thousand times fewer meetings. Two cautions follow. The statement hides constants, and the toy below shows best values of H in the single digits and tens, not thousands. And for non-convex problems, such as deep networks, Stich cites a stricter bound from Yu et al., H up to about T1/4 K−3/4. For the same T the factor T1/4 is 31.6, and it shrinks further as K grows.
Stich also draws a picture of the trade (his Figure 1). Define the compute-to-communication ratio ρ as how many steps of work fit in the time of one meeting. In his idealized formula, doubling the batch size or doubling H gives the same gain. Lin et al., next, give reasons to prefer the H route.
Tao Lin and colleagues asked a different question: is big-batch training good enough? They found that very large batches hurt the final accuracy of the model on new data, even when the training loss looks fine. That is a generalization gap. Their fix is post-local SGD. Train with ordinary synchronous SGD for the first phase, then switch to local SGD. For a ResNet-20 on CIFAR-10 with 16 workers, they ran large-batch SGD until epoch 150, then local SGD with H = 16. This closed the gap with the single-machine baseline and used fewer meetings than mini-batch SGD. See its paper lesson.
The post’s own run shows what a modern choice looks like. Two sites exchanged on a 50-step schedule. Parameters were split into fragments, staggered through the window, and a late update could still be committed. In the eight-cell butterfly test, each fragment was exchanged six times every 50 steps, about once every eight steps. So the real H is a schedule, not one number.
Use the toy to get a feel for the whole trade. A run is a series of rounds. Each meeting costs W steps’ worth of time. Choose a target gap. For every H from 1 to 256 the chart shows the total time to reach that target, measured at the meetings. A bar labelled “never” means that H settles above the target, as in Chapter 5.
Each bar is the total time, in steps, to reach your target gap, from the hero’s start. Shorter is better. The green outline marks the winner. Pick how costly a meeting is, then tighten the target.
Toy: the hero’s four workers, full-batch steps of 0.1, start (1.0, −2.7), time = steps + W × meetings, checked at the meetings. W = 10 matches Chapter 0’s 25 Gbps arithmetic (20.48 s per meeting over 2 s per step is about 10); W = 256 matches 1 Gbps. The numbers are illustrative and computed live.
Start at W = 10 and a target of 0.1. H = 16 wins with 104 time units. H = 1 needs 385, nearly four times as long, because it pays for a meeting at every step. H = 32 never arrives: its floor from Chapter 5 sits at 0.11, above the target.
Now tighten the target to 0.005. The winner falls to H = 4, because only small H can get that low at all. Loosen it to 0.5 and the winner rises to H = 16. A slower link pushes the winner up as well, but the target always caps it. High accuracy and a thin link pull in opposite directions. That is the real design problem.
The toy charges one unit per step and W units per meeting. At W = 10, a cycle of H steps costs H + 10 units. The numbers in the paragraph above follow from that.
H = 1 needs 35 cycles to reach the 0.1 target. Each cycle costs 1 + 10 = 11, so the total is 35 × 11 = 385. H = 16 needs 4 cycles, 64 steps. Each costs 16 + 10 = 26, so the total is 4 × 26 = 104. H = 1 does fewer total steps, 35 against 64, but it pays for 35 meetings against 4.
The share of time spent waiting is W ÷ (H + W). At W = 10 that is 91% for H = 1, 38% for H = 16, and 14% for H = 64. A big H wastes less time, but it has a higher floor. A small H has a low floor, but it wastes more. The winner sits where these two meet your target.
The post’s 50-step schedule fits this view. For the 64 GB illustration, W is about 10.24, so waiting would be 17% of the time if nothing were compressed or overlapped. The post compressed and overlapped, so its true share is lower, but it gives no figure.
python# a first plan for choosing H on a real link, from three measured numbers t_step = measure_step_seconds() # e.g. 2.0 s of work per local step t_meet = bytes_per_meeting * 8 / link_bits_per_second # e.g. 64e9 * 8 / 25e9 = 20.48 s W = t_meet / t_step # the cost of a meeting, in steps: about 10 here for H in [4, 8, 16, 32, 64]: # short runs, same seed, same data run_and_log(H, steps=20_000) # compare loss at equal *wall-clock*, not equal steps
The point of the code is the last comment. Compare runs at equal wall-clock time. A run with large H does more steps per hour, and a run with small H gets each step more right. Only the clock decides between them.
The symptom: H worked in the lab, then training crawled after the move to two sites. The measurement: recompute W from the real bandwidth and compare it with the W you tested. The fix: retune H, and the learning rate with it, for the new link.
Chapter 9
Keep the numbers, the terms, a checklist and the whole algorithm on one page, and see where it leads next
Local SGD lets each worker take H steps alone, then averages the weights. It cuts the traffic per step by a factor of H. One-shot averaging is the extreme, with a single meeting. Federated averaging adds client sampling and data-size weights. Elastic averaging swaps the reset for a spring. All of them pay for the saving with drift, which grows with H, with the step size, and with how different the workers’ data is. An outer optimizer can smooth the path, and the right H is a trade between waiting and drifting.
| What | Number | Why it matters |
|---|---|---|
| The post’s link | 25 Gbps each way, sites about 9,000 miles apart | A thin pipe between fast islands |
| One 64 GB model over 25 Gbps | 20.48 s (assumes 2 bytes per parameter) | The price of one meeting (illustrative) |
| The post’s schedule | sync every 50 steps; each fragment about every 8 steps in the butterfly test | The real H is a schedule |
| The post’s two-site result | about 0.2525 bits per byte vs 0.2549 for standard training | Talking less did not cost quality there |
| Reading a 2 TB disk (Zinkevich) | at least 6 hours at 100 MB/s | Why one machine cannot do it, and why one-shot averaging appeared |
| FedAvg, MNIST CNN, 99% | 626 rounds (FedSGD) to 18 rounds (E = 20, B = 10): 34.8 times fewer | More local work, far fewer rounds |
| FedAvg, Shakespeare LSTM, split by role | 3,906 rounds to 41: 95.3 times fewer | Works on non-IID text too |
| FedAvg, pathological split, same CNN | 483 rounds (FedSGD) to 173: only 2.8 times | Skewed data eats the saving |
| EASGD vs DOWNPOUR | τ = 10 vs τ = 1; p = 4, 8, 16 workers | A spring tolerates rare contact |
| Stich, convex | H up to about √(T / (K b)); rounds cut by up to T1/2 | Theory for how far H can go |
| Post-local SGD (Lin et al.) | K = 16, H = 16 after epoch 150 of large-batch SGD | Fewer meetings, and better generalization than big batches |
| Non-IID CIFAR-10 (Hsu et al.) | E = 1, 40 clients: 83.9% at α = 100 to 65.9% at α = 0 | The cost of different data |
| Server momentum (Hsu et al.) | 30.1% to 76.9% in the most skewed setting | An outer optimizer repairs skewed rounds |
| DiLoCo (Douillard et al.) | 8 workers matched synchronous training, 500 times less communication (H = 500) | Inner AdamW, outer Nesterov, at language-model scale |
| Hero toy, gap at the fixed point | 0.007 at H = 8; 0.030 at H = 16; 0.293 at H = 64 (η = 0.1) | Illustrative: drift roughly quadruples as H doubles at first |
| Term | Plain meaning | Where |
|---|---|---|
| Bandwidth, Gbps | How many bits a link carries each second. 25 Gbps is 25 billion bits, or 3.125 GB, per second. | Chapter 0 |
| All-reduce | Every worker adds its list into a shared average and gets the average back. | Chapter 0 |
| Compute island, neocloud | A cluster that is fast inside and far from the others; a small cloud company that rents such clusters. | Chapter 0 |
| Local SGD, H, round | Workers take H steps alone, then average weights. One such cycle is a round. | Chapter 1 |
| One-shot averaging | One round only: train alone to the end, then average once. | Chapter 2 |
| Convex | Bowl-shaped, with a single bottom. Averaging two models then never makes things worse. | Chapter 2 |
| Client, C, E, B | A worker with its own data; the fraction of clients per round; passes over local data; batch size. | Chapter 3 |
| Center variable, α, τ | The shared copy the workers are tied to; the spring pull per tug; steps between tugs. | Chapter 4 |
| Staleness | Working from an out-of-date copy of a value that others have since changed. | Chapter 4 |
| Drift, fixed point | How far the workers fan out in a round; the place where rounds stop changing the average. | Chapter 5 |
| IID, non-IID, α | Same-kind data on every worker, or different kinds. α is the Dirichlet dial: large is alike, near 0 is one class each. | Chapter 6 |
| Pseudo-gradient, outer optimizer | The change a round made, read as a gradient; the optimizer that applies it. The inner optimizer runs on the workers. | Chapter 7 |
| Generalization gap | Doing well on training data but worse on new data. | Chapter 8 |
| Gossip, parameter server | Talking to a few neighbours instead of everyone; a machine that holds the shared copy. Built in prerequisite 08. | Chapter 4, next lesson |
pythondef train(model, opt, shards, H, rounds, beta=0.0, outer_lr=1.0): v = zeros_like(flat(model)) # outer velocity, [P] for r in range(rounds): start = flat(model).clone() # the same on every worker: [P] for _ in range(H): # Chapter 1: H steps, no network x, y = next(shards.mine) # [B, T] tokens from this worker's own shard loss_fn(model(x), y).backward(); opt.step(); opt.zero_grad() mean = all_reduce_mean(flat(model)) # the meeting: P numbers cross the link delta = start - mean # Chapter 7: the pseudo-gradient v = beta * v + delta # beta = 0, outer_lr = 1 is plain model averaging load(model, start - outer_lr * v)
This is prerequisite 06 of the Training on Compute Islands series, written to make one post readable. In Rohan Anil’s Hitchhiker’s Guide, local updates are the first of four old lines of work. The other three have their own lessons: compression (prerequisite 07), gossip and butterfly mixing (08), and faulty peers (09). Prerequisite 10 joins this lesson to an inner and outer optimizer, and prerequisite 11 puts the whole run together. Before this lesson come data parallelism and the all-reduce, bandwidth arithmetic and optimizers and momentum.
The papers behind each chapter have their own lessons: Parallelized SGD, Elastic Averaging SGD, Federated averaging, Local SGD converges, Post-local SGD, Non-IID federated data, SlowMo, Adaptive federated optimization and DiLoCo.
Now press Teach and explain, from memory, how one round of local SGD works. Say why the average settles away from the best model as H grows. Say how you would choose H for a 25 Gbps link. Then go back to the map at the top, set H to 64, and say which of the four dots is pulling the model off course and why.
Credit: the post is by Rohan Anil of Core Automation. The ideas belong to the papers listed above. The lesson text, the toy and the devices are original to this site; no figure from any source is reproduced.