Your LLM's KV cache is eating 75% of your GPU memory. At 128K context, it's the dominant cost. At 1M tokens, it consumes 70-90% of VRAM and 60-85% of wall-clock time per token. Every optimization trick we've tried so far, from FP8 quantization to paged attention, chips away at the problem. But a new approach from Fergus Finn at Doubleword just showed how to losslessly compress that cache by another 4x, on top of existing techniques. The total reduction from raw bf16? Roughly 8x.
How It Works
The core insight is deceptively simple. A KV cache is deterministic: given the same prompt, the same model produces the same key-value tensors every time. So what if you could predict what those tensors will be before the target model even runs?
That's exactly what Speculative KV coding does. A smaller, cheaper "predictor model" (typically a quantized version of the target model) runs on both the encoder and decoder sides. It generates a prediction of what the target model's KV cache will look like, along with a calibrated variance. An arithmetic coder then encodes only the residual: the difference between the prediction and reality.
On the decoding side, the decoder runs the same predictor, gets the same prediction, and reconstructs the full cache from the bitstream plus its local prediction. The result is bit-identical to the original. No quality loss. No approximation. The math is clean:
The cost of encoding the true KV value follows a Gaussian distribution centered on the prediction. The better the predictor fits, the smaller the residual, the fewer bits needed.
The Mixture Model Trick
A simple Gaussian doesn't capture the full picture. Real KV caches have outliers, values that deviate sharply from the predicted mean. Finn's team solved this with a three-component mixture distribution: a tight Gaussian for the bulk, a wider Gaussian for moderate deviations, and an empirical marginal distribution for extreme outliers. This mixture model dramatically improves compression by handling the heavy tails that a single Gaussian misses.
Results on Qwen3
The numbers are striking, and they scale with model size:
| Target Model | Compression vs. Raw FP8 |
|---|---|
| Qwen3-0.6B | 3.08x |
| Qwen3-32B | 3.90x |
On bf16 baselines, the method achieves 2.3x to 2.7x compression. On FP8 baselines, it reaches 3.0x to 3.9x. Larger models compress better because their quantized counterparts are better predictors of the full-precision cache.
Where This Fits in the KV Cache Wars
This isn't happening in isolation. The KV cache bottleneck has attracted an arms race of competing approaches, and understanding where Speculative KV coding sits relative to them matters.
TurboQuant (Google, ICLR 2026) takes the lossy route. It compresses KV caches to 3 bits per coordinate using vector quantization, achieving 6x memory reduction with what Google claims is near-zero accuracy loss. The tradeoff is clear: you get aggressive compression, but the reconstruction is approximate. For applications where exact outputs matter, like legal document generation or code translation, that approximation can propagate errors.
VeriCache (recent arXiv paper) tries to get the best of both worlds. It uses lossy compression to draft tokens, then verifies them against the full KV cache stored off-GPU. The problem: you still need the full cache somewhere. VeriCache addresses this with clever swapping strategies, but it adds latency for each verification step.
QuantSpec (Apple, ICML 2026) uses self-speculative decoding with hierarchical 4-bit quantization. The draft model shares the target's architecture but uses quantized weights and KV cache. It's elegant but requires the draft model to be architecturally compatible.
Speculative KV coding is different because it's lossless and composable. It stacks on top of FP8 quantization, hybrid attention, prefix caching, whatever you're already using. You don't have to choose between compression and correctness. The 4x improvement is multiplicative, not a replacement.
The Practical Use Cases
Three scenarios stand out where this technique has immediate value:
Cross-datacenter KV cache transfer. When you're running disaggregated prefill (computing the prompt on one GPU cluster, generating tokens on another), the KV cache has to cross a network link. At 4x compression, a cache that was 10GB becomes 2.5GB. That's the difference between a viable architecture and a bandwidth bottleneck.
Expanded prefix caching. If you're caching system prompts or retrieved documents in host RAM, 4x compression means 4x more cached prefixes. For RAG applications where the same context appears across thousands of requests, this directly translates to fewer cache misses and lower latency.
PCIe offloading. When you swap KV caches between GPU and CPU memory, bandwidth is the bottleneck. Trading compute (decompression) for reduced bandwidth usage is a favorable exchange on modern hardware where compute is abundant but PCIe lanes are not.
The Catch
There are real limitations, and the HN discussion surfaced them well.
The predictor model still needs to run a forward pass on the prompt. For short prompts, this overhead might negate the compression benefit. The method shines when the prompt is long enough that the compressed cache savings dwarf the predictor's compute cost.
There's also a hardware compatibility requirement. The arithmetic coder needs bit-identical predictor outputs across encoder and decoder. Different GPU architectures, different floating-point rounding, even different compiler versions can cause the predictor to produce slightly different values. This means the encoder and decoder must run on matching hardware, or you need additional synchronization overhead.
And the quadratic complexity concern is valid. As one HN commenter pointed out, recomputing the draft KV cache is still O(n^2) in context length. The compression helps with storage and transfer, but it doesn't reduce the initial computation cost.
What Surprised Me
The scaling behavior. I expected compression rates to plateau as models got larger. Instead, they improve. A 32B model compresses to 3.90x while a 0.6B model only hits 3.08x. The reason: larger models have more structured, predictable KV caches. Their quantized counterparts capture more of the signal, leaving less residual for the arithmetic coder to handle.
This suggests a counterintuitive future: as models grow, the compression gap between lossy and lossless methods narrows. The bigger the model, the less you lose by going lossless. That's the opposite of what most people assume about compression and scale.
The writing quality deserves a mention too. One HN commenter noted that the blog post was so crisp an LLM could never have written it. That's both a compliment to Finn and a quietly devastating observation about where AI-generated technical content still falls short. The post explains entropy coding, arithmetic coding, and Gaussian mixture models in a way that's rigorous without being dense. That's rare.
Sources
- https://fergusfinn.com/blog/kv-entropy-coder (main blog post)
- https://news.ycombinator.com/item?id=48400151 (HN discussion, 127 points)
- https://arxiv.org/html/2605.17613v1 (VeriCache paper)
- https://research.google/blog/turboquant-redefining-ai-efficiency-with-extreme-compression (TurboQuant)
- https://machinelearning.apple.com/research/quantspec (Apple QuantSpec)
- https://www.morphllm.com/llm-inference-optimization (inference optimization guide)