KV Cache in 2D: Linear vs Quadratic Inference Cost
A layered 2D dashboard of transformer autoregressive decoding: step through token generation, watch key/value bars get cached, and compare linear (cached) versus quadratic (recomputed) K/V projection cost live.
Every large language model generates text one token at a time, and each new token's attention step needs the key and value vectors of everything written so far. This layered 2D dashboard steps through that sequence: a pannable timeline of cached key/value bars on top, a live softmax attention-weight bar chart for the newest query in the middle, and a growth-curve panel underneath plotting cumulative K/V projection cost — flat and linear with the cache on, a visible parabola with it off. Toggle the KV cache off and every earlier token's bars flash as they're recomputed from scratch; toggle model depth, model width, or numeric precision and the memory/compute readouts respond immediately, the same way a real inference server's GPU memory budget responds to those same knobs.
A layered 2D dashboard of transformer autoregressive decoding: step through token generation, watch key/value bars get cached on a pannable timeline, and compare linear (cached) versus quadratic (recomputed) K/V projection cost on a live growth-curve panel.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install