What is distributed inference?
Distributed inference is an approach splitting a trained model's response generation across several GPUs or servers, running models too large for one device or meeting high request volumes with lower latency.
Unlike model serving, the whole service layer covering request intake, batching, scaling and monitoring, distributed inference decides within it how the model is split across devices. Unlike distributed training, it has no backward pass and puts latency first.
- Topic
- Infrastructure and runtime
- Also known as
- Multi-GPU inference
How distributed inference works
- A model too large for one device is split within layers by tensor parallelism and across layers by pipeline parallelism; experts are spread in mixture of experts models.
- The prefill stage processing long input and token-by-token generation can run on separate devices given their different resource needs.
- For high request volume, several model copies run and requests are spread among them.
- The split is chosen by latency target, batch size and interconnect speed.
In more detail
Communication patterns of each parallelism type and matching hardware
Tensor parallelism (TP) requires high-bandwidth AllReduce collectives inside every transformer layer, so it is normally confined within a single NVLink-connected server; pipeline parallelism (PP) passes activations only at stage boundaries with much lower bandwidth needs, making it suited across servers. In Mixture-of-Experts (MoE) models, Expert Parallelism (EP) distributes distinct experts across GPUs using All-to-All communication, often combined with Data Parallelism for attention layers.
Inference performance metrics: TTFT, TPOT and goodput
Distributed inference is evaluated using two distinct latency metrics: Time to First Token (TTFT), which is compute-bound during prompt prefill and Time Per Output Token (TPOT) or Inter-Token Latency (ITL), which is memory-bandwidth- and communication-bound during autoregressive decoding. Under continuous batching, systems also track goodput, the request rate meeting both TTFT and TPOT service-level objectives simultaneously.
KV cache management and prefill-decode disaggregation
In long-context serving, the Key-Value (KV) cache often consumes more GPU memory than model weights and causes contention when prefill and decode share the same devices. Modern architectures address this via PagedAttention for non-contiguous KV memory allocation, distributed prefix caching across replicas and Prefill-Decode (PD) disaggregation that transfers KV states over RDMA interconnects so heavy prefill prompts do not stall ongoing token generation.
Commonly confused terms
| Term | How it differs |
|---|---|
| Speculative decoding | Speculative decoding accelerates autoregressive token generation by having a smaller draft model propose candidate tokens verified in parallel by the target model; distributed inference scales memory and compute across multiple accelerators and can be combined with speculative decoding. |
Why distributed inference matters for on-premises AI
Large language models often do not fit one GPU or give acceptable latency on one device; distributed inference is a precondition for running them in-house. A 2022 study of large transformer inference reached 29 milliseconds per token at low batch on a 540 billion parameter model with suitable multi-dimensional partitioning; the split chosen sets the latency versus throughput balance. The cost is communication: slow links raise latency.
A defence company spreads a large language model on its closed network across sixteen GPUs in two servers, using tensor parallelism within servers and pipeline parallelism between them; at peak hours it routes requests to a second model copy.
Common questions
When is distributed inference needed?
When the model does not fit one GPU's memory, latency on one device is too high or request volume exceeds one copy's capacity.
How does distributed inference differ from distributed training?
Inference has no backward pass or gradient exchange and prioritises latency. Training prioritises total throughput and memory distribution.
Related terms
- Model serving
- Model parallelism
- Tensor parallelism
- Pipeline parallelism
- Multi-tenant inference
- Throughput
Sources
- Pope et al., Efficiently Scaling Transformer Inference, 2022
- Aminabadi et al., DeepSpeed Inference: Enabling Efficient Inference of Transformer Models at Unprecedented Scale, 2022
In the glossary: Glossary, D to L