Skip to content
inference.academy

glossary/precision/kv-cache-quantization

KV cache quantization

also FP8 KV cache, KV cache compression

Storing the cached keys and values in 8 or 4 bits instead of 16. At long context the cache, not the weights, is most of the memory and most of the bytes a decode step reads, so halving it doubles the tokens a GPU can hold and shortens every step. Keys are harder than values because of outlier channels; per-channel scaling for keys and per-token for values is the usual answer.


160 KiB

Per token for Llama 3 70B with an FP8 cache, half of BF16, so the same 180 GB holds twice the context.


See it happen


Related