Skip to Content

How models are placed on GPUs

Replicate, tensor parallel and pipeline parallel; what each needs from the hardware; and how to size GPU memory and the KV cache.

A model server needs the model's weights in GPU memory, plus room for the KV cache of every request it is working on. When a model fits on one GPU, you run copies of it. When it doesn't, you split it, and how you split it decides what your hardware must provide.

argoctl analyse does this arithmetic for your hardware and prints the layout and flags to use. This page explains its choices.

The three layouts

1. Replicate: a full model per GPU (or per node)

  load balancer ──┬──▶ replica 1  [GPU 0: whole model]
                  ├──▶ replica 2  [GPU 1: whole model]
                  └──▶ replica 3  [GPU 0 on another node: whole model]

Each replica holds the whole model and serves requests on its own. The Kubernetes Service spreads requests across replicas.

  • Needs: ordinary networking. Replicas never talk to each other.
  • Scales: linearly. Twice the replicas, twice the throughput.
  • Fails gracefully: losing a GPU loses one replica.
  • Use when: the model, plus its KV cache, fits on the GPUs you give one replica.

--replicas N (with the default --tensor-parallel-size 1).

2. Tensor parallel: each layer split across GPUs in one node

  replica ──▶ [ GPU 0 | GPU 1 | GPU 2 | GPU 3 ]   every layer split 4 ways,
               ◀─────── all-reduce over NVLink ───────▶   GPUs exchange results at every layer

Every layer's matrices are split across the GPUs of one replica, so each GPU holds a slice of every layer. The GPUs exchange partial results (an all-reduce) twice per layer, for every token, so the link between them decides the speed.

  • Needs: NVLink. On 8-GPU HGX systems the GPUs connect through NVSwitch, so every GPU talks to every other at full NVLink bandwidth, and any TP size up to 8 works well.
  • Over PCIe tensor parallelism works, but the all-reduce traffic crosses the PCIe bus and the CPU's root complex: it stops scaling past about 2 GPUs.
  • NVSwitch systems need NVIDIA Fabric Manager running, or the GPUs can't use NVLink (CUDA reports the system isn't initialised). The GPU Operator's driver runs it on NVSwitch systems, and argoctl verify cluster checks it.
  • Use when: the model doesn't fit on one GPU but fits on one node. Typical TP sizes: 2, 4 or 8. It must divide the model's attention heads.

--tensor-parallel-size N (N GPUs per replica, all on one node).

3. Pipeline parallel: layers split across nodes

  replica ──▶ node A [layers 1-40 on 8 GPUs] ──activations over RDMA──▶ node B [layers 41-80 on 8 GPUs]

The model's layers are divided into stages, one per node; within a node each stage is usually tensor parallel. Activations flow from one stage to the next.

  • Needs: RDMA networking between the nodes: InfiniBand or RoCE (RDMA over Converged Ethernet), with GPUDirect RDMA so the NIC reads and writes GPU memory directly instead of copying through the CPU.
  • Without RDMA, NCCL (the library vLLM uses for GPU communication) falls back to TCP sockets. It still works, but every hop goes through the kernel and host memory; latency and throughput suffer badly.
  • Less traffic than tensor parallelism (only activations at stage boundaries), but every request crosses the network, and a fault in either node takes the replica down.
  • Use when: the model doesn't fit in one node's GPU memory even at a lower precision.

--pipeline-parallel-size N (N nodes per replica), with --tensor-parallel-size set to the GPUs per node.

Rule of thumb

Replicate if you can, split within a node if you must, split across nodes only as a last resort.

Before splitting across nodes, try a lower precision: an FP8 checkpoint halves the weights of a BF16 one, and often fits in one node.

Sizing GPU memory

Weights

weights ≈ parameters × bytes per parameter

PrecisionBytes per parameter8B model70B model405B model
BF16 / FP16216 GB140 GB810 GB
FP8 / INT818 GB70 GB405 GB
INT4 (AWQ, GPTQ), MXFP4~0.5~4-5 GB~35-40 GB~200-230 GB

INT4 formats store scales alongside the weights, so they come out a little above half a byte per parameter.

Mixture-of-experts (MoE) models are sized by their total parameters, not their active ones. Qwen3-235B-A22B activates 22B parameters per token, but all 235B must be in GPU memory: 470 GB at BF16, 235 GB at FP8. The active count drives speed, not memory.

Headroom for the KV cache

Add 20-50% on top of the weights for the KV cache, activations and the CUDA runtime: towards 20% for short prompts and few concurrent requests, towards 50% for long contexts and high concurrency. If the weights alone take more than about 80% of the GPUs you give a replica, give it more GPUs or use a lower precision.

Precision and GPU generation

GPUCompute capabilityBF16FP8
T47.5 (Turing)No: argoCTL serves FP16 insteadNo
A1008.0 (Ampere)YesFP8 checkpoints run weight-only (memory saving, no FP8 compute)
L4, L40S8.9 (Ada)YesYes
H100, H2009.0 (Hopper)YesYes
B20010.0 (Blackwell)YesYes (and FP4)

Worked example

Llama-3.3-70B on 8× H100 80 GB (NVSwitch) nodes:

PrecisionWeightsWith 30% headroomFits onLayout
BF16141 GB~185 GB4 GPUs (320 GB)TP 4, 2 replicas per node
FP871 GB~92 GB2 GPUs (160 GB)TP 2, 4 replicas per node

The KV cache

When a transformer generates a token it needs the keys and values of every earlier token in the sequence, at every layer. Recomputing them each time would be far too slow, so the server keeps them in GPU memory: the KV cache.

Per token, the cache takes:

2 × layers × KV heads × head dimension × bytes per value

(the 2 is one key and one value). For Llama-3.3-70B (80 layers, 8 KV heads, head dimension 128) at BF16:

2 × 80 × 8 × 128 × 2 bytes = 320 KiB per token, so an 8,000-token conversation holds 2.5 GiB of cache.

Things to know:

  • It is per in-flight request, not per user. A request's cache exists while the server is working on it. A thousand users who send a request every few minutes need far less than a thousand caches.
  • Continuous batching keeps all active requests on the GPU. vLLM interleaves every active request in the same forward passes, so the caches of all of them must be in GPU memory at once: 32 concurrent 8k-token requests on the 70B model above need 80 GiB of cache. When it runs out, new requests wait in a queue.
  • Prefix caching shares the cache of identical prompt prefixes (a long system prompt, a shared document) between requests, so they are computed and stored once. vLLM enables it by default.
  • Offload tiers. When GPU memory is full, cache blocks can move to CPU memory or local NVMe and come back when needed, which is slower than recomputing short prefixes but much faster for long ones.
  • --max-model-len caps the context a request can use, and so the worst case per request. Lower it to fit more concurrent requests; raise it for long documents.
  • Models with fewer KV heads (grouped-query attention) or compressed attention need much less cache per token for the same size.

On this page