Tail-Replay: Escaping the Curse of Linear Attention in Prefix Caching for Hybrid LLMs
cs.LG, cs.AI
Submitted: 2026-08-31
Updated: 2026-10-15
License: http://creativecommons.org/licenses/by/4.0/
The gist: Hybrid large language models interleave full-attention layers with linear-attention layers to reduce the cost of long-context inference.
Terminology
Abstract
Hybrid large language models interleave full-attention layers with linear-attention layers to reduce the cost of long-context inference. This structure complicates prefix caching: full-attention key-value caches are token-addressable, whereas linear-attention layers maintain recurrent states that cannot be rolled back to arbitrary prefix boundaries. Existing hybrid prefix caching methods address this mismatch by storing recurrent-state checkpoints. As a result, token-level matches are directly usable only at positions aligned with stored checkpoints, constraining prefix reuse to a discrete set of boundaries. We present Tail-Replay, a prefix caching mechanism that enables unconstrained token-level prefix reuse in hybrid large language models. The key insight is that linear-attention mechanisms such as Gated DeltaNet can be viewed as a structured, lossy compression of the input prefix: gated recurrent updates progressively attenuate the contributions of earlier inputs. Consequently, the recurrent state of a matched prefix can be well approximated by replaying only a short, recent suffix of that prefix. Tail-Replay exploits this property by caching the exact full-attention key-value cache while omitting recurrent-state checkpoints. On a cache hit, it reconstructs the linear-attention states by replaying a short, recent suffix of the matched prefix. As a result, the reuse boundary is determined by the shared tokens rather than by recurrent-state checkpoints. We evaluate Tail-Replay on three Gated DeltaNet-based hybrid models using the LongBench and RULER benchmarks. With only a 5--10% replay budget, it retains 92.8--99.9% of full-prefill quality on LongBench and RULER. For serving efficiency, we evaluate time-to-first-token speedups across multiple matched-prefix lengths---8K, 16K, and 32K. The speedup grows with prefix length, reaching 9.1 -- 14.3 times over full prefill at 32K.
Sources
- LongBench: A Bilingual, Multitask Benchmark for Long Context Understanding
- Cost-Efficient Large Language Model Serving for Multi-turn Conversations with CachedAttention
- Prompt Cache: Modular Attention Reuse for Low-Latency Inference
- MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework
- RULER: What's the Real Context Size of Your Long-Context Language Models?
- EPIC: Efficient Position-Independent Caching for Serving Large Language Models
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
- Jamba: A Hybrid Transformer-Mamba Language Model
- HYPIC: Accelerating Hybrid-Attention LLM Serving with Position-Independent Caching
- LinearKV: One Cached State Suffices for Position-Independent Caching in Hybrid LLMs
- Olmo Hybrid: From Theory to Practice and Back
- MiniMax-01: Scaling Foundation Models with Lightning Attention
- Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Models
- Training language models to follow instructions with human feedback
- Marconi: Prefix Caching for the Era of Hybrid LLMs
- Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving
- Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling
- Sparse Prefix Caching for Hybrid and Recurrent LLM Serving
- ProphetKV: User-Query-Driven Selective Recomputation for Efficient KV Cache Reuse in Retrieval-Augmented Generation
- Gated Delta Networks: Improving Mamba2 with Delta Rule
Related papers
- Polynomial-Augmented Neural Networks (PANNs) with Weak Orthogonality Constraints for Enhanced Function and PDE Approximation
- AIRL-S: Unifying Reinforcement Learning and Search-Based Test-Time Scaling via Adversarial Inverse Reinforcement Learning
- Transformers as Bayesian In-Context Experimenters: Smoothness-Adaptive Efficient ATE Estimation
- Convergence issues in Relational Concept Analysis based on AOC-posets
- Beliefs Beyond Posteriors: The Predictive Cost of ELBO Binding
- Understanding Diffusion Models via Ratio-Based Function Approximation with SignReLU Networks