Collective communication

Also known as: collective operations

On this page 7

Collective communication is a pattern of data exchange in which a group of processes participates together in one coordinated operation, such as summing gradients across every GPU or broadcasting model weights from one device to all others. In AI infrastructure, these collective operations are the communication backbone of distributed training and multi-GPU inference, because every form of parallelism depends on moving tensors between accelerators quickly and in lockstep.

The concept comes from high-performance computing and the Message Passing Interface (MPI) standard, and today it is implemented for accelerators by libraries such as NCCL, RCCL and Gloo. In large training jobs, collectives often consume a significant share of step time, so their efficiency directly limits how well a cluster scales.

How collective communication works

A collective operation is called by every member of a communicator, a defined group of ranks, usually one rank per GPU. Each rank contributes a buffer, the library moves and optionally combines data according to the operation, and each rank receives its result. The call is synchronizing in effect: no rank can finish until the data it needs from others has arrived.

Unlike point-to-point messaging, where a programmer pairs explicit sends and receives, collectives describe the intended outcome and leave the routing to the library. This lets implementations choose topology-aware algorithms that exploit NVLink inside a server and InfiniBand or RoCE Ethernet between servers.

OperationInput per rankResult per rank
BroadcastData on one root rankIdentical copy of the root data
ReduceOne buffer eachCombined result on the root only
All-reduceOne buffer eachCombined result on every rank
All-gatherOne shard eachConcatenation of all shards
Reduce-scatterFull buffer eachOne reduced shard per rank
All-to-allDistinct piece for every peerPieces received from all peers
Core collective operations and their results

The reduction step applies an associative operator, most often a sum, sometimes a maximum or an average. An all-reduce is mathematically equivalent to a reduce-scatter followed by an all-gather, a decomposition that many libraries and sharded training methods use directly.

Frameworks rarely expose these calls to model developers directly. PyTorch, JAX and similar frameworks wrap them in process groups or sharding annotations, while the underlying library handles buffer registration, channel setup and GPU kernel launches. Several communicators can coexist in one job, for example one group for tensor parallelism inside a server and another for data parallelism across servers, and each runs its own collectives independently.

Algorithms and their performance trade-offs

The same collective can be executed by different communication algorithms, and the best choice depends on message size, number of ranks and network topology. Performance is usually modeled with a latency term per step and a bandwidth term per byte sent.

AlgorithmStrengthWeakness
RingNear-optimal bandwidth useLatency grows linearly with ranks
TreeLogarithmic latencyLower bandwidth efficiency on some links
Recursive halving-doublingGood for power-of-two groupsLess suited to irregular topologies
HierarchicalExploits fast links inside a nodeMore complex to tune
In-network reductionSwitches perform the sumRequires specialized switch hardware
Common algorithms for all-reduce

Ring all-reduce sends about 2(N-1)/N times the buffer size per rank, which approaches twice the data volume regardless of cluster size. That makes it bandwidth-optimal for large gradients, while tree variants win for small, latency-bound messages. Libraries such as NCCL select algorithms and protocols automatically, but engineers can override them through environment settings.

Collective operations in parallel training strategies

Each parallelism strategy relies on a characteristic set of collectives. Understanding the mapping helps explain why some strategies stay inside one server while others span the whole cluster.

StrategyMain collectivesTypical scope
Data parallelismAll-reduce of gradientsAcross nodes
FSDP and ZeROAll-gather of weights, reduce-scatter of gradientsAcross nodes
Tensor parallelismAll-reduce or all-gather of activationsInside one node
Expert parallelismAll-to-all token routingWithin or across nodes
Pipeline parallelismMostly point-to-point sendsAcross stages
Which collectives each parallelism strategy uses

Tensor parallelism issues collectives inside every layer, so it is usually confined to the high-bandwidth NVLink domain of a single server or rack-scale system. Data parallelism communicates once per step and tolerates slower inter-node links, especially when gradient communication is overlapped with backward computation.

Practical tuning and common bottlenecks

Most performance problems in collective communication come from network topology, message sizing or synchronization stragglers. The following points summarize what infrastructure teams usually check first.

  • Bucket gradients into larger messages so that per-call latency does not dominate.
  • Overlap communication with computation by launching collectives on separate streams as gradients become ready.
  • Match the job to the topology, keeping latency-sensitive collectives inside the fastest interconnect.
  • Use lower-precision communication, such as BF16 or compressed gradients, when accuracy allows.
  • Monitor stragglers, because one slow GPU or link delays every rank in the communicator.

Benchmark tools such as nccl-tests report bus bandwidth, a normalized figure that makes results comparable across operations and cluster sizes. A large gap between measured bus bandwidth and the link specification usually indicates misconfigured routing, congestion or faulty cables.

Limitations and failure modes

Because collectives are blocking group operations, a single failed or hung rank can stall the entire job, which is why large clusters pair them with watchdog timeouts, distributed checkpointing and elastic training. Mismatched call order across ranks causes deadlocks that are notoriously hard to debug.

Scaling also has limits. As clusters grow to tens of thousands of GPUs, latency terms and network congestion become dominant, and all-to-all traffic from mixture-of-experts models stresses the fabric far more than ring patterns do. These pressures drive investment in AI backend networks, in-network reduction and communication-avoiding training methods.

Understanding it simply

Picture a class of students who each solved part of a large math problem. Before anyone can continue, everyone needs the combined answer. Collective communication is the organized way of sharing and adding up those partial results.

In AI training, the students are GPUs. Each one learns from different data. They must regularly combine what they learned so that all copies of the model stay the same. If this sharing is slow, every GPU waits. That is why fast, well-organized communication matters as much as fast chips.

Applied in practice

An infrastructure team trains a 13-billion-parameter language model on 64 GPUs across 8 servers. Each server links its GPUs through NVLink, and servers connect over 400 Gb/s InfiniBand. With plain data parallelism, profiling shows that the gradient all-reduce takes nearly 40 percent of each training step, leaving expensive accelerators idle.

The team switches to sharded data parallelism, groups gradients into larger buckets and overlaps reduce-scatter with the backward pass. It also enables hierarchical collectives so that reductions happen inside each server before crossing the network. Communication time falls to about 12 percent of the step, throughput rises by roughly a third, and the same training run finishes several days earlier without any change to the model.