Ring all-reduce is a collective communication algorithm in which a group of processes, typically GPUs, are arranged in a logical ring and exchange chunks of data with their neighbors so that every process ends up holding the element-wise sum (or another reduction) of all inputs. In AI infrastructure, it is the classic method for synchronizing gradients in data-parallel training, and it remains one of the core algorithms in libraries such as NCCL, RCCL, Gloo and Horovod.
Its appeal lies in a simple property: the amount of data each GPU sends and receives is nearly independent of the number of GPUs. This makes the algorithm bandwidth-optimal for large messages, which is exactly the regime of gradient tensors that span hundreds of megabytes or several gigabytes.
How ring all-reduce moves data around the ring
Ring all-reduce splits each process’s buffer into N equal chunks, where N is the number of participants, and runs in two phases of N minus 1 steps each. In every step, each process sends one chunk to its right neighbor and receives one chunk from its left neighbor, so all links in the ring are busy simultaneously.
In the first phase, called reduce-scatter, each received chunk is added to the local copy of that chunk before being forwarded. After N minus 1 steps, every process owns one fully reduced chunk. In the second phase, called all-gather, those finished chunks circulate around the ring without further arithmetic until every process holds the complete reduced buffer.
The table below traces the two phases for a ring of four GPUs.
| Phase | Steps | What each GPU does | State at the end |
|---|---|---|---|
| Reduce-scatter | 3 | Sends one chunk, adds the received chunk | Each GPU owns one fully summed chunk |
| All-gather | 3 | Forwards finished chunks unchanged | Each GPU holds the full summed buffer |
| Total | 6 | Six sends and six receives per GPU | All replicas have identical gradients |
Cost model and bandwidth optimality
Collective algorithms are usually analyzed with the alpha-beta model, where alpha is the fixed latency per message and beta is the time per byte. For a buffer of size S across N processes, ring all-reduce sends 2(N-1)/N times S bytes per process and needs 2(N-1) communication steps.
As N grows, the data volume per GPU approaches 2S, which is the theoretical lower bound for any all-reduce algorithm. The latency term, however, grows linearly with N, so ring all-reduce becomes inefficient when messages are small or rings are very long.
| Number of GPUs | Data sent per GPU | Communication steps |
|---|---|---|
| 2 | 1.0 GB | 2 |
| 8 | 1.75 GB | 14 |
| 64 | about 1.97 GB | 126 |
| 1024 | about 2.0 GB | 2046 |
These figures show the central trade-off: bandwidth cost stays flat, while latency cost keeps rising. At large scale, the slowest link in the ring also limits the whole operation, because every chunk must pass through every link.
Ring all-reduce compared with other all-reduce algorithms
Ring all-reduce is one of several ways to implement the all-reduce primitive, and production libraries choose between algorithms dynamically based on message size, topology and GPU count. A parameter server design, the older alternative, centralizes aggregation and therefore concentrates traffic on a few nodes.
| Strategy | Step count grows as | Traffic pattern | Where it wins |
|---|---|---|---|
| Ring | 2(N-1) | Even load on every link | Big gradient buckets on a few dozen GPUs |
| Double binary tree | About 2 log2 N | Two complementary trees share links | Thousands of GPUs or mid-size buffers |
| Recursive halving-doubling | About 2 log2 N | Pairwise exchanges at growing distance | Short buffers on power-of-two groups |
| Hierarchical ring | Rings per topology level | Most bytes stay on fast local links | Servers with NVLink inside and a fabric between |
| Parameter server | Two hops via a server | Traffic concentrates on servers | Asynchronous or sparse updates |
In practice, hierarchical variants dominate on modern clusters: GPUs first reduce over fast intra-node links such as NVLink, then a smaller inter-node ring or tree runs over InfiniBand or RoCE, and finally results are broadcast locally. This keeps the expensive network traffic to one participant per node.
Using ring all-reduce in distributed training
In data parallelism, every replica produces gradients from a different slice of the batch, and the ring combines them so that all replicas apply the same parameter update. Training frameworks rarely send one giant tensor; they pack gradients into fixed-size buckets and start the ring for a bucket while later layers are still running backpropagation, which hides much of the transfer time.
Fully sharded training reuses the two halves of the ring separately. A reduce-scatter leaves each GPU with the summed gradient shard it is responsible for, and an all-gather reassembles full parameters just before a layer needs them. Knowing how the ring behaves therefore predicts the network cost of nearly every current training configuration.
- Bucket size balances latency overhead against overlap with computation.
- Ring order should follow the physical topology so that neighbors share fast links.
- Reduced precision gradients in BF16 or FP16 halve the bytes sent per step.
- Multiple rings or channels can run in parallel to saturate several network interfaces.
Limitations and common pitfalls
Ring all-reduce is synchronous and fragile: one slow or failed GPU stalls every other participant, which is why training fault tolerance and elastic training mechanisms matter at scale. The algorithm also assumes homogeneous bandwidth, so a single congested or degraded link determines throughput for the entire job.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Low bus bandwidth | Ring crosses slow PCIe or network links | Use topology-aware or hierarchical rings |
| Poor scaling past hundreds of GPUs | Latency term grows with N | Switch to tree or hierarchical algorithms |
| Periodic training stalls | Straggler GPU or flaky link | Monitor per-rank timing and replace hardware |
| Communication not overlapped | Buckets too large or launched late | Tune bucket size and gradient hooks |
A frequent misconception is that ring all-reduce is always the best choice. For small messages, such as scalar metrics or tiny layers, its many sequential steps make logarithmic algorithms considerably faster, and well-configured communication libraries switch automatically.
The simple explanation
Picture a group of friends sitting in a circle. Each one has a page of numbers, and they all need the total of every page. Nobody sends everything to one person. Instead, each friend passes a small part to the neighbor, who adds their own numbers and passes it on.
After a few rounds, every friend holds the full total. No one carries a heavy load, and everyone works at the same time. Computers training large AI models use this trick so that many graphics chips can share their results quickly.
How it is used in practice
An engineering group trains a speech recognition model of roughly 1.3 billion parameters on sixteen GPUs split across two machines. Inside a machine, the GPUs talk over NVLink; between machines, traffic travels over a 200 Gb/s InfiniBand link. Because gradients are kept in BF16, every optimizer step has to sum about 2.6 GB of gradient data.
The communication library forms a hierarchical ring: each machine first combines its eight local copies over NVLink, and only a short ring between the two machines uses InfiniBand. Gradients travel in 25 MB buckets, and each bucket enters the ring while earlier layers are still being differentiated. Profiling shows that communication is almost completely hidden behind computation, and step time on sixteen GPUs is close to half the step time on eight, giving the team near-linear scaling.