SysArt
Book a briefing
SysArt

On-premises AI

Multi-GPU Inference Parallelism: Tensor vs Pipeline Splitting On-Premises

A practical comparison of tensor parallelism and pipeline parallelism for distributing large model inference across multiple GPUs in on-premises deployments.

Last reviewed by SysArt AI Architecture Team6 min readHow we review

In short

Use tensor parallelism inside a server whose GPUs share a fast link such as NVLink, because it splits every layer and communicates in every layer. Use pipeline parallelism across servers, or between GPUs without NVLink, because it splits the model by layers and exchanges less data. If the model fits on one GPU, run replicas instead of splitting it.

Key takeaways

  • If the model and its cache fit on one GPU, vLLM's guidance is to run it there; add replicas for throughput instead of splitting the model.
  • Tensor parallelism splits every layer across GPUs; in the Megatron-LM approach it needs two all-reduce operations per transformer layer in the forward pass, so it needs a fast interconnect.
  • Pipeline parallelism gives each GPU a stage of consecutive layers. It tolerates slower links but does not speed up a single request and needs concurrent requests to keep all stages busy.
  • For several servers, vLLM sets tensor parallelism to the GPUs per node and pipeline parallelism to the number of nodes; for GPUs without NVLink, such as the L40S, it recommends pipeline parallelism.
  • Benchmark candidate configurations with your own model, context lengths and concurrency before you fix them.
Close-up of a computer processor chip

When do you need more than one GPU for inference?

You need several GPUs when the model weights, plus the key-value (KV) cache your traffic needs, do not fit in one GPU’s memory. vLLM’s documentation puts it plainly: if the model fits on a single GPU, distributed inference is probably unnecessary, so run it on that GPU.

The arithmetic for the weights is simple: about 2 bytes per parameter at 16-bit precision, 1 byte at 8-bit and half a byte at 4-bit. A 70-billion-parameter model therefore needs about 140 GB at 16-bit, more than the 80 GB of an H100 SXM or the 94 GB of an H100 NVL, before any cache. At 4-bit the weights need about 35 GB and fit on one GPU, but quantisation has quality trade-offs and the cache still needs room. Our post on GPU memory and the KV cache explains how to size the cache, and the LLM GPU sizing calculator does the arithmetic for your model, context length and users.

If the model fits but one GPU cannot carry the load, the usual answer is more replicas, each serving the whole model, behind a gateway or load balancer. Split a model when it does not fit, or when you have measured that splitting it meets a latency target that a single GPU cannot.

How does tensor parallelism split a model?

Tensor parallelism splits the weight matrices inside every layer across GPUs, so each GPU holds and computes a slice of every layer. In the Megatron-LM approach, the attention and feed-forward blocks of each transformer layer are split so that the GPUs need two all-reduce operations per layer in the forward pass to combine their partial results.

Two properties follow:

  • Memory. Each GPU holds roughly one Nth of the weights. vLLM’s tuning guide notes that this leaves each GPU more memory for the KV cache.
  • Communication. The all-reduces happen in every layer, for every forward pass, so tensor parallelism creates frequent traffic between GPUs and needs a fast, low-latency link. The same guide warns that increasing the tensor-parallel degree may cause excessive synchronisation overhead.

Because each GPU reads only its slice of the weights for every token, tensor parallelism can also shorten per-token latency when the interconnect is fast enough; measure whether it does on your hardware. vLLM describes tensor parallelism as the most common strategy for large-model inference within a single node. When the number of GPUs does not divide the model evenly, it suggests pipeline parallelism, which supports uneven splits.

How does pipeline parallelism split a model?

Pipeline parallelism gives each GPU a consecutive group of layers, called a stage, and passes the activations from one stage to the next. Each GPU communicates only with its neighbours and only at stage boundaries, so the traffic is much lower and less frequent than with tensor parallelism. That makes it the better fit for slower links between GPUs and for links between servers.

The cost is idle time. A single request moves through the stages one after another, so while one stage works, the others wait unless other requests are in flight. The GPipe paper calls this idle time the pipeline bubble and found it negligible in training when the number of micro-batches was at least four times the number of stages. Inference has the same shape: pipeline parallelism needs enough concurrent requests to keep every stage busy, and it does not make an individual request faster.

vLLM’s tuning guide recommends pipeline parallelism when you have used up efficient tensor parallelism but need to distribute the model further, or across nodes, and notes that a higher pipeline-parallel degree may cause latency penalties.

How does the interconnect change the choice?

Tensor parallelism is only as good as the link between the GPUs, so check the topology before you choose. Vendor specifications show the gap:

  • An H100 SXM has 900 GB/s of NVLink bandwidth against 128 GB/s over PCIe Gen5. An H100 NVL lists 600 GB/s over NVLink.
  • An L40S has no NVLink and connects over PCIe Gen4 x16 at 64 GB/s bidirectional.

