TL;DR
Serving modern "hybrid" LLMs—which mix standard Transformer attention with recurrent, Mamba-style layers—hits a sneaky bottleneck when trying to reuse past computations (prefix caching): recurrent states are far too massive to save at every token, forcing systems to constantly pause and recompute missing states from scratch. HybridCache solves this granularity mismatch by recognizing that many recurrent heads barely change over short intervals and can be safely reused, while shrinking the ones we do save using a clever two-dimensional compression trick. The result is dramatically faster response times and higher serving throughput without sacrificing model accuracy.
What Problem Does This Paper Address?
If you ask an LLM ten questions about the same 50-page PDF, you don’t want it reading the PDF from scratch ten times. In standard Transformers, prefix caching solves this by saving Key-Value (KV) tensors at every token so shared prefixes can be reused instantly.
Recently, however, architectures have shifted toward hybrid linear–softmax models (like Qwen-3.5, Kimi-Linear, and Nemotron-3), which blend standard softmax attention with linear attention or state-space layers. While great for sequence scaling, linear attention layers maintain a matrix-valued recurrent state summarizing the entire history. Storing these states at every token is memory suicide: caching just 1,024 tokens of recurrent states for Qwen-3.5 (35B-A3B) consumes 460 GB—roughly 3,000× larger than its KV cache!
To avoid running out of memory, serving engines like vLLM and SGLang only save recurrent states at coarse checkpoints (e.g., chunk boundaries). This creates a granularity mismatch: a new request might hit the fine-grained KV cache at token 950, while the nearest saved recurrent state sits back at token 512. The engine is forced to replay 438 tokens just to rebuild the missing state, gutting cache hit rates and stalling latency.
Methods
HybridCache bridges the gap between token-level KV caches and coarse recurrent checkpoints using two novel mechanisms integrated directly into SGLang via custom fused GPU (Triton) kernels:
- Recurrent-Aware State Reuse: Instead of treating all attention heads equally, HybridCache selectively caches only the top-$K$ head states that deviate significantly from prior checkpoints. For heads that weren't saved at a matched token position, how do we know if an older state is safe to reuse without computing the new one first? During prefill, HybridCache collects lightweight, chunk-level decay and write statistics. At retrieval time, it uses a mathematical estimator (derived via the triangle inequality on the recurrent update rule) to bound how much the missing state could have drifted. If the estimated drift is below a threshold $\sigma$, it reuses the old state; otherwise, it safely falls back to recomputation.
- Dual-Scale State Quantization: Standard single-scale 4-bit quantization struggles with recurrent states because recurrent updates rely on outer products ($k_t^\top v_t$). A single outlier channel in a key or value smears extreme numbers across an entire row and column of the state matrix. HybridCache introduces two successive, orthogonal FP16 scaling steps—normalizing groups of size $G=16$ along rows first, then columns—before packing values into FP4. This shrinks states down to 6 effective bits per element (a 5.3× compression over FP32, or 2.7× over BF16) with under 0.17 ms of round-trip kernel latency.
Datasets
The authors evaluate HybridCache (no training required) across four realistic serving benchmarks—none newly introduced here—chosen to stress-test shared prefixes and reasoning:
- DeepPlanning: Long-horizon agentic planning with verifiable constraints.
- RULER (65K to 918K context): Long-context retrieval and comprehension.
- ZebraLogic & LongProc: Logical reasoning and long procedural generation benchmarks.
Key Insights and Ideas
- Decay gates don't tell the whole story: You might assume a head's decay factor alone tells you if an old state is stale. The authors note that state stability depends on both historical decay and the magnitude of new incoming writes—motivating their combined deviation estimator.
- Outer products create 2D grid outliers: Unlike KV caches where outliers are mostly channel-isolated, linear attention's outer-product updates create crisscrossing row-and-column outlier ridges. Scaling along just one axis leaves the orthogonal axis vulnerable to quantization error; orthogonal dual-scaling tames both simultaneously.
- Eviction policies aren't enough: Prior hybrid caching systems (like Marconi) focused on which coarse checkpoints to evict or keep. HybridCache shows that without fixing the underlying head-level granularity mismatch, eviction-only strategies leave massive latency gains on the table.
Key Results
Tested across five hybrid models (Qwen-3.5 35BA3B / 122BA10B / 397BA17B, Kimi-Linear, and Nemotron-3-Nano), HybridCache delivers major efficiency wins while preserving task accuracy:
- Doubled Cache Hits & Slashed TTFT: On RULER-98K, HybridCache boosts cache hit rates on Kimi-Linear from 47.63% to 95.13%, cutting Time-To-First-Token (TTFT) by 5.2× (from 3.29s down to 0.63s). On Qwen-35BA3B, hit rates double from 33.86% to 67.61% (TTFT drops from 0.93s to 0.66s).
- Scales with Model Size: On the massive Qwen-397BA17B, TTFT drops by 43% (2.47s to 1.41s) with slightly higher accuracy (98.08% vs. 97.69%).
- Outperforms Existing Strategies: On RULER-98K (Qwen-35BA3B), HybridCache achieves 0.66s TTFT at 97.56% accuracy, beating vLLM (0.98s) and Marconi (0.92s) while avoiding the accuracy collapse seen in naive state reuse (94.26%) or single-scale INT4 quantization (95.38%).
Limitations and Future Work
While the paper does not include a standalone limitations section, several nuances emerge from the analysis:
- Chunk-bound estimator is heuristic: Because token-level writes within a chunk can cancel each other out, the chunk-level deviation score is a practical estimator rather than a strict mathematical upper bound.
- Non-additive component speedups: In ablations, Dual-Scale Quantization alone achieved a slightly faster TTFT (0.52s) than the full combined system (0.66s), showing that combining selective reuse metadata and quantization doesn't yield purely additive latency reductions.
- Occasional task sensitivity: While accuracy holds steady on long-context and reasoning tasks, agentic planning (DeepPlanning) showed minor accuracy dips on certain models (e.g., Kimi-Linear dropping from 24.17% to 19.67%). Future directions are not explicitly discussed in the paper.
Summary updated