Skip to content
Inference Academy

How many GPUs do you need to serve an LLM? A worked capacity plan

A step-by-step capacity plan for a real brief: Llama-class 70B, 1,000 requests a minute, 8K-token prompts, 1K-token answers, P95 time to first token under 1 second and P95 end-to-end under 10 seconds, on H100s. Prefill compute, decode bandwidth, KV memory, batching limits from the latency target, and why the answer is not one 8-GPU node.

Key takeaways

  • Capacity comes from four calculations: prefill compute, decode bandwidth, KV cache memory and the latency target's limit on batching.
  • A P95 end-to-end target of 10 s for 1,024-token answers leaves about 8.8 ms per output token.
  • For the worked brief (70B in FP8, 1,000 requests a minute, 8K prompts), the estimate is about 8 nodes of 8 H100s.
  • Here bandwidth per decode step, not KV memory, limits the batch; the strict target forces TP=8.
  • The latency target, prompt length and prefix reuse change the cost more than the GPU choice; measure before buying.

By

9 min read

Share
On this page

"How many GPUs do we need?" is the question every team serving its own model eventually asks, and it's a favourite senior interview question for inference roles. The honest answer comes from four calculations: prefill compute, decode bandwidth, KV cache memory, and what your latency target does to batching. Let's do them for a concrete brief.

#The brief

Requirement Value
Model Llama-class 70B (80 layers, 8 KV heads, head dimension 128), served in FP8
Traffic 1,000 requests per minute (about 16.7 per second), steady
Prompt length 8,192 tokens
Output length 1,024 tokens
Latency targets P95 time to first token under 1 s; P95 end-to-end under 10 s
Hardware H100 SXM 80 GB, 8 per node with NVLink

Hardware figures used below: 3.35 TB/s of memory bandwidth per GPU, and about 1,979 TFLOP/s of dense FP8 tensor-core peak. Every number that follows is an estimate from those specs, with stated efficiency assumptions; the last section says how to check them.

#Step 1: turn the latency target into a per-token budget

End-to-end time is TTFT plus 1,024 output tokens. If TTFT takes up to 1 second, the remaining 9 seconds must cover 1,024 tokens:

TPOT budget=10−1 s1024≈8.8 ms per token\text{TPOT budget} = \frac{10 - 1 \ \text{s}}{1024} \approx 8.8 \ \text{ms per token}

That's a strict target: about 114 tokens per second for every user, all the time. We'll plan for 8 ms to leave a little margin. This single number will drive most of the cost.

#Step 2: prefill compute

