When One GPU Isn't Enough
Learn the ways a model is spread across several GPUs, and what each one buys you.
Sooner or later one GPU isn’t enough, for one of three reasons. The model doesn’t fit: a 70B model in 16-bit needs 140 GB, and an H100 holds 80. It isn’t fast enough: even when it fits, one GPU’s memory bandwidth caps how quickly tokens appear. Or there are simply too many users.
The last case is the easiest: run more copies of the model (“replicas”) and let a load balancer share the traffic between them. The first two need the model itself split up, and there are two main ways to cut it.
Tensor parallelism cuts every layer lengthwise. Each GPU holds a slice of every weight matrix and computes its share of every layer, so all of them work on every token at once. Each GPU reads only its slice from memory, so a single user’s tokens arrive faster. The cost is chatter: after every layer, the GPUs must swap partial results before carrying on, so they need extremely fast links between them.
Pipeline parallelism cuts the stack of layers into blocks: GPU 1 runs layers 1–20, GPU 2 runs 21–40, and so on, passing each token along like an assembly line. Much less chatter, but one user’s token still visits every stage in turn, so it isn’t faster for that user. It pays off when many requests keep every stage busy at once.
That fast link matters a lot. Inside one server, usually eight GPUs, NVIDIA’s NVLink connects them at hundreds of gigabytes per second, ideal for tensor parallelism. Between servers, links are much slower. So a common recipe is tensor parallelism inside a server, pipeline parallelism across servers, and replicas on top for traffic. Mixture-of-experts models add a fourth option, expert parallelism: different GPUs hold different experts, and tokens travel to wherever their chosen experts live.
Key takeaways
- Use several GPUs when the model doesn’t fit, isn’t fast enough, or has too many users.
- Replicas (whole copies) handle more users; splitting the model handles size and speed.
- Tensor parallelism splits every layer: faster per user, but needs very fast links.
- Pipeline parallelism splits the layer stack: little chatter, better for throughput than for one user’s speed.
Check your understanding
Go deeper (more technical)
Tensor parallelism in transformers was popularised by NVIDIA’s Megatron-LM (2019): attention heads and the feed-forward matrices are split so that each layer needs just two all-reduce exchanges. NVLink in an 8×H100 server gives each GPU about 900 GB/s of total bandwidth; links between servers (InfiniBand) are typically a few hundred Gb/s per GPU.
Llama 3 405B in BF16 (about 810 GB) doesn’t fit in one 8×80 GB server, so it is commonly served in FP8 (about 405 GB) on a single 8-GPU node, or split across two nodes with pipeline parallelism.
The simulation’s speed estimates are illustrative.