liveBook · Manning

Allreduce

As explained in Distributed Machine Learning Patterns

An allreduce is a collective communication operation that aggregates values across participating processes and distributes the aggregate to every process.

Allreduce is a collective communication operation that combines values from every process with a chosen reduce function, then distributes the aggregate back to every process. In distributed model training, workers use it to aggregate gradients so every local model receives the same update. section 3.3.2

Figure 3.20 An example of an allreduce operation that reduces the results on each process in the group and then sends the result to every process in the group
03-20

The operation first reduces values held across the process group, then makes the resulting value available to every worker. section 3.3.2

A synchronous training round follows this flow:

  • Each worker consumes a data partition and calculates gradients against its local model copy. section 3.3.2 section 7.3.2
  • Allreduce aggregates gradients across workers and returns the aggregate to each worker. section 3.3.2
  • Every worker updates its parameters from the same aggregate, preserving identical model copies before the next round. section 3.3.2

This worker-only pattern can replace parameter servers for models that are not too large, removing worker-to-parameter-server communication and server-to-worker ratio tuning. It remains network-bound: basic allreduce requires each worker to communicate with peers, and a large worker count can slow training. Ring-allreduce reduces peer connections to two per worker and is bandwidth-optimal when aggregated gradients are sufficiently large. section 3.3.3

Recovering from a stalled round

Allreduce is synchronous: a slow network communication can prevent the whole process group from completing. Abandon the affected workers and current operation, reconstruct a group from the remaining workers, and resume allreduce because those workers retain the same model copy. The same approach handles preempted workers. section 3.4.2

In a multi-model training architecture, each training step uses allreduce over the underlying network to communicate gradients among workers. After training, a separate process can select a top model for serving. section 7.3.2

How Distributed Machine Learning Patterns covers it

How deep it goes
Explains reduce-and-broadcast composition, training rounds, scaling trade-offs, ring-allreduce, and recovery from stalled communication.
Examples
Uses gradient aggregation across worker-held model copies and a network slowdown that stalls a three-worker allreduce.
What it assumes
Builds from reduce and broadcast operations while framing their use through worker gradients and local model copies.
What you can do after
Evaluate/understand when allreduce can replace parameter servers and how to resume after slow or preempted workers.
How it connects
Connects collective communication with reduce, broadcast, parameter servers, ring-allreduce, synchronous training, and worker process groups.

Also explained in

Compare how 4 books explain allreduce →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Distributed Machine Learning Patterns. The section links point to the parts of the book it draws on.