Skip to content

KV Cache Compression: Three Ways to Stop Paying for Every Token Twice

#kv-cache #long-context #quantization #linear-attention #inference-optimization

KV Cache Compression: Three Ways to Stop Paying for Every Token Twice ​

The bill arrives at 1M tokens ​

Every token you feed a decoder costs memory twice. Once during attention, and again forever after, because the KV cache keeps it around for every subsequent step.

At 4K context nobody notices. At 1M, the cache becomes the largest allocation in your process. Run the arithmetic for a 4B model with grouped-query attention: 32 layers, 8 KV heads, head dimension 128, fp16 storage. That works out to roughly 128 KB of K and V per token, which is over 100 GB for a single million-token sequence. The weights are 8 GB. The cache is thirteen times the model.

Three papers landed this month with three different answers to the same question. MemOnce changes where the cache lives. QuantStream3D changes how precisely it's stored. Turnout changes which layers get one at all. None of them are drop-in, and all three are worth understanding, because the tricks generalize well beyond the exact systems they were built for.

Three papers, one target ​

MemOnceQuantStream3DTurnout
What it changesWhere the cache livesHow precisely the cache is storedWhich layers keep a cache
MechanismFinal-layer hidden states kept as compact memory, decoded back into per-layer KV on demandGeometry-guided mixed precision, mostly 2-bit, with quantization-aware distillationFrozen full-attention path plus a distilled linear path, switched per layer by a learned policy
Headline result1313× smaller memory state cache, 6.9× faster prefill at 1M context5.05× physical KV compression, 23.1% lower latency at batch 1Better accuracy-memory Pareto frontier than fixed switching or static hybrids on reasoning tasks
DomainLanguage models, continual interactionStreaming visual geometry transformersReasoning models with long generations
What it costs youAn extra decoder running inside the attention pathPer-backbone calibration and distillationTwo attention paths alive in one serving batch

The interesting part is that they don't compete. MemOnce is a pre-training architecture decision. QuantStream3D is a post-training compression pipeline. Turnout is a runtime routing policy on top of a distillation step. You could stack the ideas if your serving stack had the stomach for it.

MemOnce: keep the states, rebuild the caches ​

The observation behind MemOnce is that per-layer, per-token KV caches are wildly redundant. What you actually need to carry forward is a summary of what happened, not a verbatim transcript per layer.

So MemOnce caches only a small subset of final-layer hidden states as memory representations. When an attention layer needs its KV, a memory decoder reconstructs it from those states on the fly.

The second design is the one that saves wall-clock time. Sparse retrieval picks which memory representations are relevant, and the sparse indices are computed once and shared across every layer. Recomputing top-k per layer per head is where retrieval overhead normally eats the theoretical gain, so sharing the index is a real systems decision, not a detail.

The numbers, on Qwen3.5-4B adapted with MemOnce at 1M context: 1313× reduction in memory state cache, 6.9× faster prefill, 3.5× higher throughput. Translated into hardware: a cache that would have occupied over 100 GB on a single sequence now fits comfortably under 100 MB, which is the difference between needing an eight-GPU node and running on one card. Prefill latency down 6.9× means a million-token prompt processes in the time 145k tokens used to take, which changes whether long-document ingestion is interactive or batch.

The honest caveat is recall fidelity. You're reconstructing KV from a lossy summary, and the paper reports a +5.77% improvement on a composite memory score rather than parity on exact retrieval. For agents that re-read their own history, that's fine. For tasks that hinge on one specific token from 800k positions ago, verify it yourself.

Quick Take: all three papers agree the KV cache is over-provisioned, and they disagree only about which axis to cut: storage location, bit width, or layer count.

The numbers, with the context they need ​

Key Numbers

  • MemOnce at 1M context on Qwen3.5-4B: 1313× smaller memory state cache, 6.9× lower prefill latency, 3.5× higher throughput.
  • QuantStream3D: 5.05× physical KV compression at predominantly 2-bit, 23.1% lower latency at batch size 1.
  • Same GPU, fixed memory budget: 5.4× the maximum batch size and 1.67× peak throughput versus unquantized inference.
  • QuantStream3D versus LLM-oriented KV quantizers: 57.4% lower TUM absolute trajectory error, 69.7% lower NeuralRGBD completeness error.

QuantStream3D: the geometry heads fail before the pixels do ​

QuantStream3D starts from a system that already has an unusual cache: a streaming visual geometry transformer keeps historical KV as cross-view geometric memory, so the cache holds correspondences between camera frames rather than conversational context.

The paper identifies two failure modes that generic KV quantizers walk straight into. First, nonuniform geometric sensitivity: some cache entries carry far more weight than others, and which ones depends on the scene. Uniform bit-width wastes precision on entries that don't matter and destroys entries that do. Second, cache-geometry mismatch: perturbed retrieval changes the inputs to the geometry heads, which then write new, already-corrupted KV into the cache for future frames. Error compounds through the write path, not just the read path.

The fix is a two-part pipeline. Geometry-guided mixed precision protects sensitive cross-view evidence. Geometry-aligned quantization-aware distillation trains transformer blocks and geometry heads jointly on student-generated quantized history, so the network learns to operate on the noisy cache it will actually see at inference time.

