TensoriumInterview preparation
Deep Dive · compute → memory → bandwidth · 7 steps

KV Cache

The deployment problem is concrete: a 70B model fits across 8×80 GiB accelerators, but one 128K conversation adds 40 GiB of state and eight add 320 GiB before allocator overhead. You will derive where those bytes come from, distinguish persistent cache from transient GQA expansion, decide whether weights or cache dominate each decode operating point, and select among paging, quantization, eviction, reuse, GQA, and MLA by the exact term each changes. Published claims, deterministic arithmetic, and our interpretations remain visibly separate.

Core path ~31 min: 01 → 04 then 07 · Systems deep dive +27 min: 05 → 06

Step 01 of 07CONCEPT~5 min · core path

Discover the wasted work

Goal: By the end of this step, you can state, in cost terms, why naive autoregressive decoding is untenable — because you found the waste yourself.

Imagine the model has just completed “The capital of France is” with “Paris.” To generate the next word, we could run the entire six-token sequence through the model again. That would work. But which of those calculations would actually produce something new?

In causal attention, an earlier position cannot see the tokens that come after it. Adding “Paris” therefore does not change what the original five positions can see. With the weights and inference settings unchanged, their hidden states and projections can be reused.

That gives us a useful question before we reach for a formula: which of those old results will the next token need? Follow the short trace below and keep that question in mind.

Work the trace before reading onMedium

Prompt: [The] [capital] [of] [France] [is] — the model just emitted "Paris". To generate the next token, it runs attention again. Which quantities computed from "The capital of France is" have changed since the previous decode step?

Prove it before continuing

Caching K and V removes which cost — and leaves which untouched?

Pick an answer in the quick check above to unlock the next step—committing unlocks it whether right or wrong.