Prefill costs about 2×parameters×prompt tokens2 \times \text{parameters} \times \text{prompt tokens} FLOPs (attention adds a bit more at 8K, which we'll ignore):

2×70.6×109×8192≈1.16×1015 FLOPs per request2 \times 70.6 \times 10^{9} \times 8192 \approx 1.16 \times 10^{15} \ \text{FLOPs per request}

At 16.7 requests per second, that's about 1.93×10161.93 \times 10^{16} FLOP/s. Real prefill reaches perhaps half of the FP8 peak, about 990 TFLOP/s per GPU, so:

1.93×10160.99×1015≈19.5 GPUs of prefill compute\frac{1.93 \times 10^{16}}{0.99 \times 10^{15}} \approx 19.5 \ \text{GPUs of prefill compute}

Prefill alone needs about two and a half 8-GPU nodes. One prompt on a TP=8 group would take about 146 ms, comfortably inside the 1-second TTFT target, provided requests don't queue for long. To keep P95 queueing short, plan to run prefill GPUs at no more than about 70% busy (queueing theory): that's about 28 GPUs of prefill.

#Step 3: decode, with the latency budget limiting the batch

Each decode step on a tensor-parallel group reads that group's share of the weights plus every active sequence's KV cache (prefill vs decode).

  • KV cache per token in FP8: 2×80×8×128×1=1602 \times 80 \times 8 \times 128 \times 1 = 160 KiB.
  • Average live context per sequence: the 8,192-token prompt plus, on average, half the output: about 8,700 tokens, so about 1.4 GB of KV per sequence.
  • Achievable bandwidth: assume 70% of peak, about 2.35 TB/s per GPU.

On a TP=8 group, each GPU reads 70.6/8≈8.870.6 / 8 \approx 8.8 GB of weights per step (about 3.8 ms) plus 1.4/81.4 / 8 GB of KV per sequence (about 0.076 ms each). With an 8 ms budget:

3.8+0.076 B≤8⇒B≤55 sequences3.8 + 0.076 \, B \le 8 \quad \Rightarrow \quad B \le 55 \ \text{sequences}

So one TP=8 replica can run about 55 sequences at the target speed: 55/0.008≈6,90055 / 0.008 \approx 6{,}900 output tokens per second.

We need 16.7×1024≈17,10016.7 \times 1024 \approx 17{,}100 output tokens per second, which means about 2.5 replicas, so 3 nodes for decode.

What about TP=4? Each GPU then reads 17.6 GB of weights per step, about 7.5 ms on its own. That leaves room for only about 3 sequences per replica, so TP=4 can't meet an 8 ms budget efficiently. The latency target forces the larger tensor-parallel size.

#Step 4: does the KV cache fit?

55 sequences times 1.4 GB is about 78 GB of KV per replica. A TP=8 node has 640 GB, minus about 71 GB of weights and some working memory: roughly 500 GB free. Memory is not the constraint here; bandwidth per step is. That's the effect of the strict latency target. With a relaxed target, memory becomes the limit much sooner (KV cache explained).

#Step 5: put it together

Pool Sized by GPUs
Prefill Compute, kept under about 70% busy about 28 (call it 4 nodes)
Decode Bandwidth per step at 8 ms TPOT 24 (3 nodes at TP=8)
Headroom and failover Lose one node without missing the target 1 node
Total about 8 nodes, 64 H100s

Two design choices are baked in:

  • Disaggregated prefill and decode. If prefill and decode share GPUs, every 8K-token prefill would stall 55 decoding users for over 100 ms, blowing the 8 ms TPOT target. Separate pools (with the KV cache shipped from prefill to decode GPUs) keep decode steps steady (disaggregation explained). Chunked prefill on shared GPUs is the simpler alternative, but with this TPOT budget it would need very small chunks and many more GPUs.
  • TP=8 decode replicas. Forced by the per-token budget, as Step 3 showed.

So the answer to "can we do this on one 8-GPU node?" is no: this brief needs roughly eight. One node handles roughly a fifth to an eighth of it, depending on how you split its GPUs.

#Sanity check with Little's law

Little's law says the number of requests in the system equals the arrival rate times the time each one spends there. Each request spends about 10 seconds decoding (the end-to-end target), and 16.7 arrive per second:

16.7×10≈167 concurrent decoding sequences16.7 \times 10 \approx 167 \ \text{concurrent decoding sequences}

Three decode replicas at 55 sequences each hold 165. The two calculations agree, which is a good sign the plan is consistent. If they didn't, one of the assumptions (arrival rate, output length or per-token budget) would be wrong.

#Variant 1: relax the target to 20 seconds

Redo Step 3 with a P95 end-to-end target of 20 s. The per-token budget becomes (20−1)/1024≈18.5(20 - 1) / 1024 \approx 18.5 ms:

3.8+0.076 B≤18.5⇒B≤193 sequences3.8 + 0.076 \, B \le 18.5 \quad \Rightarrow \quad B \le 193 \ \text{sequences}

Each TP=8 replica now produces about 193/0.0185≈10,400193 / 0.0185 \approx 10{,}400 tokens per second, so decode needs 1.6 replicas: 2 nodes. The KV cache for 193 sequences is about 275 GB, still within the roughly 500 GB free, so memory still isn't the limit. Little's law agrees: 16.7 requests per second for 20 seconds is about 334 sequences, and two replicas hold 386.

Total: 4 prefill nodes, 2 decode, 1 headroom: 7 nodes. Add 50% prefix reuse and prefill falls to 2 nodes: 5 nodes. Two product decisions (a looser target and cache-friendly prompts) cut the plan from 8 nodes to 5.

#Variant 2: an 8B model instead of 70B

Same traffic and targets, with a Llama-class 8B model in FP8 on single-GPU replicas.

  • Prefill: 2×8×109×8,1922 \times 8 \times 10^9 \times 8{,}192 FLOPs per request, times 16.7 per second, is about 2.2×10152.2 \times 10^{15} FLOP/s: about 2.2 H100s at half of FP8 peak, or about 3 to 4 GPUs at 70% busy.
  • Decode: each GPU reads 8 GB of weights per step (about 3.4 ms) plus 0.57 GB of KV cache per sequence (about 0.24 ms each, at 8,700 tokens of context with 64 KiB per token). With an 8 ms budget, B≤19B \le 19 sequences per GPU, about 2,400 tokens per second each. Serving 17,100 tokens per second needs about 8 GPUs.

So about 12 GPUs plus headroom: roughly 2 nodes, against 8 for the 70B model. Notice what limits decode now: the weights take only 3.4 ms, but 19 long conversations' KV caches take 4.6 ms. With 8K-token prompts, the KV cache, not the model, dominates the bytes read per step (KV cache explained). Shorter prompts, an FP8 cache (already assumed) or a model with a smaller cache per token (GQA vs MQA vs MLA) would cut it further.

#What changes the answer most

The plan is very sensitive to a few inputs. Change one, redo the sums:

Change Effect
Relax end-to-end to 20 s (TPOT about 18.5 ms) About 190 sequences per decode replica; decode drops to 2 nodes
Prefix caching with 50% shared prompt tokens (system prompt, documents) Prefill compute halves: about 2 nodes instead of 4
Shorter prompts (2K instead of 8K) Prefill falls 4 times; KV per sequence falls about 3.5 times
A smaller model (8B) About 2 nodes in all instead of 8 (worked below); at 8K context the KV cache reads, not the weights, set the decode size
Bursty traffic Size for the peak hour, or autoscale with warm capacity
Speculative decoding Raises tokens per step at low batch; helps a tight TPOT target

The lesson isn't the specific total. It's that the latency target, the prompt length and prefix reuse decide the cost far more than the choice of GPU. Before buying hardware, challenge the brief: is 10 seconds end to end really needed for 1,024-token answers? Are prompts really 8K, or is most of that a shared prefix?

#How to check this before you buy

  1. Measure one GPU or one node with your real prompts: prefill throughput, and decode TPOT against batch size at your context length.
  2. Replace the assumed efficiencies (50% of FP8 peak for prefill, 70% of bandwidth for decode) with your measurements.
  3. Load test open-loop at a scaled-down arrival rate and read P95 TTFT and TPOT, not averages (how to benchmark an LLM server).
  4. Scale linearly from there, keeping the utilisation headroom.

#Common mistakes

  • Sizing from weights alone. The weights fit on one node; the traffic needs eight.
  • Sizing for average load instead of the peak hour, or without headroom for queueing.
  • Using the model's maximum context instead of real prompt and output lengths.
  • Planning decode without the latency budget, which gives huge batches no user would accept.
  • Forgetting failover. Losing one node shouldn't break the latency target for everyone.

#FAQ

Why not just use bigger batches to need fewer GPUs? The per-token latency budget caps the batch. Relax the target and the batch, and the savings, grow (Variant 1).

Would H200s or B200s change the answer? Yes: more bandwidth raises the batch that fits in the per-token budget, and B200's extra compute shrinks the prefill pool (H100 vs H200 vs B200).

What does this cost per month? See the same plan priced out in cost per million tokens and compared with an API in self-hosting vs API.

#Go deeper

The platform design capstone takes a brief like this one all the way to a full design: replica layout, request path, autoscaling, batch scheduling, failure plan, rollouts and cost. Capacity planning and cost and know your workload cover this method in the Serving AI in Production course, and queueing theory for LLM capacity covers the headroom maths. For the parallelism side, see tensor vs pipeline vs data parallelism and the model parallelism lesson.

capacity-planninggpusservingproductioninference-engineering

Found this useful?

Send it to someone who is learning the same thing.

Share this article

Next: learn it step by step, free

Capacity planning and cost

Turn traffic and latency targets into a GPU count and a monthly bill. A free lesson with step-through diagrams and a quiz.

Get new articles by email

One short email when a new guide is out. Unsubscribe any time.