That last choice is the transferable one. Most quantization-aware training pipelines distill on clean teacher states and then deploy on quantized ones, and the distribution shift quietly costs accuracy.

A 57.4% reduction in trajectory error against an LLM-derived quantizer is the strongest argument in the paper. It means the sensitivity structure of your cache is domain-specific, and borrowing a calibrator from a language model is an expensive shortcut. The paper also reports several configurations beating unquantized inference, which I'd attribute partly to the distillation step retraining the geometry heads rather than to quantization being magic.

Turnout: not every layer needs a cache ​

Linear attention variants replace the growing KV cache with a fixed-size state. Memory stops growing. Accuracy drops, and it drops hardest on reasoning tasks, where a chain of thought routinely runs 30k tokens and needs exact recall of premises stated at token 200.

Turnout's approach is to have both. Take a pretrained full-attention model, freeze the original attention path, and distill a parallel linear path through it. At generation time, a learned policy decides per layer whether to run full or linear attention. The policy is trained with reinforcement learning on a reward that trades answer correctness against memory consumption.

What I like here is that memory becomes a runtime knob instead of a training-time commitment. Static hybrids fix the full-to-linear ratio when you build the model; Turnout lets the same checkpoint serve a latency-critical request at aggressive switching and a correctness-critical request at conservative switching.

The evaluation shows a better accuracy-efficiency Pareto frontier than fixed switching and static hybrids on reasoning tasks. What it doesn't show is a serving-engine story. Mixed full and linear layers inside a single batch is exactly the kind of thing that falls over in production, because your attention kernel now needs two code paths and a per-layer dispatch.

What trips people up ​

Measuring prefill and calling it a day. All three papers lead with prefill latency or steady-state memory. The cost that bites in serving is decode, where MemOnce rebuilds caches every step and Turnout dispatches attention per layer per token. Benchmark at your real decode batch size, not batch 1.

Treating bit width as the compression ratio. A 2-bit cache sounds like 8× over fp16. QuantStream3D reports 5.05× physical compression because per-group scales, outlier handling, and alignment padding all take a cut. Budget from the physical number or your memory plan will come up short.

Reusing an LLM calibrator on a non-LLM cache. The 57.4% trajectory error gap is what domain-mismatched sensitivity costs. If your cache stores spatial or temporal structure, calibrate on that structure.

Distilling on clean history. Training the student on full-precision teacher states and deploying it on quantized history creates a distribution shift the model never saw. QuantStream3D trains on student-generated quantized history for a reason.

Forgetting that the write path matters. In streaming geometry, a recall error doesn't just degrade the current frame. It changes the geometry heads' inputs, which corrupts the KV written for later frames. Any compression scheme for streaming models needs to be evaluated over long rollouts, not single frames.

Choosing between them ​

These aren't three options on a menu, so the question isn't which one wins.

If you're training a model from scratch for long-horizon interaction, MemOnce's design is the one that changes the shape of the curve. Linear growth becomes constant, and the 1313× figure is the headline. Budget engineering time for the decoder path, because you're adding compute inside the attention loop.

If you have an existing model and need memory headroom this quarter, the QuantStream3D lesson applies even outside geometry: sensitivity-aware mixed precision plus distillation on quantized history is the highest-return combination of the three techniques, and it doesn't require touching pretraining.

If you're serving a reasoning model and want to choose your position on the accuracy-memory curve per request, Turnout is the only one of the three that gives you that. Check your inference stack can batch mixed attention layers before you count on it.

One thing I'd push back on across all three: the reported gains are measured against strong full-attention baselines at extreme context lengths. At 32k tokens, where most production traffic actually lives, the cache is a few gigabytes and none of these techniques are worth the integration cost.

One thing to remember ​

The failure mode that separates good compression from bad is the write path. Turnout's policy can flip a layer to linear attention and permanently degrade the cache that layer writes back; QuantStream3D's error compounds because geometry heads consume corrupted retrieval and emit corrupted KV. Compression schemes that only reason about read-side fidelity look fine on a single frame or a single turn and then decay over a rollout, which is why the papers that get this right evaluate over long sequences rather than per-step perplexity.

The bottom line ​

Building a long-context agent on a 4B-class model, where the cache and not the weights is your capacity ceiling: MemOnce is the only approach here that changes the asymptotic shape, so it's worth the decoder-path integration cost if you're pre-training or doing heavy adaptation. For everyone else, wait for someone to ship it in a serving framework.

If your pipeline is streaming 3D geometry on a fixed GPU budget, go to 2-bit KV with geometry-aware mixed precision and distill on student-generated quantized history. Do not reuse an LLM KV calibrator, because the 57.4% trajectory error and 69.7% completeness gap is precisely the cost of that shortcut, and you can spend a week on calibration instead.

Running a reasoning model with 30k-token outputs and a latency SLO: Turnout's adaptive switching is the right idea and the RL policy is the right shape for it, but the blocker is kernel support for mixed attention paths in one batch. Until your serving engine can dispatch full and linear layers in the same step without falling back to eager mode, treat it as a design reference rather than a deployment plan.