- Explain pipeline, tensor, and data parallelism and what each divides across devices
- Calculate the per-token communication of Megatron-style tensor parallelism from layer count and hidden size
- Apply the alpha–beta model to estimate ring all-reduce time and decode speed under tensor and pipeline parallelism
- Determine the break-even link latency above which tensor parallelism stops helping
- Evaluate when clustering is worth it for fitting models, serving users, or training
Before this: Choosing a Machine for Local AI, Tokens per Second: Estimating Local AI Speed, Transformers: A Deep Dive
When a model is too big for one device, the natural idea is to combine several. That works for fitting the model, but it often surprises people on speed. This lesson explains why, so you can tell when a second GPU or a second machine is worth it.
Two ways to split a model
A language model is a stack of layers, each of which transforms the text representation and passes it to the next. There are two main ways to divide that stack.
Pipeline parallelism splits the model by depth. Device 1 holds layers 1–40, device 2 holds layers 41–80. For each token, device 1 does its part, sends a small result to device 2, and waits. Only one device works at a time for a single conversation.
Tensor parallelism splits each layer by width. Every device holds a slice of every layer, and all devices work on the same token at once, then combine their partial results. This happens at every layer, for every token.
An analogy: pipeline parallelism is an assembly line where each station finishes its step before the next starts. Tensor parallelism is several cooks preparing the same dish at once, each chopping part of the ingredients, constantly passing bowls back and forth. The cooks finish faster only if passing bowls is quick.
Why the link matters
Devices exchange data over an interconnect. Compare these with the memory bandwidth figures from earlier lessons (hundreds to thousands of GB/s):
| Link (as of November 2026) | Rough bandwidth |
|---|---|
| PCIe 5.0 x16 (GPU slot in a PC) | about 64 GB/s each direction |
| Thunderbolt 5 | 80 Gb/s (about 10 GB/s), up to 120 Gb/s in one direction with Bandwidth Boost |
| 200 Gb Ethernet via ConnectX-7 (as on DGX Spark) | about 25 GB/s |
| NVLink | much higher; today found mainly on data-center GPUs |
Two properties matter:
- Bandwidth, how much data per second the link carries.
- Latency, the delay before any data arrives, often measured in microseconds.
Pipeline parallelism sends little data per token (the activations at one boundary, often tens of kilobytes), so it works over slower links. Tensor parallelism communicates at every layer, so latency adds up quickly: a model with 80 layers may need well over a hundred small exchanges per token. That is why tensor parallelism has traditionally needed very fast, low-latency links such as NVLink.
RDMA (remote direct memory access) reduces latency by letting one machine write directly into another's memory without involving the operating system on each transfer. It is central to recent desktop clustering.
What clustering helps with
- Fitting bigger models. Two machines with 128 GB each can hold a model that neither can hold alone. For example, NVIDIA's DGX Spark materials say two Sparks connected through their ConnectX-7 ports can work with models up to about 405 billion parameters, versus about 200 billion for one.
- Serving more users. With batching, a cluster processes more conversations at once, raising total throughput.
- Training and fine-tuning. With data parallelism, each machine holds a full copy of the model and trains on different data; Apple's WWDC26 session showed fine-tuning a 9B model at about 600 tokens per second on four M3 Ultra Macs versus about 180 on one.
What it often does not help with
For a single user, pipeline parallelism usually gives no speedup in generation. Each token still passes through every layer in sequence, just on different devices, plus added link latency. If both devices have the same bandwidth, single-user decode is roughly as fast as one device would be if it had enough memory, or slightly slower. Apple's session states this directly: pipeline splitting does not speed up per-token inference.
Tensor parallelism can speed up single-user generation, because each device reads only its slice of the weights per token, but only when the link is fast enough that communication does not eat the gains. Apple reported that in one live demo, four M3 Ultra Macs connected in a full mesh over Thunderbolt 5 with RDMA generated tokens from a 27B model at nearly three times the single-machine rate, and noted the speedup depends on model size and architecture. Results over ordinary Ethernet or without RDMA are usually much weaker.
Current desktop options
As of November 2026:
- Multiple GPUs in one PC. In the RTX 30 series NVIDIA kept NVLink only on the top-end RTX 3090, and it removed the connector entirely from the RTX 40 series. Current consumer multi-GPU setups therefore communicate over PCIe. Pipeline-style splitting works well for fitting models; tensor parallelism works but is limited by PCIe.
- Apple Mac clusters. macOS Tahoe 26.2, released in December 2025, added RDMA over Thunderbolt 5. MLX uses it through Apple's JACCL communication library, and you enable it in system settings. MLX's language-model tools use tensor parallelism by default, with a pipeline option.
- NVIDIA DGX Spark pairing. Each Spark has a ConnectX-7 adapter with QSFP ports supporting 200 Gb Ethernet and RDMA. Two can be cabled directly, or more through a switch, and NVIDIA publishes guides for running vLLM across them.
- Software-only clustering. Tools like llama.cpp's RPC backend can split a model across ordinary networked computers, which helps fit models but is slow over typical home networks.
A worked example
Say you want a model that needs about 200 GB, and you have two machines with 128 GB of usable memory and 273 GB/s each (about 150 GB/s effective, using the 0.55 factor). Neither fits it alone; together they do, since 200 GB is under 85% of 256 GB (about 218 GB). With a pipeline split, single-user decode speed is about what one 273 GB/s machine would give if it had 256 GB, minus link overhead. If the model is dense, a 200 GB need at around 4.8 bits means roughly 300B parameters, or about 180 GB read per token: roughly 1 ÷ (180 ÷ 150 + 0.0015) ≈ 0.8 tok/s. If it is an MoE model with about 10B active parameters (about 6 GB per token), the same estimate gives about 24 tok/s. Clustering made the model possible; the model's design decided whether it was pleasant to use.
Going deeper
What tensor parallelism communicates
In the Megatron-LM scheme (Shoeybi et al., 2019), each transformer layer is split so that devices need to combine results only twice per layer in the forward pass: once after the attention block and once after the feed-forward block. Each combination is an all-reduce: every device contributes a partial result vector, and every device ends up with the sum. For one decoding token the vector is the hidden state, values at bytes each, so the message size is
For a 70B-class model with and 16-bit activations, bytes, only 16 KB. With layers there are all-reduces per token: 160 for an 80-layer model.
The alpha–beta cost model
A standard way to price communication is the alpha–beta model: sending a message of bytes costs , where is per-message latency and is link bandwidth. A ring all-reduce over devices takes steps, each moving bytes:
Per decoded token, tensor parallelism then costs roughly
where is each device reading its share of the weights in parallel. Pipeline parallelism over stages instead costs
because stages run one after another for a single user: memory time is not divided, but there are only hops.
Worked example
Two GPUs, each 1,792 GB/s, a 70B-class dense model at 4.8 bits ( GB, , ). The latency values below are illustrative assumptions; measure your own link.
- Memory time, TP: ms.
- PCIe 5.0 x16 ( GB/s), assume s. One all-reduce: s. Times 160: about 3.2 ms.
- ms, about 38 tok/s.
- A single device of the same bandwidth holding the whole model: ms, about 22.7 tok/s. TP gives about 1.7 times the speed.
- Over a 25 GB/s network link with s: each all-reduce ≈ 100.7 µs, times 160 ≈ 16.1 ms, so ms, about 25.7 tok/s. Most of the gain is gone.
- Pipeline over that same network link: s ≈ 44.2 ms, about 22.6 tok/s, essentially single-device speed, as the earlier section said.
Notice that in every case the bandwidth term is under 1 µs per all-reduce; latency dominates decode communication. Solving (all in ms) gives a break-even latency of about 66 µs: above that, two-way TP over this link is slower than one big device. Prefill is different: messages scale with prompt length (), so a 1,000-token prompt sends about 16 MB per all-reduce, and bandwidth matters again.
ETA, T0 = 0.55, 0.0015
def allreduce_s(msg_bytes, p, alpha_s, link_bytes_s):
"""Ring all-reduce, alpha-beta model: 2(p-1) steps, each moving msg/p bytes."""
return 2 * (p - 1) * alpha_s + 2 * (p - 1) / p * msg_bytes / link_bytes_s
def tp_decode_tps(gb_per_token, bw_gbs, p, layers, hidden, alpha_us, link_gbs, act_bytes=2):
mem = gb_per_token / p / (ETA * bw_gbs) # each device reads 1/p of weights
comm = 2 * layers * allreduce_s(hidden * act_bytes, p, alpha_us * 1e-6, link_gbs * 1e9)
return 1 / (mem + comm + T0)
def pp_decode_tps(gb_per_token, bw_gbs, p, hidden, alpha_us, link_gbs, act_bytes=2):
mem = gb_per_token / (ETA * bw_gbs) # stages run one after another
hops = (p - 1) * (alpha_us * 1e-6 + hidden * act_bytes / (link_gbs * 1e9))
return 1 / (mem + hops + T0)
# 70B-class dense model, 4.8 bits (42 GB read per token), 80 layers, hidden 8192
print(round(tp_decode_tps(42, 1792, 2, 80, 8192, alpha_us=10, link_gbs=64), 1)) # ~38.4
print(round(tp_decode_tps(42, 1792, 2, 80, 8192, alpha_us=50, link_gbs=25), 1)) # ~25.7
print(round(pp_decode_tps(42, 1792, 2, 8192, alpha_us=50, link_gbs=25), 1)) # ~22.6
This model omits real effects (overlapping communication with compute, kernel launch costs that also grow with , uneven splits, and the fact that real libraries switch algorithms for small messages), so use it to reason about direction and order of magnitude, then measure.
Practical constraints on the split
- Tensor-parallel degree normally has to divide the number of attention heads evenly (KV heads are usually split too, or replicated when there are fewer KV heads than devices), so 2, 4, or 8 devices are common and 3 often is not.
- In a pipeline, the slowest stage sets the pace; mixing a fast and a slow device wastes the fast one unless layers are assigned in proportion to speed.
- Mixture-of-experts models add expert parallelism, where different devices hold different experts and tokens are routed between them with all-to-all exchanges; that traffic grows with batch size.
Common pitfalls
- Expecting pipeline splits to speed up one user. They add capacity, not single-stream speed.
- Reading link speeds in the wrong unit. 80 Gb/s is 10 GB/s; 200 Gb Ethernet is 25 GB/s.
- Looking only at link bandwidth. For decode, per-message latency multiplied by all-reduces per token usually dominates.
- Mixing unequal devices. The slowest device or stage sets the pace for everyone.
- Quoting aggregate cluster throughput as user speed. Batched totals across users are not what one person experiences.
- Ignoring divisibility. A tensor-parallel degree that does not divide the head count may not be supported by the runtime.
In practice
- Cluster to fit models you cannot otherwise run, or to serve more users, not to make a model that already fits much faster.
- If you want single-user speedups, you need tensor parallelism and a fast, low-latency link with RDMA; check measured results for your exact setup.
- Prefer one machine with enough memory over two when possible: fewer parts, less latency, less setup.
- Pair clusters with MoE models, which read far less data per token.
- Use the AI Hardware & Model Index to check whether one machine already fits your target before planning a cluster.
Key takeaways
- Pipeline parallelism splits a model by layers and needs little bandwidth, but usually does not speed up single-user generation.
- Tensor parallelism splits every layer across devices and can speed up generation, but only with fast, low-latency links such as NVLink or RDMA.
- Interconnects like PCIe, Thunderbolt 5, and 200 Gb Ethernet are far slower than memory bandwidth, so communication often limits clusters.
- Clustering mainly helps fit bigger models, serve more users, and train faster.
- As of November 2026, Macs support RDMA over Thunderbolt 5 for MLX clusters, and DGX Sparks can be paired over ConnectX-7.
Terms in this lesson
- Pipeline parallelism
- Splitting a model by layers so each device runs a consecutive group of layers in turn.
- Tensor parallelism
- Splitting each layer's weights across devices so they all work on the same token simultaneously.
- Data parallelism
- Giving each device a full copy of the model and different data, mainly used for training.
- Interconnect
- The link that carries data between GPUs or machines, such as PCIe, NVLink, Thunderbolt, or Ethernet.
- Latency
- The delay before data starts arriving over a link, separate from how much data it can carry.
- RDMA
- Remote direct memory access, which lets one machine write into another's memory with minimal operating-system overhead.
- All-reduce
- A collective operation in which every device contributes a vector and every device receives the elementwise sum.
- Alpha–beta model
- A communication cost model in which sending m bytes takes a fixed latency alpha plus m divided by bandwidth beta.
- Expert parallelism
- Placing different mixture-of-experts experts on different devices and routing tokens between them.
Check your understanding
- 1.
You split a model across two identical machines using pipeline parallelism. What usually happens to single-user generation speed?
- 2.
Why does tensor parallelism need a low-latency link?
- 3.
Which is the strongest reason to build a two-machine cluster?
- 4.
A 64-layer model runs with Megatron-style tensor parallelism. If each all-reduce takes 25 µs, how much communication time is added per decoded token?
- 5.
During single-user decode, a 16 KB all-reduce runs over a 25 GB/s link with 10 µs latency. Which term of its cost dominates?
Exercises
Work each problem before opening the solution.
- Exercise 1Core
Convert Thunderbolt 5's 80 Gb/s and a 200 Gb Ethernet link to GB/s. Then compute the pure transfer time of a 16 KB (16,384-byte) message over the Thunderbolt link and compare it with an assumed 10 µs latency.
Show solution
80 Gb/s ÷ 8 = 10 GB/s; 200 Gb/s ÷ 8 = 25 GB/s. Transfer time = 16,384 ÷ 10×10^9 ≈ 1.6 µs, about one sixth of the 10 µs latency. For decode-sized messages, latency is the bigger cost.
- Exercise 2Core
Using the alpha–beta ring all-reduce formula, compute the time for devices, bytes, s, GB/s. How much communication per token does a 64-layer model incur?
Show solution
Latency: s. Bandwidth: s. Total ≈ 32.5 µs. Per token: 2 × 64 = 128 all-reduces × 32.5 µs ≈ 4.2 ms.
- Exercise 3Core
Two machines, each with 128 GB at 273 GB/s, run a 200 GB-need MoE model (10B active, 4.8 bits) as a two-stage pipeline over a link with 50 µs latency. Estimate single-user decode speed. Does the link matter?
Show solution
Bytes per token: 10 × 0.6 = 6 GB. Memory time: 6 ÷ (0.55 × 273) = 6 ÷ 150.15 ≈ 40.0 ms. One hop: about 50 µs plus under 1 µs of transfer, so 0.05 ms. Total ≈ 40.0 + 0.05 + 1.5 = 41.5 ms, about 24 tok/s. The link adds about 0.1% to the time; for pipelines with few stages, latency hardly matters.
- Exercise 4Challenge
Using the lesson's
tp_decode_tps, find the link latency (to 1 µs) at which two-way tensor parallelism over PCIe 5.0 (64 GB/s) stops beating a single 1,792 GB/s device holding the whole 70B-class model (42 GB per token, 80 layers, hidden 8192). Then derive the same answer analytically.Show solution
single = 1 / (42 / (0.55 * 1792) + 0.0015) # about 22.67 tok/s lo, hi = 0.0, 1000.0 for _ in range(60): # bisection on alpha in microseconds mid = (lo + hi) / 2 if tp_decode_tps(42, 1792, 2, 80, 8192, mid, 64) > single: lo = mid else: hi = mid print(round(lo, 1)) # 66.5Analytically, TP wins when (the terms cancel). Here ms, half is 21.31 ms, and the bandwidth term is s ≈ 0.04 ms. So ms, giving s. With RDMA-class latencies of a few microseconds TP helps; with tens of microseconds per message it barely does.
Further reading
- paperShoeybi et al., Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism (2019)
- paperHuang et al., GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism (2019)
- paperPope, Douglas, Chowdhery, Devlin, Bradbury, Levskaya, Heek, Xiao, Agrawal & Dean, Efficiently Scaling Transformer Inference (2022)
- bookAustin et al. (Google DeepMind), How to Scale Your Model: A Systems View of LLMs on TPUs (2025)
Go further
Sources
- Apple WWDC26: Explore distributed inference and training with MLX
- GIGAZINE: macOS Tahoe 26.2 adds the ability to connect multiple Macs to create AI clusters
- NVIDIA DGX Spark User Guide: Hardware Overview
- NVIDIA build playbook: Connect Two Sparks
- Intel Newsroom: Intel Introduces Thunderbolt 5 Connectivity Standard
- TweakTown: NVIDIA kills NVLink support for Ada Lovelace
- AWS: What is vLLM?
- Seeed Studio wiki: Distributed llama.cpp inference with the RPC backend
- Tom's Hardware: Nvidia to support NVLink only for RTX 3090 (2020)
- PNY: NVIDIA DGX Spark (two connected systems, up to 405B parameters)
- Shoeybi et al., Megatron-LM (arXiv 1909.08053)
Fact-checked and last reviewed 2026-11-05