On this page
How it works
- While generating, each new token attends to all earlier tokens.
- Keeping their keys and values in memory avoids recomputing them every step.
- The cache grows with conversation length and with the number of conversations served at once.
Full lesson: AI numbers: serving, cost and latency.
The numbers
- Per token ≈ 2 × layers × KV heads × head size × bytes.
- For a 70B-class model (80 layers, 8 KV heads of 128, 16-bit): ≈ 330 KB per token; ≈ 1.3 GB for a 4,000-token conversation.
Why it matters, by role
- AI Infrastructure PMProduct Manager. Decides what a product should do, for whom, and why. Read the full explanation: Sizes capacity and cost per user.
- AI TPMTechnical Program Manager. Owns plans, dependencies, risks and delivery for large cross-team programmes. Read the full explanation: Drives hardware planning.
- AI Platform PM: Explains why long contexts cost more.
How interviews test it
- A team wants to serve a 70-billion-parameter model on a single 80 GB GPU to save money. Will it work?
- A chat product will serve a 70B-parameter model to 1 million daily users. Estimate how many GPUs you need, and what it will cost.
- A large customer wants output speed doubled, from 40 to 80 tokens per second per user. What does that cost you, and what would you offer?
Common confusions
- "It fits" counting only weights, forgetting the cache.
- The KV cacheKey-value cache. Stored attention keys and values that let a model generate each new token without recomputing the whole context. Read the full explanation is not a response cache; it doesn't reuse answers between users.
- Prompt (prefix) caching reuses part of it across requests with identical openings.
Related concepts
Sources
- Kwon et al. (2023), "Efficient Memory Management for Large Language Model Serving with PagedAttention"
- Explained from standard practice; taught in full in the AI numbers: serving, cost and latency module.