AI State of the Art
MLOps/Infrastructure & Compute/30 min
Section 187

Networking for Distributed Training: InfiniBand, NVLink, NVSwitch

Listen as a podcast β†’

The problem: when the road matters more than the vehicles

Picture a factory where a thousand workers operate in parallel. Each computes a piece of the problem, then must pass its result to the others before going further. If the door lets only ten people through at a time, the rest wait outside. Even with very fast workers, the whole factory slows down, because communication becomes the limiting factor.

That is exactly what happens when training a large model across hundreds of cards. If the network cannot carry the gradients (the corrections each card computes at every training step) fast enough, very expensive machines spend their time waiting instead of computing.

Before any number: the unit

This is the page where the units trap does the most damage, because it compares technologies that do not use the same convention:

  • NVLink and PCIe are quoted in bytes per second (GB/s);
  • InfiniBand and Ethernet are quoted in bits per second (Gbit/s).

A factor of 8 separates them. Setting "NVLink 900" beside "InfiniBand 400" and concluding the ratio is 2 is the field's most frequent error: the real ratio is 18, because 400 Gbit/s is 50 GB/s.

The full rule, with three verified reference points, is set out once for the whole course in Bits and bytes. This page always states the unit and the counting convention.

Three layers address the problem, from the most local to the most global: NVLink connects cards within a server, NVSwitch organises those links, and InfiniBand or RoCE connect servers to each other.

How much data actually moves?

Before comparing pipes, let's establish what flows through them. The answer is more elegant than you might expect.

The operation to perform at every step is the all-reduce: each card holds its own version of the gradients, and all must leave with the sum. The algorithm used is the ring: cards are arranged in a circle and each talks only to its neighbour.

Diagram titled Ring Algorithm, in two halves. On the left, under the heading Scatter Reduce, four boxes arranged in a ring represent four processes, each containing three cells numbered 1, 2 and 3 in different colours; red arrows marked 1st Iteration and green arrows marked 2nd Iteration connect each cell to the same-numbered cell of the next neighbour in the ring. On the right, under the heading All Gather, the same ring structure, where cells are again passed from neighbour to neighbour by red then green arrows. A black arrow in the centre indicates the transition from the Scatter Reduce phase to the All Gather phase.
What the gradient exchange really looks like: a ring, traversed in two phases. During Scatter Reduce, each GPU sends only a slice of its gradients to its neighbour and adds the slice it receives; during All Gather, the already-totalled slices make a second lap so everyone leaves with the complete sum. Nobody talks to everybody: each GPU talks only to its neighbour, and the volume sent per GPU does not depend on the number of GPUs.Source : Paper A Hitchhikers Guide On Distributed Training of Deep Neural Networks (arXiv 1810.11787), via ar5iv

The ring is traversed in two phases, as the image shows. First reduce-scatter: the gradients are cut into NN slices, and over Nβˆ’1N-1 steps each slice travels round accumulating, so that each card ends up holding one fully summed slice. Then all-gather: those finished slices make another lap of Nβˆ’1N-1 steps so everyone has everything.

At each step a card sends one slice, that is S/NS/N bytes if SS is the total gradient size. The volume sent per card is therefore:

(Nβˆ’1)Γ—SN⏟reduce-scatter+(Nβˆ’1)Γ—SN⏟all-gather=2Γ—Nβˆ’1NΓ—S\underbrace{(N-1) \times \frac{S}{N}}_{\text{reduce-scatter}} + \underbrace{(N-1) \times \frac{S}{N}}_{\text{all-gather}} = 2 \times \frac{N-1}{N} \times S

Where SS is the gradient size in bytes, NN the number of cards, and the result the number of bytes each card must send at every step.

The surprising result, and it is reassuring

Look at what the fraction Nβˆ’1N\frac{N-1}{N} becomes as NN grows: for 8 cards it is 0.875, for 1,000 cards 0.999. It tends to 1 and never exceeds it.

In other words, the volume sent per card tends to 2S2S and barely depends on the number of cards at all. Doubling the fleet does not double the traffic per card: it stays at twice the gradient size, however many participants there are.

For a 7-billion-parameter model, whose BF16 gradients weigh 2Γ—7Γ—109=142 \times 7 \times 10^9 = 14 GB, each card therefore emits roughly 28 GB per training step, on 8 cards as on 800.

This result is what makes distributed training possible at all. What does degrade with card count is not the volume but the number of steps (2(Nβˆ’1)2(N-1)) hence sensitivity to latency, and the chance that one slow card holds everyone up.

The idea

Eight cards in one server could communicate over the PCIe bus, the standard channel linking a machine's components. But PCIe 4.0 with 16 lanes tops out at about 32 GB/s per direction, that is 64 GB/s counting both. For cards moving tens of gigabytes per step, that is a garden hose.

NVLink is NVIDIA's answer: a direct card-to-card link that bypasses the processor. Data goes from one card's memory to another's, and a card can read its neighbour's memory as if it were its own.

