Back to paths

Gradients & Bandwidth — The Communication Wall

Single-device training has no network cost. Spread it across many accelerators and a new tax appears — every step, each device's gradient (a payload the size of the whole model) must be summed with every other device's before the next step. That all-reduce rides the interconnect, and its time is bytes divided by bandwidth. Past some scale it, not the math, caps your throughput — so adding devices stops helping. Vendor-neutral, no calculus.

intermediate~12 min#math-infra#training#performance
200Math of Learning (gradient descent)Lesson 3 of 4Show

Prerequisites: Gradient Descent — What "Training" Actually Is, What a Neuron Learns — Weights, Networks, and Backprop


The one-line summary

On one accelerator, training has no network cost. Spread it across many and a tax appears that dominates at scale: every step, each device computes a the size of the whole model, and they must all be summed together before the next step. That sync is an , it rides the between accelerators, and its time is simply bytes ÷ bandwidth. Get a feel for when that sync overtakes the math and you'll know the thing that trips up every first cluster: past a point, adding devices stops making training faster.

A gradient is a payload, not a derivative

Forget the calculus. Operationally, a gradient is just a second copy of the model — one number per parameter, saying which way to nudge that weight. A 7B-parameter model in bf16 produces a ~14 GB gradient. Every step. On every device. (That's the same byte math as precision & memory: params × bytes-per-number.)

The catch of multi-device training: each device sees only its slice of the data, so it computes a different gradient. Before anyone can take a step, those gradients must be averaged into one — so every device stays on the same model. That reconciliation is the network cost.

All-reduce: the sync, and bytes-on-the-wire is the cost

The collective that does it is all-reduce: sum every device's gradient, hand each device the total. It rides the fast interconnect (not the slow cross-node network), and a ring all-reduce is clever — each device passes its payload around the loop in small segments, and as you add devices each segment shrinks proportionally. So the data each device moves stays roughly 2× the payload regardless of how many devices there are — the cost doesn't blow up as you scale. But the time for that pass is still just bytes ÷ bandwidth.

So the whole step is two phases: compute the gradients (the backward pass), then all-reduce them. Drive the two against each other below — set the model size, the device count, and the interconnect bandwidth, and watch where the sync overtakes the compute:

Simulation: gradient-sync-explorer

When adding devices stops helping — the communication wall

Here's the trap. Hold the global batch fixed — the total examples processed per step across all devices — and add devices: each device now does less compute (it owns a smaller slice of that batch), so per-device compute time shrinks. But the all-reduce moves the same model-sized payload — its time stays flat. Shrinking one phase while the other holds means the sync's share of every step keeps rising, until it dominates. At that point you're : doubling the devices barely moves the needle, and the speedup curve in the sim peels away from the ideal line and flattens.

The levers (and the one that backfires)

When a run is communication-bound, three things actually help — and one tempting move makes it worse:

  • Overlap comm with compute. The backward pass produces gradients one layer at a time (last layer first), so each layer's gradient is ready to all-reduce the moment that layer finishes — you can start syncing the early ones while later ones are still computing, hiding the sync behind compute instead of adding to it. Flip the overlap toggle in the sim and watch the step time drop; it's automatic in most frameworks.
  • A faster interconnect. Sync time is bytes ÷ bandwidth, so more bandwidth (a fatter fabric, or keeping the job on the fast in-node interconnect instead of the slow cross-node network) directly cuts it.
  • Bigger steps (more compute per sync) — a larger per-device batch raises the compute side, so the fixed sync becomes a smaller share of each step.
  • ✗ More devices — the reflex, and the wrong one once you're comm-bound: it shrinks compute while the sync stays flat, raising the sync's share.

Why this matters

  • Provisioning. "Throw more chips at it" has a ceiling, and this is where it is. Past the wall you're paying for devices that mostly wait on the network — the scaling-efficiency number in the sim is the one to watch.
  • The interconnect is a first-class resource. Training cares about bandwidth between accelerators, not just FLOPs and HBM — which is why the fast in-node fabric and the network topology (the next topic) matter so much, and why jobs are packed to stay on it.
  • Reading a stalled scale-up. "We doubled the pod and throughput barely moved" is no longer a mystery — it's the comm wall, and the fix is overlap or bandwidth, not more devices.

Put it together

Steps
  1. Find the wall

    In the sim, fix the model and bandwidth and slide the device count up. Name the device count where it flips from compute-bound to communication-bound, and say what happened to per-device compute vs the all-reduce to cause it.

  2. Hide the sync

    At a communication-bound setting, turn on overlap. Explain, in one sentence, why the step time drops even though the all-reduce still has the same bytes to move.

  3. Pick the right lever

    A run is comm-bound and someone proposes adding more devices. Say why that backfires and which lever you'd reach for instead.

Review

Flashcards1 / 4

What is a gradient, as a network payload?

Check yourself

Quick exam1 / 3 · 0 correct

In distributed training, what reconciles each device's gradient before the next step?

Your notes on this lesson