Inference, Serving & Production·Question 38 of 76Advanced

Build the full GPU memory budget for a serving deployment, and show how it determines maximum batch size and concurrency.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Budget for one H100 80 GB serving a 70B-class model (80 layers, 8 KV heads, head_dim 128) quantized to 4-bit:

Weights:   70e9 params × ~0.56 B/param (4-bit + scales)  ≈ 39 GB
Runtime:   CUDA context + engine buffers                  ≈ 2 GB
Activations/workspace (batch- & chunk-size dependent)     ≈ 4 GB
------------------------------------------------------------------
Available for KV cache (at ~0.9 memory utilization)       ≈ 27 GB
Full worked answer with diagram

Budget for one H100 80 GB serving a 70B-class model (80 layers, 8 KV heads, head_dim 128) quantized to 4-bit:

Weights:   70e9 params × ~0.56 B/param (4-bit + scales)  ≈ 39 GB
Runtime:   CUDA context + engine buffers                  ≈ 2 GB
Activations/workspace (batch- & chunk-size dependent)     ≈ 4 GB
------------------------------------------------------------------
Available for KV cache (at ~0.9 memory utilization)       ≈ 27 GB

KV cache at FP16 is ~320 KB/token (2 × 80 × 8 × 128 × 2 B), so the pool holds:

27 GB ÷ 320 KB ≈ ~84K tokens of total resident context

That single number is your concurrency budget: ~21 concurrent sequences at 4K context, ~10 at 8K, and a single 84K-context request consumes the entire pool. Since decode throughput scales with batch size, this is why KV memory - not compute - caps throughput for most deployments, and why a long-context feature quietly destroys the economics of a shared pool.

Levers, with their effect on the same arithmetic: FP8 KV cache → 160 KB/token → ~168K resident tokens (2× concurrency); GQA is already in this model (with full MHA it'd be 8× worse); a second GPU with TP=2 roughly doubles the KV pool and halves weight bytes per GPU; smaller model or shorter context caps obviously help. PagedAttention matters here as the enabler: it makes ~all of that 27 GB usable (prior contiguous allocation wasted most of it), and prefix caching means shared system prompts don't multiply-count against the pool.

Close the loop with behaviour at the limit: when admission would exceed the pool, the scheduler queues (TTFT grows) or preempts running sequences (evict-and-recompute - ITL spikes). So "KV utilization" and "preemption rate" are the dashboards that tell you this budget is exhausted before users do.

Worth sketching. Drawing the budget as one flow from card capacity to concurrent sequences makes the KV pool visibly the thing that caps throughput.

flowchart TD
    G["H100 80 GB at ~0.9 utilization"] --> W["4-bit weights: ~39 GB"]
    G --> R["Runtime and activations: ~6 GB"]
    G --> KV["KV pool: ~27 GB"]
    KV -->|"~320 KB per token"| T["~84K resident tokens in total"]
    T --> C["~21 sequences at 4K, ~10 at 8K,<br/>one request at 84K"]
    C -->|"pool exhausted"| P["Queue, so TTFT grows,<br/>or preempt, so ITL spikes"]

What a good answer covers

  • That single number is your concurrency budget
  • Since decode throughput scales with batch size, this is why KV memory - not compute - caps throughput…
  • Levers, with their effect on the same arithmetic
  • PagedAttention matters here as the enabler
  • Close the loop with behaviour at the limit

Interviewer follow-ups to expect

  1. Redo the math with FP8 weights on 2 GPUs. Your product wants to raise the context limit from 8K to 128K - what does that do to cost per request?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep