Skip to content
DAH

Tensor, data and pipeline parallelism with compute-communication overlap

How large models are split across GPUs (tensor, pipeline, data/ZeRO, sequence and context parallelism) and how fused kernels hide communication behind matrix multiplication.

On this page14 sections
Why other work relies on it

Training and serving frontier-scale models requires splitting them over many GPUs; the fraction of time lost to exposed communication determines cost, and kernels that fuse communication into GEMMs are the current frontier.

How giant models are split across many GPUs, and how to make them calculate while they talk.

  1. 1Model too big for one GPU
  2. 2Split data, layers or sequences
  3. 3GPUs exchange results constantly
  4. 4Fuse compute and sends into one kernel
  5. 5Idle waiting time shrinks

What it is for. The largest neural networks do not fit in the memory of one GPU (an H100 has 80 GB), and training them on one GPU would take far too long. So they are split across many GPUs, which must exchange data as they work. Every millisecond a GPU spends waiting for data is wasted.

Ways to split.

  • Data parallelism. Every GPU holds the whole model and processes different examples; gradients are summed with an all-reduce. ZeRO also splits the optimiser's stored state, the gradients and even the weights among GPUs to save memory.
  • Tensor parallelism (Megatron-LM). Each weight matrix is split across GPUs. Splitting WW by columns, W=[W1  W2]W = [W_1 \; W_2], gives XW=[XW1  XW2]XW = [XW_1 \; XW_2], so each GPU computes its own slice. Splitting by rows instead gives partial results XW=X1W1+X2W2XW = X_1W_1 + X_2W_2 that must be added across GPUs, in every layer, before the next layer can start.
  • Pipeline parallelism. Groups of layers are placed on different GPUs like stations on an assembly line, and each batch is cut into micro-batches to keep the stations busy.
  • Sequence and context parallelism split long inputs; Ring Attention passes blocks of keys and values around a ring of GPUs.
  • Expert parallelism puts the experts of a mixture-of-experts model on different GPUs, using all-to-all exchanges.

Real systems combine several: tensor parallelism inside one machine over fast NVLink, data or pipeline parallelism across machines.

Exposed communication. If the next step needs data from a communication taking TcommT_{comm} and nothing else runs meanwhile, the time is Tcomp+TcommT_{comp} + T_{comm}. If the communication runs while useful work continues, the ideal is T=max⁡(Tcomp, Tcomm).T = \max(T_{comp},\, T_{comm}). Example: 10 ms of computing and 4 ms of communication take 14 ms back to back but 10 ms when overlapped, a 29% saving. Standard tricks: start summing the gradients that are already finished while later ones are still being computed, and put communication on a separate stream (an independent queue of GPU work).

Fusion. In tensor parallelism the sum needs the output of the matrix multiply, so separate streams cannot hide it. FLUX (a 2024 preprint) breaks both the multiply and the communication into small tiles inside one kernel and sends each output tile as soon as it is ready; its authors state that up to 96% of the communication can be hidden and report speedups over Megatron-LM. Triton-distributed (a 2025 preprint) adds communication operations to the Triton compiler so such kernels can be written in Python. Analogy: a kitchen that sends each plate out the moment it is ready instead of waiting until the whole table's order is cooked. It breaks when plates are tiny and the waiter's trip time (latency) dominates.

Limits. Fused kernels tie their tuning to one interconnect and are hard to debug (hangs, race conditions). The order of additions can change results in the last bits, which affects the reproducibility of training runs.

Go deeper

The full technical text.

Ways to split a model

  • Data parallelism replicates the model and splits the batch; gradients are all-reduced. ZeRO (Rajbhandari et al., 2019) shards optimiser state, gradients and then parameters over data-parallel ranks, replacing all-reduce by reduce-scatter and all-gather and cutting memory.
  • Tensor parallelism (Megatron-LM, Shoeybi et al., 2019) splits each weight matrix across GPUs; a transformer layer needs all-reduces in the forward and backward pass, on the critical path.
  • Pipeline parallelism assigns layers to stages and passes activations between them, with micro-batching to fill the pipeline.
  • Sequence and context parallelism shard the sequence; Ring Attention (Liu et al., 2023) circulates K/V blocks around a ring so each GPU attends to the whole sequence without holding it.
  • Expert parallelism places mixture-of-experts experts on different GPUs, using all-to-all.

Real systems combine several, placing tensor parallelism inside a node (fast NVLink) and data or pipeline parallelism across nodes (slower network).

The overlap problem

A collective that must finish before the next operation starts is exposed communication. With a roofline view: if the time to move the data is comparable to the time to compute on it, exposing it can cost tens of percent of end-to-end time. Standard remedies: bucket gradients and launch their all-reduce while backward continues; run communication on a separate stream; pipeline so that stage-to-stage transfers overlap computation.

Fusing communication into kernels

For tensor parallelism the dependent GEMM and collective cannot be separated by streams alone, because the collective needs the GEMM's output. Approaches such as FLUX (preprint, 2024) over-decompose both operations into finer tiles and fuse them into one kernel so data is sent as soon as each output tile is ready; the authors state that up to 96% of communication can be hidden by a fused kernel and report speedups over Megatron-LM in training. Triton-distributed (preprint, 2025) extends the Triton compiler with OpenSHMEM-style primitives so such overlapping kernels can be written in Python.

Costs and risks

Fusion couples kernel tuning to the interconnect, tile scheduling to message sizes, and failure modes (hangs, races) to custom synchronisation. Collective results can also depend on reduction order, which affects reproducibility of training runs.

Words on this page (12)
Words on this page
parallelism
Splitting a job so many processors work on it at the same time.
all-reduce
Every GPU contributes a list of numbers; all of them end up with the sum.
collective operation
A step in which every GPU in a group sends or receives data together, such as summing a number across all of them.
NVLink
A very fast cable-like link between GPUs in the same server.
GEMM
General matrix multiply: multiplying two grids of numbers. Most of the work in AI models is made of these.
mixture of experts
A model made of many specialist sub-networks, where each input is sent to only a few.
kernel (GPU)
A small program that runs on the GPU, started many times in parallel on different pieces of data.
transformer
The neural-network design behind modern chatbots.
data parallelism
Running the same model on several processors, each on different data, then combining their results.
pipeline
Splitting work into stages handled by different units, so that several items are in progress at once, like an assembly line.
race condition
A bug where the result depends on which of two simultaneous operations happens to finish first.
latency
The delay between sending something and the first part of it arriving.
New to this? Read first (3)
New to this? Read first

Understanding map

map of the whole wiki →

What to read before Tensor, data and pipeline parallelism with compute-communication overlap (left), and what builds on it: entries that depend on it and its open problems (right). Every box links to its page.

  1. Start with
  2. Step 2
  3. Step 3
  4. Step 4
  5. Then

Open problems & questions

Progress timeline

  1. Jun 1, 2024
    FLUX fused overlap kernels

    Fine-grained fusion of GEMM and communication, up to 96% of communication hideable per the authors (arXiv preprint, June 2024).

    source
  2. Sep 1, 2019
    Megatron-LM tensor parallelism

    Intra-layer model parallelism for transformers (arXiv, September 2019).

    source