This is a drill page . The parent note gave you the machinery — data parallelism, model parallelism, communication overhead, gradient accumulation. Here we run that machinery on every kind of number it can face: the easy case, the slow-network case, the "no speedup at all" case, the memory-doesn't-fit case, and the exam-trap case where the naive answer is wrong.
Before line one, one promise: every symbol below is re-earned here. If you have not met a term, it is defined the moment it appears.
Distributed training problems live in a small number of "cells". If you can solve one example from each cell, you can solve any homework or interview question.
Cell
What makes it special
The trap it tests
A. Ideal / linear
communication time ≈ 0
do you know the best case ceiling?
B. Comm-bound
sync time comparable to compute
speedup collapses below k
C. Degenerate k = 1
one device only
formula must give speedup exactly 1
D. Limit k → ∞
infinitely many devices
speedup saturates, not ∞
E. Memory-bound
model does not fit → must split
pick model parallel, not data parallel
F. Gradient accumulation
batch too big for RAM
simulate large batch, no extra GPU
G. Async / stragglers
one slow worker
sync waits for slowest; async uses stale weights
H. Word problem
plain-English scenario
translate story → the right formula
I. Exam twist
numbers chosen to fool you
"more GPUs" gives less speedup
We now walk nine examples , one per cell, in order.
Every example uses these three quantities, so let us pin them down once, in plain words.
Definition The three time symbols
T compute — the seconds one device spends on a forward + backward pass over the whole mini-batch, if it did it alone.
T comm — the seconds spent synchronizing (the all-reduce: every device shares its gradient so all agree on the average). This is pure "talking", no maths.
k — the number of devices working together.
The picture below is the spine of every example. Look at it before reading on.
Worked example Cell A: communication is free
T compute = 400 ms, T comm = 0 ms, k = 4 GPUs.
How fast compared to one GPU?
Forecast: guess before computing — will it be exactly 4 × , a bit less, or a bit more?
Step 1. Each GPU now handles one-quarter of the work: T compute / k = 400/4 = 100 ms.
Why this step? Data parallelism splits the batch into k equal slices, so each device's compute time divides by k .
Step 2. Add talking time: denominator = 100 + 0 = 100 ms.
Why this step? The formula's denominator is "your slice + the sync". Here sync is free.
Step 3. S = 400/100 = 4 .
Why this step? Speedup = old time ÷ new time.
Verify: With zero communication, splitting into k equal pieces must give exactly k × . S = 4 = k . ✓ This is the ceiling no real system beats.
This is the parent's BERT-Large example, re-derived from scratch.
Worked example Cell B: slow network eats the gains
T compute = 400 ms (100 ms per GPU when k = 4 ), sync over slow 10 Gb Ethernet costs T comm = 50 ms, k = 4 .
Forecast: the ideal was 4 × . With 50 ms of talking bolted on, will we keep most of it or lose most of it?
Step 1. Your slice: T compute / k = 400/4 = 100 ms.
Why this step? Same slicing as Cell A.
Step 2. Denominator: 100 + 50 = 150 ms.
Why this step? Now the talking is not free — it adds directly to each iteration.
Step 3. S = 400/150 = 2.667 .
Why this step? Old time ÷ new time.
Step 4 (efficiency). Efficiency = S / k = 2.667/4 = 0.667 , i.e. 66.7 % .
Why this step? Efficiency asks "of the ideal k × , what fraction did we keep?"
Verify: We paid 50 ms on top of 100 ms of useful work — that is one-third overhead, so we should keep about two-thirds. 0.667 ≈ 2/3 . ✓
Common mistake The units trap in Cell B
Do not write S = 100/150 . The numerator is T compute (the whole single-device time, 400 ms), not the per-GPU slice. Mixing them gives S < 1 (slower than one GPU!), which is nonsense.
Always test a formula on the boundary it must obviously satisfy.
Worked example Cell C: only one device
T compute = 400 ms, T comm = 50 ms, k = 1 .
Forecast: with one GPU there is nobody to talk to. What should the speedup be, no matter what?
Step 1. Slice: T compute /1 = 400 ms.
Why this step? One device does the whole batch — no splitting.
Step 2. Sync: with k = 1 there is no one to all-reduce with, so the honest value is T comm = 0 .
Why this step? All-reduce averages across devices; with one device the average is itself — no message sent.
Step 3. S = 400/ ( 400 + 0 ) = 1 .
Why this step? One device cannot be faster than itself.
Verify: S = 1 exactly. ✓ Any formula giving S = 1 at k = 1 is broken. (Note: if you forgot to zero out T comm , you'd get 400/450 = 0.889 < 1 — a red flag that you misused the formula.)
Worked example Cell D: what happens with infinitely many GPUs?
Keep T compute = 400 ms, T comm = 50 ms fixed, and let k grow without bound.
Forecast: does the speedup climb forever, or hit a wall?
Step 1. As k → ∞ , the slice T compute / k → 0 .
Why this step? Dividing a fixed number by an ever-larger k shrinks it to nothing.
Step 2. Denominator → 0 + 50 = 50 ms.
Why this step? Only the (fixed) talking time survives.
Step 3. S m a x = 400/50 = 8 .
Why this step? This is the ceiling — Amdahl's wall . Communication that does not shrink caps your speedup.
Verify: Try a huge k = 1000 : S = 400/ ( 0.4 + 50 ) = 7.94 ≈ 8 . ✓ Adding more GPUs past this point buys almost nothing.
The curve shows Cells A–D at once: it rises, then flattens at S = 8 . That flat ceiling is why "more GPUs always means faster" is false — the headline mistake from the parent note.
Here data parallelism is useless : it needs a full copy on every GPU, but no single GPU can hold one copy.
Worked example Cell E: a model too big for one GPU
A model has θ = 20 × 1 0 9 parameters, stored as float32 (4 bytes each). Each GPU has 16 GB of memory. Ignore activations for now. How many GPUs must the model span, and which strategy?
Forecast: will data parallelism help here at all?
Step 1. Memory for weights: 20 × 1 0 9 × 4 bytes = 80 × 1 0 9 bytes = 80 GB.
Why this step? Bytes = params × bytes-per-param. This is the raw footprint.
Step 2. Compare to one GPU: 80 GB > 16 GB . It does not fit.
Why this step? Data parallelism requires one whole copy per device — impossible here.
Step 3. Minimum GPUs to hold the split model: ⌈ 80/16 ⌉ = 5 .
Why this step? We split the parameters across devices (model parallelism ). Need enough GPUs so the total memory ≥ 80 GB; 5 × 16 = 80 GB just fits.
Verify: 4 GPUs give 64 GB < 80 (fails); 5 GPUs give 80 GB ≥ 80 (fits). ✓ So the answer is model parallelism across at least 5 GPUs , not data parallelism.
Recall When do I reach for model parallelism instead of data parallelism?
Trigger for model parallelism ::: when a single copy of the model does not fit in one device's memory.
Worked example Cell F: simulate a large batch on one GPU
You want an effective batch size B = 64 , but your GPU only fits a micro-batch of b = 8 . How many accumulation steps k , and what must you divide by?
Forecast: how many forward-backward passes before one weight update?
Step 1. Number of micro-batches: k = B / b = 64/8 = 8 .
Why this step? You process 8 chunks of 8 samples to cover all 64.
Step 2. Accumulate: sum the 8 micro-gradients, then divide by 8:
g accum = 8 1 ∑ i = 1 8 g i
Why this step? Gradients are linear (average of averages = grand average), so this equals the gradient of one batch of 64.
Step 3. Update once , after all 8 passes: θ ← θ − η g accum .
Why this step? Updating each micro-batch would be batch-8 training, not batch-64.
Verify (linearity numeric check). Take 8 numbers 1 , 2 , … , 8 as toy "gradients". True mean of all = 4.5 . Split into pairs { 1 , 2 } , { 3 , 4 } , { 5 , 6 } , { 7 , 8 } , take each pair's mean { 1.5 , 3.5 , 5.5 , 7.5 } , then average those four = 4.5 . ✓ Same answer — accumulation is exact, only slower.
Worked example Cell G: one slow worker
Four workers finish an iteration in 90 , 95 , 100 , 300 ms (the last is a straggler). How long is one synchronous iteration, and what does async do differently?
Forecast: in sync mode, does the fast trio wait?
Step 1 (sync). Sync SGD makes everyone wait for the all-reduce, which cannot start until the slowest worker is done.
Iteration time = max ( 90 , 95 , 100 , 300 ) = 300 ms.
Why this step? "Lockstep" means the group moves at the pace of its slowest member.
Step 2 (async). Async SGD lets each worker push its update the instant it finishes, using whatever weights it last pulled.
Throughput is governed by the average , not the max: mean = ( 90 + 95 + 100 + 300 ) /4 = 146.25 ms per update.
Why this step? Nobody waits, so the fast three keep producing updates.
Step 3 (the cost). Async pays with stale gradients : a worker may compute on θ t but apply its update after others already moved to θ t + 5 .
Why this step? No free lunch — no waiting means no guarantee everyone sees the latest weights.
Verify: sync = 300 ms (dominated by straggler), async avg = 146.25 ms (< 300 ). ✓ Async is faster in wall-clock but risks convergence quality.
Worked example Cell H: the manager's question
"We train on 1 GPU in 20 hours. Compute is 400 ms/iter, sync is 50 ms over our current network. If I buy 4 GPUs, how many hours will training take? And is it worth buying 4 more (8 total)?"
Forecast: guess the 4-GPU time before computing.
Step 1 (4 GPUs). From Cell B, S 4 = 400/150 = 2.667 .
Why this step? Same numbers as Cell B — the story is Cell B in disguise.
Step 2. New wall-clock: 20 h /2.667 = 7.5 h.
Why this step? Speedup divides the total time.
Step 3 (8 GPUs). S 8 = 400/ ( 400/8 + 50 ) = 400/ ( 50 + 50 ) = 400/100 = 4 . Time = 20/4 = 5 h.
Why this step? Plug k = 8 into the master formula.
Step 4 (worth it?). Going 4 → 8 GPUs (double the cost) cut time only 7.5 → 5 h — a 1.5 × improvement, not 2 × .
Why this step? We are climbing the flat part of the Cell-D curve; diminishing returns.
Verify: S 8 / S 4 = 4/2.667 = 1.5 , and 7.5/5 = 1.5 . ✓ Consistent. Recommend: fix the network first (Cell I shows why).
Worked example Cell I: "which is faster — 4 fast GPUs or 8 slow-network GPUs?"
Config X: k = 4 , fast interconnect, T comm = 5 ms.
Config Y: k = 8 , slow interconnect, T comm = 60 ms.
T compute = 400 ms in both. Which trains faster?
Forecast: more GPUs (Y has 8) sounds faster. Is it?
Step 1 (X). S X = 400/ ( 400/4 + 5 ) = 400/ ( 100 + 5 ) = 400/105 = 3.81 .
Why this step? Master formula, k = 4 , cheap talking.
Step 2 (Y). S Y = 400/ ( 400/8 + 60 ) = 400/ ( 50 + 60 ) = 400/110 = 3.636 .
Why this step? Master formula, k = 8 , expensive talking.
Step 3 (compare). 3.81 > 3.636 , so the 4-GPU box wins despite having half the GPUs.
Why this step? Config Y's fat T comm = 60 ms swallows the benefit of extra devices — exactly the Cell-D wall biting early.
Verify: S X − S Y = 3.81 − 3.636 = 0.174 > 0 . ✓ Fewer GPUs + fast network beats more GPUs + slow network. This is the parent note's headline mistake made concrete.
Mnemonic The whole page in one line
"Split the compute, but you can't split the talking." T compute divides by k ; T comm does not — and that stubborn term is where every trap hides.
Recall Cell A vs Cell D: what caps speedup?
Cell A (free comms) ceiling is k ; Cell D (fixed comms) ceiling is ::: T compute / T comm , reached as k → ∞ .
Recall Which cell forces model parallelism?
Cell E ::: when one full model copy exceeds a single GPU's memory.
Recall Sync vs async iteration cost with a straggler?
Sync ::: pays the slowest worker's time (max); async ::: pays roughly the average but risks stale gradients.
See also: 3.9-Gradient-descent-optimizers for the update rule θ ← θ − η g , 4.2-GPU-acceleration for where T compute comes from, 5.1-Training-at-scale for real hybrid setups, and 3.4.1-Transformers-overview for why the models in Cell E got so large.