What is All-reduce?

Communication that sums values held by all GPUs element by element and gives the result to every GPU, used to average gradients in data-parallel training.

Field: AI Hardware & Software Stack

Japanese name: オールリデュース

What all-reduce does

All-reduce is a collective communication in which identically shaped data held by multiple GPUs or processes is combined element by element (the reduce), and everyone receives the result. Summation is the most common operation, but maximum, minimum and others can be chosen. If four GPUs each hold a gradient vector, for example, after the all-reduce every GPU holds the sum of the four vectors. In data-parallel training this is divided by the number of GPUs to give the average gradient, and all GPUs update their weights with the same values, keeping the model replicas identical.

How ring all-reduce works

One widely used method is ring all-reduce. N devices are connected in a ring, the data is split into N chunks, and chunks are summed as they are passed to the neighbor. In the first N − 1 steps (reduce-scatter) each device completes the sum of one chunk, and in the next N − 1 steps (all-gather) the completed chunks are distributed to everyone. Each device sends 2(N − 1)/N times the data size, never more than twice it however many devices are added. All-reducing a 1 GB gradient across 8 GPUs, for example, means each sends 1.75 GB. In bandwidth terms, efficiency therefore holds up well as devices are added.

What determines communication time

In the ring method the number of steps, 2(N − 1), grows in proportion to the device count, so with small data the latency of each step stands out. Tree-based reductions and methods whose step count grows only with the logarithm of the device count are therefore used depending on data size and scale. Actual communication time is set by the fast links between GPUs within a node and the network bandwidth between nodes, and methods are combined level by level. In training, communication starts with the gradients of layers whose computation has finished and overlaps with backpropagation to hide the waiting time.

Libraries and related collectives

All-reduce has long been used in parallel computing as MPI_Allreduce in the MPI standard. In distributed GPU training, collective communication libraries such as NVIDIA's NCCL choose a method suited to how the GPUs are connected. Related collectives include reduce, which gathers the result on one device only; broadcast, which sends one device's data to everyone; reduce-scatter, in which each device receives only part of the result; and all-gather, which collects everyone's data on every device. Training methods that shard model state (ZeRO and FSDP) combine reduce-scatter and all-gather.

Try it: questions about All-reduce

What does the all-reduce communication used in distributed training do?

  1. AIt erases one GPU's data to free memory
  2. BIt sums the values (such as gradients) held by all GPUs and distributes the total to every GPU
  3. CIt powers off all GPUs at once
Show answer and explanation

Answer: B. It sums the values (such as gradients) held by all GPUs and distributes the total to every GPU

All-reduce sums identically shaped tensors held by each GPU element by element (the reduce) and gives the result to every GPU. With ring all-reduce, which arranges GPUs in a ring and passes chunks of data to neighbors, the communication volume per GPU stays nearly constant as GPUs are added. Data-parallel training uses it to average gradients at every step.

FAQ

What is the difference between all-reduce and reduce?

Reduce is a communication in which only one device receives the combined result of everyone's data. In all-reduce every device receives the combined result. It gives the same result as a reduce followed by a broadcast, but methods such as ring all-reduce perform it more efficiently.

How much data does each device send in ring all-reduce?

With data size S and N devices, each device sends 2(N − 1)/N × S. This never exceeds 2S as N grows, so per-device communication stays nearly constant as devices are added. For N = 8 it is 1.75S.

Why does data-parallel training need all-reduce?

Each GPU computes gradients on different data, so updating weights with them directly would make the model replicas drift apart. Summing and averaging the gradients with an all-reduce at every step lets all GPUs apply the same update, giving nearly the same result as training one device on a large batch.

Questions that mention All-reduce (1)

All-reduce appears in 2 practice questions across 1 topic, including AI Hardware & Software Stack.

  1. Which describes data parallelism in multi-GPU training?

Books on AI Hardware & Software Stack Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary