arXiv:2605.05219cs.LGcs.AI2026-05被引 2

通过稀疏存储状态点,提升长文本问答中共享前缀的推理速度。

Sparse Prefix Caching for Hybrid and Recurrent LLM Serving

论文配图:Sparse Prefix Caching for Hybrid and Recurrent LLM Serving
图 1 · 摘自论文原文
  • 只在关键位置存递归状态,缓存命中时从最深节点恢复并精确重算后缀。
  • 在真实数据上优于固定预算的基线方法,低缓存开销下性能更优。
  • 适合大量请求共享部分前缀的场景,兼容现有压缩技术。

前缀缓存是自回归大模型服务中的关键延迟优化手段,但现有系统假设按每个词元密集复用键值对。状态空间模型改变了问题结构:一个循环层可从单个存储状态恢复,无需完整词元历史。这种不对称性带来新设计空间——在稀疏检查点位置存储精确的递归状态,缓存命中时从最深存储检查点恢复并精确重算剩余后缀。我们形式化了稀疏前缀缓存为重叠深度分布下的检查点放置问题,得出精确的O(NM)动态规划解法。在请求共享非平凡前缀(如对同一长文档提问)的场景下,我们的方法在真实数据上持续优于标准启发式算法的帕累托前沿。在QuALITY和System Prompts数据集上,分布感知的放置策略在测量层组帕累托前沿上全面超越所有固定预算基线,性能匹配或超过最强启发式(块缓存),且通常使用更少检查点,尤其在低检查点预算、重叠分布不均匀时提升最大。该方法适用于许多请求共享较大但不完全相同的前缀的场景,保持输出精确性,不改变循环计算逻辑,无需新更新核函数,适用于可精确提取与恢复隐藏状态的循环/SSM层,且可与现有KV缓存压缩技术结合用于混合模型。

原文摘要 · Abstract (English)

Prefix caching is a key latency optimization for autoregressive LLM serving, yet existing systems assume dense per-token key/value reuse. State-space models change the structure of the problem: a recurrent layer can resume from a single stored state rather than requiring the entire token history. This asymmetry opens a new design point between no reuse and dense caching: store exact recurrent states at a sparse set of checkpoint positions and, on a cache hit, resume from the deepest stored checkpoint and recompute the remaining suffix exactly. We formalize sparse prefix caching as checkpoint placement under a distribution over overlap depths, yielding an exact O(NM) dynamic program. For use cases where requests share a non-trivial prefix (e.g. asking different questions about a single long document), we show that our method consistently improves the Pareto frontier traced by standard heuristics on real-world data. Across QuALITY and System Prompts, distribution-aware placement dominates every fixed-budget baseline on the measured layer-group Pareto frontier and matches or outperforms the strongest heuristic (block caching) while typically using substantially fewer checkpoints, with the largest gains at low checkpoint budgets where the overlap distribution is most non-uniform. The method is most relevant when many requests share a substantial but not identical prefix within a retained cache entry. It preserves exact outputs, does not change the recurrent computation itself or require new recurrent update kernels, applies to recurrent/SSM layers whose hidden state can be extracted and restored exactly, and for hybrid models can be combined with existing KV-cache compression techniques.

大模型推理缓存优化状态空间模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。