arXiv:2603.11504cs.LGcs.CL2026-03被引 2

压缩推理模型的键值缓存,显著降低内存占用和计算压力。

LongFlow: Efficient KV Cache Compression for Reasoning Models

  • 利用注意力计算中间结果,高效估算缓存重要性,开销极低。
  • 在保持精度几乎不变的前提下,缓存压缩率达80%,吞吐提升11.8倍。
  • 适合长输出推理场景,尤其适用于数学与代码生成类大模型部署。

近期推理模型如 OpenAI-o1 和 DeepSeek-R1 在数学推理与代码生成等复杂任务中表现优异。然而,其长输出序列导致键值(KV)缓存大幅增加,带来显著的内存消耗和注意力计算带宽压力。现有缓存优化方法多针对长输入短输出场景,对长输出不适用;且以往的重要性估计计算成本高,在持续重估时难以承受。为此,我们提出 LongFlow,一种高效的 KV 缓存压缩方法,其重要性度量基于注意力计算的中间结果,仅使用当前查询即可完成,计算开销可忽略,无需额外存储。同时开发专用核函数,将 FlashAttention、重要性估计与令牌淘汰融合为单一优化算子,提升系统效率。实验表明,LongFlow 在实现 80% 缓存压缩的同时,模型吞吐最高提升 11.8 倍,对模型精度影响极小。

原文摘要 · Abstract (English)

Recent reasoning models such as OpenAI-o1 and DeepSeek-R1 have shown strong performance on complex tasks including mathematical reasoning and code generation. However, this performance gain comes with substantially longer output sequences, leading to significantly increased deployment costs. In particular, long outputs require large KV caches, resulting in high memory consumption and severe bandwidth pressure during attention computation. Most existing KV cache optimization methods are designed for long-input, short-output scenarios and are ineffective for the long-output setting of reasoning models. Moreover, importance estimation in prior work is computationally expensive and becomes prohibitive when continuous re-evaluation is required during long generation. To address these challenges, we propose LongFlow, a KV cache compression method with an efficient importance estimation metric derived from an intermediate result of attention computation using only the current query. This design introduces negligible computational overhead and requires no auxiliary storage. We further develop a custom kernel that fuses FlashAttention, importance estimation, and token eviction into a single optimized operator, improving system-level efficiency. Experiments show that LongFlow achieves up to an 11.8 times throughput improvement with 80% KV cache compression with minimal impact on model accuracy.

KV缓存推理优化大模型部署

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