Estimate KV Cache Capacity for a 70B Model on Two GPUs
Last updated: November 29, 2026
Quick Overview
For a 70B Llama-style model with 80 layers, grouped-query attention with 8 KV heads of dimension 128, served on 2 x 80 GB GPUs with FP8 weights, estimate how many tokens of KV cache fit and how many concurrent 8k-token conversations that supports. Then say how FP8 KV cache and a decode speed bound change the picture.
Baseten
November 29, 20260
0
0 solved
For a 70B Llama-style model with 80 layers, grouped-query attention with 8 KV heads of dimension 128, served on 2 x 80 GB GPUs with FP8 weights, estimate how many tokens of KV cache fit and how many concurrent 8k-token conversations that supports. Then say how FP8 KV cache and a decode speed bound change the picture.
Sizing GPU memory is a daily task for Baseten's model performance and solutions engineers when a customer asks how many users a deployment can handle. The interviewer checks back-of-envelope fluency with transformer memory and the ability to state assumptions.
What the Interviewer Expects
- Writes the per-token KV formula: 2 x layers x kv_heads x head_dim x bytes
- Accounts for weights, activations and runtime overhead before computing free memory
- Converts free memory into total tokens and then into concurrent sequences
- Shows how GQA and FP8 KV cache change the answer
- Adds a memory-bandwidth bound on decode speed
- States which assumptions would most change the result
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- How does paged attention change the effective capacity compared with reserving max length per request?
- What happens to this estimate with a 128k context model?
- Would you rather add a third GPU or quantize the KV cache further? What would you measure?
- How does tensor parallelism split the KV cache across GPUs?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Assume FP8 weights (~1 byte per parameter, so ~70 GB), BF16 KV cache to start, 2 x 80 GB = 160 GB total, and about 10 GB reserved for activations, CUDA graphs and fragmentation. Each conversation can ...
Approach
Free memory for KV = total minus weights minus overhead. Per-token KV size comes from the architecture. Divide, then divide again by tokens per conversation....