SysDesignAtlas

Interconnect & Collective Operations

NVLink, InfiniBand, and the all-reduce — why the network between GPUs determines how large a model you can train, and why bandwidth hierarchy dictates parallelism strategy.

HLDHard12 min readainetworkingncclcollectives
Confidence

#The hierarchy that decides everything

Multi-GPU work is constrained by a bandwidth hierarchy spanning three orders of magnitude.

A node here is one physical server holding 8 GPUs. The names below are just the wires between things — NVLink is the dedicated GPU-to-GPU link inside a server, PCIe is the general-purpose bus to the CPU, InfiniBand is the fast network between servers.

   Within one GPU:      its own memory    2-8 TB/s
   GPU ↔ GPU, in node:  NVLink        400-1,800 GB/s
   GPU ↔ CPU:           PCIe               ~64 GB/s
   Node ↔ node:         InfiniBand     25-100 GB/s per GPU
   Across datacenters:  wide-area net   <1 GB/s, high latency

   → Each step down is roughly 5-10× worse.

   Every parallelism decision in distributed training is
   an attempt to keep chatty communication on a fast tier
   and infrequent communication on a slow one.

That's the whole design principle, and it explains the standard configuration you'll see everywhere. There are three main ways to split training across GPUs (each gets its own lesson later), and they talk at very different rates:

  • Tensor parallelism splits each layer's weight matrices across GPUs, so the GPUs must swap partial results inside every layer. That is constant chatter, so it goes inside a node, on NVLink.
  • Pipeline parallelism gives each GPU a different block of layers, so data only crosses between GPUs at the boundary between blocks.
  • Data parallelism gives every GPU a full copy of the model and different training examples, so GPUs only sync once per step, to average their gradients.

Those last two talk far less often, so they go across nodes, where InfiniBand is fast enough.

#The collectives

A collective is an operation that all the GPUs perform together — not one sending to one, but the whole group participating to reach a shared result. Distributed training uses a small vocabulary of them, and knowing what each costs is enough to reason about any parallelism scheme.

   Four GPUs, each starting with data [A] [B] [C] [D]

   ALL-REDUCE      every GPU ends with A+B+C+D
                   → gradient averaging in data parallelism
                   → the workhorse; most traffic in most jobs

   REDUCE-SCATTER  GPU_i ends with the i-th shard of A+B+C+D
                   → half of an all-reduce

   ALL-GATHER      every GPU ends with [A][B][C][D] concatenated
                   → the other half; used by ZeRO/FSDP (which
                     split the weights across GPUs) to
                     reassemble the full weights when needed

   ALL-TO-ALL      GPU_i sends a different piece to every GPU
                   → MoE (mixture-of-experts) routing: each
                     token is sent to the GPU holding the
                     expert it needs; the most demanding

   BROADCAST       one GPU's data goes to all
                   → distributing initial weights

   Note:  all-reduce  ==  reduce-scatter  then  all-gather

#The cost of an all-reduce

The obvious way — everyone sends their numbers to one designated GPU, which adds them up and sends the answer back — puts all the traffic through a single machine, and gets worse the more GPUs you add.

Ring all-reduce avoids that by arranging the GPUs in a circle where each only ever talks to its neighbour, passing partial sums around. No one is a bottleneck, and remarkably, the amount each GPU sends barely changes as the ring grows.

#The physical fabrics

FabricBandwidthWhere
NVLink400–1,800 GB/s aggregate per GPUGPU-to-GPU inside a node, via NVSwitch
NVLink C2C~900 GB/sCPU-to-GPU on integrated superchips
PCIe 5.0 x16~64 GB/sHost to device; the bottleneck for offload
InfiniBand NDR400 Gb/s (~50 GB/s) per portNode to node in HPC-class clusters
RoCESimilar, over EthernetNode to node where Ethernet is preferred

Two properties of the node-to-node fabric matter as much as raw bandwidth:

RDMA lets one node's network card write directly into another node's GPU memory, with no CPU involvement and no copy through host memory. GPUDirect RDMA is what makes multi-node training viable — without it, every gradient crosses PCIe to the CPU, over the network, and back across PCIe.

Lossless delivery. InfiniBand uses credit-based flow control: a sender only transmits when the receiver has told it there is buffer space waiting, so packets are never dropped due to congestion. Collectives are extremely sensitive to loss. A single dropped packet has to be resent, and every other GPU in the collective sits waiting for it, because all-reduce cannot complete until the slowest member arrives. RoCE runs over ordinary Ethernet, which normally drops packets when busy. To approximate lossless behaviour it relies on Priority Flow Control (PFC), where a congested switch tells the sender to pause. Misconfigured PFC is one of the classic causes of a cluster that trains at half its expected speed.

