kv-caching-avoids-recomputation-autoregressive

IN premiseentries/2026/06/21/wiki-Transformer_deep_learning_architecture-chunk-4.md

Created 2026-06-21T09:50:11+00:00

KV caching stores previously computed key and value vectors during autoregressive inference to avoid recomputation; prefilling is the initial forward pass that populates the cache.

Summary

When generating text one token at a time, the model can save the attention computations it already performed for earlier tokens instead of redoing them from scratch at every step. This means the first pass over the prompt does the heavy lifting, and each subsequent token only needs a small incremental computation, making generation dramatically faster than it would be otherwise.

Dependents

These beliefs depend on this one: