Home / Learn / AI Networking / Collective Communication (All-Reduce) Explained
On this page
Collective communicationThe common operationsHow all-reduce is used in trainingAlgorithmsWhy it stresses the networkWhat the network needs to provideMatching the algorithm to the hardwareReducing the costCollectives beyond trainingScale-up fabrics and collectivesMeasuring performanceFor chip and network designersCommon questionsRelated guidesCollective Communication (All-Reduce) Explained
All-reduce combines values from every node in a cluster and returns the result to all of them. It is the most important of the collective communication operations, in which a whole group of processes exchanges data together instead of two at a time. In distributed AI training, all-reduce is how accelerators combine the gradients each has computed. It happens at every training step and involves every participant, which is why it places such heavy and distinctive demands on the network.
Collective communication
Parallel programs communicate in two broad ways.
- Point-to-point. One process sends to another.
- Collective. A group of processes takes part in one coordinated operation.
Collective operations come from high-performance computing, where they are defined in the standard message passing interface. AI training frameworks use the same ideas through their own communication libraries.
The common operations
| Operation | What it does |
|---|---|
| Broadcast | One node sends the same data to all |
| Reduce | Values from all nodes are combined, for example summed, and the result goes to one node |
| All-reduce | Values from all nodes are combined, and every node gets the result |
| Gather | One node collects a piece of data from each |
| All-gather | Every node ends up with the pieces from all nodes |
| Scatter | One node distributes different pieces to each |
| Reduce-scatter | Values are combined, and each node receives a different part of the result |
| All-to-all | Every node sends different data to every other |
All-reduce can be built from a reduce-scatter followed by an all-gather, and libraries often implement it that way.
How all-reduce is used in training
In the standard data-parallel approach:
- Each accelerator holds a copy of the model.
- Each processes a different batch of data and computes gradients, which indicate how the model’s parameters should change.
- The gradients from all accelerators are summed or averaged.
- Every accelerator applies the same combined gradient, keeping the copies identical.
The third step is an all-reduce. For a large model, the gradients run to many gigabytes, and the operation is repeated for every training step.
Other forms of parallel training, in which the model itself is divided among accelerators, use collective operations as well, often at even finer granularity.
Algorithms
The same result can be reached by different patterns of communication.
Ring. Nodes are arranged in a logical circle. Data is divided into chunks, and each node passes chunks to its neighbor, combining as they go, over a series of rounds. Every node sends and receives at a steady rate, making full use of its link. The number of rounds grows with the number of nodes, so latency increases in very large rings.
Tree. Nodes are arranged in a tree. Values are combined going up to the root and distributed going back down. The number of steps grows only with the logarithm of the node count. Links near the root can become bottlenecks.
Recursive halving and doubling. Nodes exchange in pairs at increasing distances over a logarithmic number of rounds.
Hierarchical. Accelerators within a server combine first, using fast local links. One representative per server then takes part in a wider operation, and the result is shared back locally.
| Algorithm | Rounds | Bandwidth use | Suits |
|---|---|---|---|
| Ring | Proportional to node count | Very efficient | Moderate numbers of nodes, large data |
| Tree | Logarithmic | Uneven | Many nodes, smaller data |
| Halving and doubling | Logarithmic | Efficient | Powers of two |
| Hierarchical | Depends | Matches the physical layout | Clusters with fast local links |
Libraries choose among these according to data size, node count and the cluster’s structure.
Why it stresses the network
Volume. Every accelerator sends and receives a large amount of data in each operation.
Synchronization. All accelerators finish computing at about the same time and start communicating at once. Traffic comes in simultaneous bursts.
Few, large flows. Each accelerator talks to a small number of partners with very large transfers. Conventional load balancing, which relies on having many varied flows, distributes them poorly.
Completion depends on the slowest. The operation is finished only when every node has its result. One delayed transfer delays everyone.
Regular, repeating patterns. The same communication happens step after step. A poor path assignment hurts every step until it changes.
Frequency. It occurs thousands or millions of times in a training run.
Because of this, the performance of all-reduce is one of the standard ways to judge an AI network.
What the network needs to provide
- High bandwidth between all participants.
- Non-blocking capacity, so that simultaneous transfers do not compete for the same links.
- Even use of paths.
- Low and consistent latency.
- Efficient transfer directly between accelerator memory, through RDMA.
- Good congestion behavior under synchronized bursts.
Matching the algorithm to the hardware
A cluster is not uniform. Accelerators in the same server or rack are joined by faster links than those in different racks.
A well-chosen algorithm keeps as much communication as possible on the fastest links and minimizes what crosses the slower, wider network. Communication libraries are told about the physical layout, or discover it, and plan accordingly.
Scheduling matters too. Placing a job’s accelerators close together in the network reduces the distance and the number of shared links its collectives must cross.
Reducing the cost
- Overlap with computation. Start communicating some gradients while others are still being computed.
- Gradient compression. Send fewer bits by reducing precision or sending only the largest changes.
- Less frequent synchronization. Do several local steps between exchanges.
- Larger batches. Fewer steps overall, at some cost in training behavior.
- In-network aggregation. A research direction in which switches or network devices perform the combining as data passes through.
- Offloading collectives to network hardware, so that the network interface or DPU carries out parts of the operation without involving the host processor.
Collectives beyond training
- Inference on split models. Accelerators sharing one model exchange intermediate values at every layer.
- Scientific computing. Collectives have been central to simulation codes for decades.
- Data analytics. Aggregations across many machines.
Scale-up fabrics and collectives
Inside a pod of tightly coupled accelerators, the communication is so frequent that it needs the dedicated scale-up interconnect. With memory-style access and sub-microsecond latency, an all-reduce among accelerators in the pod is far faster than one over the cluster network. Larger pods mean more of the work can be done at that speed.
Measuring performance
- Time to complete an all-reduce for a given data size and number of participants.
- Effective bandwidth achieved, compared with the links’ capacity.
- Scaling. How the time changes as nodes are added.
- Variation from one operation to the next.
- Training throughput on real models.
A network that achieves a high fraction of its theoretical capacity on all-reduce, with little variation, is well suited to training.
For chip and network designers
Collective communication determines what an AI network interface must do well.
- Sustained high-throughput transfers to and from accelerator memory, with no intermediate copies.
- Many simultaneous peers with low per-peer overhead.
- Burst handling without loss or long queues.
- Per-packet load balancing to spread a few large flows.
- Low, predictable latency.
- Possible acceleration of collective primitives in the device.
Common questions
What is all-reduce?
An operation in which every node in a group contributes a value, the values are combined, typically summed, and every node receives the combined result.
Why is all-reduce important for AI training?
It is how accelerators training the same model combine their gradients at each step so that all copies of the model stay in agreement.
Why is all-reduce hard on a network?
It involves every participant sending large amounts of data at the same moment, in a small number of very large flows, and it is only complete when the slowest transfer finishes.