kv cache
AI infra interview questions tagged kv cache, across every topic.
A model can load successfully and still run out of memory as requests accumulate. Study the cache layout first, calculate the memory required by the target context and concurrency, then check the serving engine’s measured allocation. Use the KV-cache calculator to vary the assumptions; a memory estimate alone does not predict latency.
From cache layout to serving limits
Start with a mechanism, then use a worked problem to explain a decision. Access labels below describe what is available without an account.
- The KV Cache
Explain which tensors persist between decoding steps and why they grow.
Public concept - Reading config.json to Size a Model You Have Never Run
Read layer count, KV heads and head dimension before choosing a formula.
Public concept - How big is the KV cache for Llama 3.1 70B at a 128k context?
Work through a concrete memory budget with explicit units.
Public answer - Set max-model-len and max-num-seqs for a chat product from first principles.
Turn the budget into context and concurrency settings.
Public answer - vLLM crashes with out of memory during startup on a model that should fit. Debug it.
Distinguish startup allocations from the workload’s growing cache.
Public answer - Serving Benchmarks That Do Not Lie
Check the resulting settings against a representative traffic mix.
Public concept
Concepts behind "kv cache"
Review the concepts used in these questions.
