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
Machine Learning
Machine Learning Engineer
Baseten
November 29, 2026
Machine Learning Engineer
Technical Screen
Machine Learning
Medium

0

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
KV cache
GPU memory
grouped-query attention
quantization
capacity planning
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. 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 Prep
Sample 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....


Submit Your Answer
Markdown supported

Related Questions