The Cost of Collective Communication
The alpha–beta model, and why a ring all-reduce moves a bounded amount of data per node no matter how many nodes there are.
The cost model
Sending a message of bytes between two nodes takes
where is the per-message startup latency (microseconds: software stack, wire propagation) and is the achievable bandwidth in bytes per second. Nodes are assumed able to send and receive simultaneously, and disjoint pairs communicate without interference.
Assumptions
The model ignores topology, congestion and contention for shared switches. It is accurate for a dedicated fabric where the communication pattern respects the topology — which is precisely why collective implementations are written to match the wiring. It is a poor model for an oversubscribed datacentre network, where the effective depends on what everyone else is doing.
The baseline
Let nodes each hold an -byte vector, and let all end up holding the element-wise sum. If all nodes send to a designated root, which reduces and broadcasts the result back, the time is at least
when the root's link is serialised, growing linearly in .
The ring
Arrange the nodes in a ring and split each node's -byte vector into chunks of bytes. Then all-reduce can be performed as a reduce-scatter followed by an all-gather, each taking steps in which every node sends one chunk to its successor. The total cost is
In particular the bandwidth term is bounded by for every , and increases to that limit rather than growing with .
Key idea
The bandwidth term of a ring all-reduce is essentially independent of the cluster size: it is at to within 12%, and at to within 0.4%. The price is the latency term, which grows as . So the ring is the right algorithm for large gradients and the wrong one for small, frequent messages — which is exactly the split observed in practice between data-parallel gradient synchronisation and tensor-parallel activation exchange.
Is the ring optimal?
In any all-reduce over nodes where the result depends non-trivially on every input, each node must receive at least bytes. Hence no algorithm has a per-node bandwidth term below , and the ring's is within a factor of of optimal.
What this does not say
The factor of two is real and is not an artefact: the ring performs a reduce-scatter and an all-gather, and each separately meets the bound. An all-reduce is genuinely two collectives' worth of traffic. Implementations that appear to beat this are either overlapping communication with computation — which hides the cost rather than removing it — or reducing , by gradient compression or lower precision, which changes the problem.
Choosing an algorithm by message size
Compare the ring, costing , with a recursive halving-and-doubling scheme costing for power-of-two . The two have the same bandwidth term, so the comparison is entirely in latency and the logarithmic scheme wins for every . Against a latency-optimal scheme, the ring is preferable only when
that is, once the transfer time of the message exceeds roughly startup latencies.
References
- PaperR. Thakur, R. Rabenseifner, W. Gropp (2005). Optimization of Collective Communication Operations in MPICHSource of the recursive-halving/doubling and ring cost analyses used here.
- PaperP. Patarasuk, X. Yuan (2009). Bandwidth Optimal All-reduce Algorithms for Clusters of WorkstationsEstablishes the bandwidth optimality of the ring algorithm.
These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.
Results stated on this page
- DefinitionThe alpha–beta cost modelTransferring n bytes costs a fixed startup latency plus n divided by bandwidth.
- PropositionCost of a centralised all-reduceproof includedGathering at one root and broadcasting back moves (p−1)N bytes across the root's link, so its time grows linearly in the node count.
- TheoremCost of the ring all-reduceproof includedReduce-scatter followed by all-gather moves 2(p−1)N/p bytes per node, which is below 2N for every p, while incurring 2(p−1) latency terms.
- PropositionA bandwidth lower bound for all-reduceproof includedEvery node must receive at least N(p−1)/p bytes of information, so no algorithm beats the ring's bandwidth term by more than a factor of two.
- CorollaryWhich term dominatesproof includedThe ring is bandwidth-optimal for large messages and latency-suboptimal for small ones, with the crossover at a message size proportional to alpha times bandwidth.