Block diagram titled Basic DGX/HGX GPU to CPU Block Diagram. At the top, two processors CPU 1 and CPU 2 joined by a dashed link. Each CPU descends through blue links to four PCIe Switch blocks, and each switch carries a CX7 NIC network card. Below the switches, eight H100 SXM5 blocks numbered 1 to 8. Below the GPUs, four NVLink Switch Chip blocks connected to each of the eight GPUs by a dense bundle of thin grey lines. The legend distinguishes NVLink links as thin grey lines, PCIe x16 links as blue lines, and the CPU interconnect as dashes.
The two paths coexisting in an 8-GPU server. In blue, the PCIe path going up to the CPUs: that is the one topping out at 64 GB/s. In grey, at the bottom, the NVLink mesh through which GPUs talk directly, never going up to the CPU. The CX7 cards attached to the PCIe switches are the exit towards other servers, discussed below.Source : FS Community Blog, NVLink vs. PCIe: Selecting the Ideal Option for NVIDIA AI Servers

The generations

The entire column below is in gigabytes per second, both directions summed, NVIDIA's convention. Stating it prevents the error of mixing per-direction and total figures in one table.

GenerationYearCardLinksTotal rate, both directions
NVLink 12016P1004160 GB/s
NVLink 22017V1006300 GB/s
NVLink 32020A10012600 GB/s
NVLink 42022H10018900 GB/s
NVLink 52024B200181,800 GB/s
The calculation that catches everyone

Take the H100: 18 links for 900 GB/s in total. That is 50 GB/s per link, both directions summed, hence 25 GB/s per link per direction.

The classic error is to find "25 GB/s per link" in some documentation, multiply by 18, get 450, and conclude the 900 figure is inflated. It is not: 25 is a per-direction rate, and NVIDIA quotes the two-direction total. 25Γ—2Γ—18=90025 \times 2 \times 18 = 900.

Remember the general rule: when two sources give figures in a ratio of 2 for the same hardware, it is almost never an error but a difference of convention.

Compared with PCIe counted the same way (64 GB/s both directions) NVLink 4 therefore offers about 14 times the bandwidth, and NVLink 5 about 28 times. That progression is what made splitting a model across cards practical.

Why this is decisive for tensor parallelism

When one layer is split across 8 cards (tensor parallelism, described in Tensor parallelism) the cards must exchange intermediate results several times per layer, hence hundreds of times per forward pass.

It is by far the most communication-hungry form of parallelism. Hence a design rule you meet everywhere: tensor parallelism is deployed only inside a server, where NVLink is available. Stretching it across a between-machine network eight times slower destroys the gain. That rule is the starting point for the composition of parallelisms treated in Advanced parallelism.

NVSwitch: the exchange

The cabling problem

If 8 cards each want a direct link to every other, you need one link per pair, that is 8Γ—72=28\frac{8 \times 7}{2} = 28 links. At 16 cards, 120. The number of cables grows as the square of the card count: unmanageable.

NVSwitch is the answer: a central exchange through which everything passes. Each card plugs into the switch, which routes the messages. The number of connections then grows linearly.

An 8-card H100 server contains 4 NVSwitch chips working in parallel, which is what delivers the 900 GB/s per card and lets all 8 communicate simultaneously without getting in each other's way.

NVLink is no longer confined to the server

The rule "NVLink inside a server, network between servers" was long absolute. It is no longer quite true: racks such as the GB200 NVL72, described in NVIDIA H100, B200, GB200, extend the NVLink domain to 72 cards through dedicated switch trays.

The point is exactly that of the previous paragraph: enlarge the domain in which tensor parallelism stays practical. But mind the figure you then read: the "130 TB/s" quoted for such a rack is an aggregate across 72 cards, not a card-to-card rate, which remains 1.8 TB/s.

Computing inside the network

With Blackwell, the switch no longer merely routes: it computes.

The idea is called SHARP (Scalable Hierarchical Aggregation and Reduction Protocol). During an all-reduce, the additions are performed by the switch, as the data passes through, instead of bringing values back to the cards to be summed there.

Diagram titled All-Reduce. At the top, four columns labelled Rank 0 to Rank 3, each in a different colour (blue, pink, yellow, green), containing four cells labelled G with two subscripts: the first denotes the gradient chunk, the second the rank. In the centre, the formula G subscript i equals the sum, for j from 0 to 3, of G subscript i j, with four arrows descending to the four ranks. At the bottom, all four ranks contain the same four cells G1, G2, G3 and G4, whose striped background mixes all four colours, indicating each cell is now the sum of all four ranks' contributions.
What an all-reduce does, seen from the data's side. At the top, each GPU (each rank) has only its own version of each gradient chunk, hence the four colours. At the bottom, the four versions have been summed and every GPU leaves with the same result, hence the multicoloured cells. It is precisely that addition the Blackwell NVSwitch performs in transit, inside the network, instead of leaving it to a GPU.Source : Kempner Institute Computing Handbook (Harvard), Distributed GPU Computing

