All glossary terms

Efficiency

KV cache quantization

Storing the per-token cache in 8 bits instead of 16 halves its memory, roughly doubling the concurrent users one card holds, at one measurable risk.

The KV cache usually ships in the same 16-bit precision as the weights, and it is the memory that caps concurrency. Halving the cache bytes per token - by storing keys and values in 8-bit - doubles how many conversations one card holds before it runs out, without touching the weights or the model at all.

The risk is numerical, and it lands in attention. Attention scores come from inner products of keys and queries, and half the representable range per element can shift them, especially with outliers. Real deployments therefore calibrate per-dimension scales over real activations and keep a close eye on their eval set, the same discipline quantizing weights needs.

It is worth knowing what the alternatives do, since a good interview answer lists them: fewer key-value heads (grouped-query attention) shrink the cache in the architecture; shorter context caps and sliding windows spend less cache per user; paged attention recovers reserved-but-unused memory. Cache quantization is the one that leaves both the model and the product untouched, which is why it is usually the first try.

A worked example

A model with a 160 KiB per-token 16-bit cache, 9 GiB free for the cache after weights, and 4,096-token conversations, before and after moving the cache to 8-bit.

  1. 16-bit cache: 4,096 x 160 KiB = 640 MiB per user, so 9 GiB holds 9 / 0.625 = about 14 conversations.
  2. 8-bit cache: 80 KiB per token, 4,096 x 80 KiB = 320 MiB per user, so 9 GiB holds 9 / 0.3125 = about 29 conversations.
  3. The concurrency ceiling roughly doubles by accepting one measurable source of precision error.

From about 14 to about 29 users on one card without touching the weights - the cache, not the model, was the concurrency budget.

Where this shows up

Test yourself

Related terms