Skip navigation
A new technique cuts KV cache memory by 6x!
0:00 / 0:20

A new technique cuts KV cache memory by 6x!

Avi Chawla

@_avichawla81K followers

Visit on X

32,020 views

A new technique cuts KV cache memory by 6x! And it also improves decoding throughput by 3-4x. During LLM inference, quantizing the model weights only addresses part of the memory cost. The model also stores keys and values for the tokens it processes, so it can reuse them when generating subsequent tokens. Longer conversations inherently lead to more entries in the cache, and serving concurrent requests multiplies the memory requirement. During decoding, attention repeatedly reads these cached entries. So as context grows, both the space occupied by the cache and the bandwidth needed to read it become constraints. This is why a model fitting in GPU memory doesn't tell you how many requests you can actually serve. KV quantization helps by storing those entries with fewer bits. But the GPU also has to compress new entries and reconstruct older ones during attention. That additional work can consume the time saved by reading fewer bytes. The main idea in this new technique is to compress older cache entries in groups, then reconstruct them as attention uses them. More specifically, the researchers keep the earliest and most recent cache entries at higher precision and compress older entries in blocks. Grouping entries lets them remove a shared component before compression. For a simplified example, imagine the same position in three cached vectors contains 100, 101, and 102. They can store the average, 101, once, and represent the differences as -1, 0, and 1. Those smaller differences are easier to represent accurately with fewer bits. They then encode the values together to reduce compression error further. The second change is how attention uses this compressed data. Normally, decompressing the cache into GPU memory and then reading it for attention would add more memory traffic. Instead, their attention kernel reconstructs the values in GPU registers and uses them immediately. This saves cache memory while avoiding the extra memory traffic that could cancel out the speed benefit. In vLLM tests with Qwen3-8B at 64K context on one H100, the 2-bit configuration achieved: ↳ 6x less total KV cache memory. ↳ 3.4x peak decoding throughput compared with BF16. The throughput gain includes fitting larger batches into the freed memory. It doesn't mean a single request generates tokens 3x faster. Quality also depends on the precision setting. At 3 and 4 bits, results stayed close to BF16 across the evaluated Qwen3 models. At 2 bits, accuracy dropped more. Here's the paper covering this technique: Quantization is one of several ways to reduce KV cache costs. I covered 12 techniques in my KV Cache Engineering article, explaining what each one saves, how it works, and the trade-offs to consider for your workload. Read it below.

Comments

Comments from the original post on X (Twitter)

No comments yet