arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.11504cs.LGcs.CL
收藏

LongFlow:用于推理模型的高效KV缓存压缩

LongFlow: Efficient KV Cache Compression for Reasoning Models

School of Computer Science and Technology, Soochow University, China(苏州大学计算机科学与技术学院)

Yi Su, Zhenxu Tian, Dan Qiao, Yuechi Zhou, Juntao Li, Min Zhang

AI总结:

LongFlow通过高效的重要性估计指标实现KV缓存压缩,减少内存消耗和带宽压力,提升推理模型的吞吐量和效率。

摘要:

最近的推理模型如OpenAI-o1和DeepSeek-R1在复杂任务如数学推理和代码生成上表现出色。然而,这种性能提升伴随着更长的输出序列,导致部署成本显著增加。特别是长输出需要大的KV缓存,导致注意力计算期间内存消耗高和带宽压力大。大多数现有的KV缓存优化方法针对长输入、短输出场景,对推理模型的长输出设置无效。此外,先前工作中的重要性估计计算成本高,当需要连续重新评估时变得不可行。为了解决这些挑战,我们提出了LongFlow,一种基于注意力计算中间结果的高效KV缓存压缩方法,仅使用当前查询即可获得重要性估计指标。该设计引入了极小的计算开销且不需要辅助存储。我们进一步开发了一个自定义内核,将FlashAttention、重要性估计和令牌驱逐融合为一个优化的操作符,提高了系统层面的效率。实验表明,LongFlow在80%的KV缓存压缩下实现了高达11.8倍的吞吐量提升,对模型精度影响极小。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