The gain is twofold: cards no longer spend time on those additions, and above all the volume in flight drops, since the switch emits one sum where it received several values. The size of the gain depends entirely on message size and topology; the percentages quoted here and there apply to one specific measurement, not in general.

InfiniBand: connecting servers

Beyond the server, a network is needed. Ordinary Ethernet is too slow and, more importantly, too erratic in latency. InfiniBand is a technology designed for heavy exchange between compute machines.

RDMA, the central mechanism

RDMA (Remote Direct Memory Access) lets one machine write directly into another's memory, without the remote machine's processor or operating system being involved.

Without RDMA, data crosses the processor, system memory and the operating system's network stack, with a copy at each stage. With RDMA, the network card deposits the data at the agreed address. It is the difference between a parcel handed over in person and one routed through five sorting offices.

The result is a latency below one microsecond. For scale: a blink of the eye lasts around 100,000 microseconds.

The generations

This column is in gigabits per second, the networking world's convention. The conversion to bytes is given alongside, because that is what makes comparison with NVLink possible.

GenerationAdvertised rateConverted to bytes
HDR200 Gbit/s25 GB/s
NDR400 Gbit/s50 GB/s
XDR800 Gbit/s100 GB/s

The middle row is the reference point to keep, and it carries the whole argument of distributed training: one InfiniBand NDR link is 50 GB/s, against 900 GB/s for NVLink 4. A ratio of 18, not of 2 as the naive comparison of the numbers 400 and 900 suggests.

That factor of 18 is the reason the whole hierarchy of parallelisms exists: put the most intense exchanges inside the server, and send across the network only what can afford it.

GPUDirect RDMA

Without this technology, data travelling from a card to another card on a different server takes this path:

graphics card β†’ PCIe β†’ processor β†’ system memory β†’ network card β†’ network β†’ and the reverse.

With GPUDirect RDMA, the network card reads directly from the graphics card's memory, over the PCIe bus they share:

graphics card β†’ PCIe β†’ network card β†’ network β†’ network card β†’ PCIe β†’ graphics card

The processor and system memory drop out of the path. You save several copies and, above all, eliminate trips through the operating system that cost far more in latency than in bandwidth. Note the link used is still PCIe: NVLink connects graphics cards to each other, not a graphics card to a network card.

RoCE: RDMA over Ethernet

RoCE (RDMA over Converged Ethernet, pronounced "rocky") takes the RDMA mechanism and runs it on standard Ethernet hardware, with no specialised InfiniBand switches.

The trade-off rests on one precise technical point, worth understanding because it explains everything else. InfiniBand manages congestion by credits: a sender transmits only if it holds a permit corresponding to free space at the receiver. A frame is therefore never dropped for lack of room. Ethernet, designed to tolerate loss, discards excess packets and relies on retransmission, acceptable for the web, catastrophic for an all-reduce where every card is waiting on the straggler.

RoCE therefore reintroduces flow-control mechanisms onto Ethernet. They work, but they require careful switch tuning, and their quality depends on the hardware used.

AspectInfiniBandRoCE
Latencyunder 1 Β΅saround 1 to 2 Β΅s
Congestion controlnative, credit-basedto be configured on the switches
Hardwarespecialisedstandard Ethernet
Costhighmoderate
Very large fleetsthe proven choiceneeds more tuning

In practice: for a few hundred cards, RoCE does the job at lower cost. Beyond that, InfiniBand keeps the edge thanks to its native congestion control, when thousands of cards transmit at once, congestion is certain, and how it is handled decides real performance.

Networking is a significant share of a compute fleet's budget, though no general percentage means much: it depends on the ratio between card prices and switch prices, both highly volatile. It is, however, the line item that budget projections most often forget.

Why this matters

The network is invisible and yet it decides a fleet's real utilization, the MFU introduced in NVIDIA H100, B200, GB200. A well-cabled fleet and a badly cabled one, with identical cards, do not deliver the same service, and the gap is paid in billed compute time.

In summary: NVLink connects a server's cards at 900 GB/s or more. NVSwitch organises those links and can now compute in transit. InfiniBand or RoCE connect servers at roughly 50 GB/s. It is the factor of 18 between those two worlds (not the figures taken in isolation) that dictates the entire architecture of a distributed training run.

Check your understanding0 / 5

1. A quote lists 'NVLink 4: 900' next to 'InfiniBand NDR: 400'. What gap actually separates the two links?

2. A training run goes from 8 to 800 cards, same model. What happens to the volume of gradients each card must send per step?

3. A document quotes 25 GB/s per NVLink 4 link, and the H100 has 18 of them. That gives 450 GB/s, far from the advertised 900. Who is wrong?

4. Why is tensor parallelism almost always deployed inside a single server?

5. What really separates InfiniBand from RoCE when thousands of cards transmit at once?