Why processors need to talk #

A model can be distributed across accelerators in several ways. With data parallelism, devices work on different training examples and then combine information about parameter updates. With tensor parallelism, multiple devices share the work of an operation and exchange partial results. With pipeline parallelism, different groups of devices process different stages of the model and pass intermediate values onward. A large training run can combine all three.

These arrangements create different traffic patterns. Some repeatedly exchange small messages, some move large arrays and some require many devices to coordinate before the next step can begin. A faster individual processor may finish its part sooner and then wait longer for its neighbors, reducing the value of further arithmetic improvements.

Section sources [1]

Bandwidth, latency and topology #

Bandwidth measures how many bytes a connection can carry in a given time. Latency includes the delay before a message reaches its destination. In an idealized example, sending 100 megabytes over a link sustaining 50 gigabytes per second takes about two milliseconds for the payload, before counting startup time or contention. Dividing a small message into many separate exchanges can make startup time important even when total traffic is modest.

Topology describes which devices are directly connected and the paths that messages take through them. Several transfers sharing the same link can compete for capacity. The effective performance of an entire communication pattern therefore depends on more than the bandwidth printed next to one port.

Section sources [1] [2]

Two system designs #

The Megatron-LM researchers examined how to combine tensor, pipeline and data parallelism across GPU clusters. Their work describes the trade between memory use, cross-node communication and idle time in a pipeline. Google’s TPU v4 system used optical circuit switches to reconfigure parts of the interconnect topology. Its designers described how the arrangement supported different allocations and network shapes in a machine with thousands of chips. Both papers measure concrete hardware and workloads, which delimit the conditions under which their results transfer.

Section sources [1] [2]

Reading a scaling result #

A useful report gives training throughput and total device count together. Doubling the devices and obtaining 1.5 times the throughput is a real speedup, while throughput per device has fallen to three quarters of its previous value. Communication, synchronization and a shortage of parallel work are possible explanations. Measurements across model size, batch size and network arrangement help distinguish them. A future-compute estimate should specify whether it counts installed chips, total device-hours or a measured rate of completed training work.

Section sources [1] [2]

Following a gradient through a collective #

Suppose two training workers produce the two-component gradients (2, 6) and (4, 0). A sum reduction gives (6, 6). An all-reduce leaves that result on both workers, which can divide by two if the intended operation is an equal average. A reduce-scatter could instead leave the first summed component on one worker and the second on the other. An all-gather then gives both workers the complete vector. NVIDIA documents this pair of operations as equivalent in result to all-reduce.

The intermediate layout matters. If the next calculation needs only the local slice, gathering an entire copy immediately would spend bandwidth and memory without helping that step. If every device needs the full vector, the exchange must occur somewhere. Drawing the ownership of one small array before and after each operation is a practical way to check a proposed speedup. It can reveal a communication cost that an estimate has moved to the next layer.

Section sources [1] [3]

Sources

  1. Deepak Narayanan and colleagues · Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM (2021) arxiv.org
  2. Norman Jouppi and colleagues · TPU v4: An Optically Reconfigurable Supercomputer for Machine Learning (2023) arxiv.org
  3. NVIDIA · Collective Operations in the NCCL Documentation docs.nvidia.com