Topic 5 of 6 · 5 min read
Scaling across GPUs and replicas
Goal: Draft a scaling plan that combines parallelism and replicas for a model too large for one GPU.
Split a model across GPUs only as much as it needs to fit, then add copies of that group to serve more users.
Check yourself · 1 of 3
A model fits on 4 GPUs in one node. Traffic doubles. What is the usual next step?
Why it matters
GPUs talk to each other far slower than they read their own memory. Every extra split adds communication. So the cheapest design uses the smallest group that holds the model and a comfortable KV cache, and then scales traffic by running several identical groups.
Two kinds of scaling
Inside one model copy (parallelism).
- Tensor parallelism splits each layer across GPUs. It needs fast links, so keep it inside one machine, ideally with NVLink. It lowers latency and lets a large model fit.
- Pipeline parallelism puts different layers on different GPUs or machines. It needs less bandwidth, so it suits multi-node setups, at the cost of idle gaps between stages.
- Expert parallelism places the experts of a mixture-of-experts model on different GPUs, so each GPU holds only some of them.
Across copies (replicas). Run several identical servers behind a load balancer. Each replica is independent, so replicas add capacity almost linearly and one failure costs only one replica. Replicas also let you roll out updates one at a time.
How to draft a plan
- Compute weights plus KV cache for your context and concurrency (previous topic).
- Find the smallest GPU count that fits, such as 4 GPUs in one node using tensor parallelism of 4.
- Test the throughput of one replica at your latency target.
- Divide expected peak traffic by that number to get the replica count, and add one spare.
- Autoscale on queue depth or waiting requests, not CPU use. A new replica takes minutes to load weights, so scale on a trend and keep a warm minimum.
Before and after
Weak: "The model needs 4 GPUs, we expect more users, so use tensor parallelism of 16 across two machines." The slow link between machines now sits inside every layer, and latency gets worse.
Better: tensor parallelism of 4 inside each node, and four such replicas behind a load balancer.
What goes wrong
- Tensor parallelism across machines over ordinary networking.
- Scaling on GPU utilization. It sits near 100 percent long before users suffer. Queue depth tells you sooner.
- Slow starts. Pulling and loading large weights can take minutes, so a spike arrives before the new replica is ready.
- No spare. With exactly enough replicas, one failure or restart means overload.
Examples
A scaling plan
Goal: serve a 70B model to 200 peak concurrent users, 16k context.
1. One replica = 4 GPUs, tensor parallel 4, one node with fast GPU links.
2. Load test one replica: sustains about 40 users at the latency target.
3. Replicas needed: 200 / 40 = 5, plus 1 spare = 6 replicas (24 GPUs).
4. Load balancer routes by least outstanding requests.
5. Autoscale 4 to 8 replicas when waiting requests stay above 5 for 2 minutes.
6. Roll out new versions one replica at a time.
A mixture-of-experts model
A large mixture-of-experts model holds hundreds of billions of parameters, but each token uses only a few experts. The weights still must be in memory, so they do not fit on one GPU. Expert parallelism spreads the experts across the node's GPUs so each holds a share, while attention layers use tensor or data parallelism. Check your engine's parallelism page for the supported combinations.
Key points
- Use the smallest tensor-parallel group that fits the model and KV cache, and keep it inside one node.
- Pipeline parallelism suits multi-node setups because it needs less bandwidth, but it leaves idle gaps.
- Expert parallelism spreads the experts of a mixture-of-experts model across GPUs.
- Replicas behind a load balancer add capacity and isolate failures; size them from a one-replica load test.
- Autoscale on queue depth or waiting requests, with a warm minimum, because model loading is slow.
Common mistakes
- Using a larger tensor-parallel size than needed, which adds communication and lowers per-GPU efficiency.
- Spreading tensor parallelism across machines connected by ordinary Ethernet.
- Autoscaling on GPU utilization instead of queue depth.
- Running exactly the number of replicas peak traffic needs, with no spare.
Check yourself · 2 of 3
Which metric is the best trigger for adding a replica?
Check yourself · 3 of 3
Why should tensor parallelism usually stay inside one machine?
Practice items, not counted towards your mastery.
Start here
- vLLM documentation (opens in a new tab)DocsFree
The serve command, engine arguments, metrics and parallelism pages for the most widely used open serving engine.
- SGLang documentation (opens in a new tab)DocsFree
Docs for the SGLang server, with prefix caching (RadixAttention) and multi-GPU launch options.
- Efficient Memory Management for LLM Serving with PagedAttention (opens in a new tab)PaperFree
The vLLM paper: why KV cache fragmentation wastes memory and how paging it raises throughput.
More for this topic
- vLLM parallelism and scaling (opens in a new tab)DocsFree
When to use tensor, pipeline, data and expert parallelism, and how to run across several nodes.