Ethernet has been closing the gap. Meta built two 24,000-GPU clusters for Llama 3 — one on InfiniBand, one on RoCE — and reported comparable training performance once the RoCE fabric was tuned. The Ultra Ethernet Consortium published its 1.0 specification in 2025: a transport designed for AI traffic. It uses multipath packet spraying (spreading one flow's packets across many network paths at once, so no single link becomes a hotspot) and congestion control that tolerates loss better than classic RoCE. Expect Ethernet-based fabrics to be the common choice for new clusters, with InfiniBand where its maturity is worth the price.

#Topology

   FAT-TREE (typical GPU cluster)

              ┌── spine ──┐
          ┌───┴──┐    ┌───┴──┐
        leaf    leaf leaf   leaf
         │       │    │      │
       nodes   nodes nodes  nodes

   Full bisection bandwidth: split the cluster into any two
   halves, and every node in one half can talk to a node in
   the other at full link speed simultaneously. Expensive —
   switch cost grows faster than the number of nodes.

   RAIL-OPTIMISED (what large AI clusters actually build)

     GPU 0 of every node → switch 0
     GPU 1 of every node → switch 1
     ...
     GPU 7 of every node → switch 7

   Rationale: with tensor parallelism inside each node,
   GPU 3 on every node holds the same slice of the model.
   So for data parallelism, GPU 3 on node A only needs to
   average gradients with GPU 3 on node B, C, D... — not
   with every GPU. Give each GPU position its own switch
   (a "rail") and you get most of the benefit of full
   bisection at a fraction of the switch cost.

The rail-optimised design is a good example of infrastructure shaped by the specific communication pattern of the workload. It's cheaper because it's less general.

#Overlapping communication with compute

Communication you can hide is communication you don't pay for.

   NAIVE                          OVERLAPPED

   ├─ forward ──┤                 ├─ forward ──┤
   ├─ backward ─┤                 ├─ backward ─────────┤
   ├─ all-reduce ─┤                  ├─ AR layer N ─┤
   ├─ optimizer ┤                      ├─ AR N-1 ─┤
                                          ├─ AR N-2 ─┤
   step = C + R                        ├─ optimizer ┤

                                  step = max(C, R) + ε

   The mechanism: gradients for layer N are ready as soon as
   layer N's backward completes — long before layer 1's.
   So start reducing layer N while layer N−1 is still
   computing. Bucket small gradients together to avoid
   paying latency per tensor.

PyTorch DDP does this automatically with gradient buckets (default ~25 MB). The tunable is bucket size: larger buckets amortise latency better but delay the start of communication; smaller buckets start earlier but pay more per-message overhead. On a slow fabric, larger buckets usually win.

When communication exceeds compute, no amount of overlap saves you — you're network-bound and the fix is a different parallelism strategy, gradient compression, or a faster fabric.

#Failure modes that look like performance problems

The straggler. Collectives are synchronous: everyone waits for the slowest. One GPU thermally throttling, one node with a degraded link, or one process doing extra work slows the entire job to its pace. At 1,000 GPUs, a single 10% straggler costs 10% of the whole cluster.

Silent link degradation. A cable or optic that has partially failed still passes traffic, at reduced bandwidth or with retransmissions. Nothing errors; the job just gets slower. Detection requires actively monitoring per-link bandwidth against expectation, not waiting for errors.

NCCL hangs. Each GPU's process in a job is called a rank (rank 0, rank 1, ...). If one rank crashes mid-collective, the others block forever waiting for it. Without a timeout, a 1,000-GPU job sits idle burning money until someone notices. Always set NCCL_TIMEOUT and alarm on it.

#Exercise

#Check yourself

What is the bandwidth hierarchy, and the rule that follows?Show answer
GPU memory 2–8 TB/s, NVLink 400–1,800 GB/s, PCIe ~64 GB/s, InfiniBand 25–100 GB/s per GPU, WAN under 1 GB/s. Put chatty communication (tensor parallel) on fast tiers, infrequent (pipeline, data) on slow ones.
Name the main collectives and their uses.Show answer
All-reduce (gradient averaging), reduce-scatter and all-gather (its two halves; ZeRO/FSDP use them), all-to-all (MoE routing, the hardest), broadcast (initial weights).
What does a ring all-reduce cost?Show answer
Each GPU sends about 2S bytes whatever N is — why data parallelism scales — plus a latency term of 2(N−1) hops. A 14 GB gradient takes ~31 ms over NVLink, ~560 ms over InfiniBand.
Why do large clusters use hierarchical all-reduce?Show answer
The ring's latency term grows with N (10 ms at 1,000 GPUs); reducing within nodes over NVLink first, then across a small ring of nodes, cuts hops to O(nodes) or O(log N).
Why do RDMA and lossless delivery matter?Show answer
GPUDirect RDMA lets a NIC write straight into a remote GPU's memory with no CPU copy; a dropped packet stalls every participant in a collective, so misconfigured RoCE flow control silently halves throughput.
What is a rail-optimised network?Show answer
GPU i of every node connects to switch i, because GPU i on each node holds the same model slice and mostly talks to the other GPU i's — most of full bisection's benefit at a fraction of the switch cost.
How is communication overlapped with compute?Show answer
Start all-reducing a layer's gradients as soon as its backward pass finishes, in ~25 MB buckets. If communication exceeds compute, change the parallelism strategy.
How do you diagnose a slow distributed job?Show answer
Run nccl-tests on the exact allocation, check placement, look at the per-rank step-time distribution for stragglers, and compare compute with communication time.

#What to carry forward

  • The bandwidth hierarchy spans 3 orders of magnitude. Match chatty communication to fast tiers.
  • Ring all-reduce moves ~2S bytes per GPU regardless of N — that constant is why data parallelism scales.
  • The latency term grows with N, which is why large clusters go hierarchical.
  • RDMA and lossless delivery are what make multi-node training work; misconfigured PFC silently halves throughput.
  • Topology-unaware placement can cost several times your throughput with no visible error.
  • Overlap communication with compute by bucketing gradients; when communication exceeds compute, change strategy.
  • Collectives are synchronous — one straggler taxes the entire cluster.
00:00
/ 12m