For GPUs on a node without NVLink, vLLM’s documentation, citing the L40S as an example, recommends pipeline parallelism instead of tensor parallelism for higher throughput and lower communication overhead. Across servers, it notes that efficient tensor parallelism needs fast internode communication, preferably through high-speed network adapters such as InfiniBand.

You can check what NCCL, the GPU communication library, actually uses. If its detailed logs show [send] via NET/Socket, traffic is going over plain TCP sockets, which the vLLM documentation calls inefficient for cross-node tensor parallelism. Our post on network fabrics for distributed on-premises AI covers the network design.

Which configuration fits common on-premises setups?

Start from the documented defaults below and adjust them only after measurement.

SetupStarting configurationWhy
Model and cache fit on one GPUOne GPU per replica; add replicas for throughputNo traffic between GPUs; replicas also provide failover
One server, GPUs linked by NVLinkTensor parallelism across the NVLink-connected GPUsThe fast link absorbs the per-layer all-reduces
One server, PCIe only (for example L40S)Pipeline parallelism, or replicas if a quantised model fits on one GPULess traffic over the slower link
NVLink connects only pairs of GPUsTensor parallelism within each pair, pipeline parallelism across the pairsKeeps the heavy traffic on the fast links
Several serversTensor-parallel size equal to the GPUs per node; pipeline-parallel size equal to the number of nodesvLLM’s documented approach for models too large for one node

For mixture-of-experts models, vLLM also supports combining data-parallel attention with expert- or tensor-parallel expert layers. Treat that as a separate design decision and benchmark it on its own.

How do you measure whether the split works?

Benchmark each candidate configuration with your model, your prompt and output lengths and your expected concurrency, and compare it with a single-GPU or replica baseline where one is possible. Track:

  • Time to first token, which reflects prompt processing and queueing.
  • Inter-token latency, the pace at which streamed tokens arrive.
  • Throughput, in tokens per second across all concurrent requests, at your latency target.
  • Per-GPU utilisation and memory, where uneven numbers across pipeline stages point to load imbalance.
  • Communication, through NCCL’s logs and by watching how latency changes as you raise the tensor-parallel degree.

Compare options on the same hardware. Two replicas of a quantised model and one tensor-parallel instance of the 16-bit model can use the same GPUs but differ in throughput, latency and answer quality; only your measurements and your evaluation set decide between them. Our explainer on LLM inference serving defines the latency metrics, and our comparison of vLLM, Ollama, llama.cpp and SGLang covers the choice of engine.

How should you document and revisit the configuration?

Treat the parallelism settings as part of the model’s deployment specification. Record the tensor- and pipeline-parallel degrees, which GPUs and servers hold which stages, the interconnect you assumed and the benchmark results that justified the choice.

Revisit the configuration whenever the hardware, the model, the context length or the traffic pattern changes, because a split that suits one setup can perform poorly on another. These decisions sit in the inference layer of our on-premises AI reference architecture, and the GPU count they imply feeds capacity planning for on-premises LLM hardware.

Featured image by Bill Fairs on Unsplash.

Frequently asked questions

Should I use tensor parallelism or pipeline parallelism for LLM inference?

Use tensor parallelism within a server whose GPUs are connected by a fast link such as NVLink, and pipeline parallelism across servers or between GPUs that only share PCIe. vLLM's documentation follows this pattern: tensor parallelism when a model fits on one multi-GPU node, and both combined when it needs several nodes. If the model fits on one GPU, run replicas instead.

Can tensor parallelism run over PCIe?

It runs, but the all-reduce operations in every layer then cross a much slower link. An H100 SXM, for example, has 900 GB/s of NVLink bandwidth against 128 GB/s over PCIe Gen5. For GPUs without NVLink, such as the L40S, vLLM recommends pipeline parallelism for higher throughput and lower communication overhead. Benchmark both on your hardware.

Does pipeline parallelism make a single request faster?

No. A request passes through the stages one after another, so for a single request the other GPUs wait. Pipeline parallelism lets a model that is too large for one GPU or server run at all, and its throughput depends on enough concurrent requests keeping every stage busy. vLLM notes that raising the pipeline-parallel degree may add latency.

How do I configure vLLM across several servers?

vLLM's documentation sets the tensor-parallel size to the number of GPUs per node and the pipeline-parallel size to the number of nodes. Efficient tensor parallelism across nodes needs fast network adapters such as InfiniBand. Check NCCL's detailed logs: if they show traffic going via NET/Socket, the GPUs are communicating over plain TCP sockets, which vLLM calls inefficient for cross-node tensor parallelism.

When should I run replicas instead of splitting a model?

Whenever the model, together with the cache it needs at your concurrency, fits on one GPU. Each replica then serves the whole model without any traffic between GPUs, a gateway or load balancer spreads requests across them, and losing one GPU removes capacity rather than the service. Split a model only when it does not fit.

Related insights

Plan your private AI with people who build it

Book a briefing. We look at your use case, data and constraints, and you leave with the deployment options and governance steps that fit.