Lattice
Skip to content

KV cache

The saved attention keys and values from tokens already processed, so the model does not recompute them for every new token.

By Lattice editorial · Entry last reviewed · method

What it implies

It is what makes generation incremental rather than quadratic, and its size is the main thing that determines how many concurrent sequences fit on a GPU. It grows with context length and batch size, which is why long contexts and high concurrency compete for the same memory.

Related terms