DynaCalKV: Key-Value Cache Compression via Head Grouping and Adaptive Rank Allocation

📄 arXiv: 2607.24331v1 📥 PDF

作者: Tan T. Nguyen, Quan V. Dang

分类: cs.LG

发布日期: 2026-07-27


💡 一句话要点

提出DynaCalKV以解决长上下文窗口中的KV缓存瓶颈问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 KV缓存 低秩压缩 注意力机制 参数优化 长上下文处理 模型性能提升

📋 核心要点

  1. 现有方法未能有效区分键和值缓存的处理,导致性能未能充分优化。
  2. 本文提出通过CKA相似性动态分组注意力头,并自适应分配秩预算的方法,提升KV缓存的压缩效果。
  3. 实验结果显示,该方法在多头注意力模型中表现尤为突出,且在长上下文设置下效果显著。

📝 摘要(中文)

随着大型语言模型(LLMs)推理阶段需要处理长上下文窗口,键值(KV)缓存最初看似能应对这一挑战,但随着上下文窗口的不断增长,最终成为显著的瓶颈。近期研究表明,低秩压缩是一种有效的减少KV缓存内存的方法,同时保持模型性能。然而,现有方法对键和值缓存的处理往往不够区分,且通常采用固定的注意力头分组,未能充分利用注意力头之间的结构相似性。本文提出了一种改进的低秩KV缓存压缩框架,通过基于中心核对齐(CKA)相似性动态分组注意力头,并在参数预算下自适应分配秩预算,从而提高重构质量。实验结果表明,该方法在保持竞争性准确度的同时,减少了键缓存参数数量。

🔬 方法详解

问题定义:本文旨在解决大型语言模型推理阶段中KV缓存的性能瓶颈,现有方法对键和值缓存的处理缺乏区分,且固定的注意力头分组未能充分利用其结构相似性。

核心思路:提出了一种改进的低秩KV缓存压缩框架,通过动态分组注意力头和自适应秩分配来优化缓存性能,确保在减少参数的同时保持模型的准确性。

技术框架:整体架构包括两个主要模块:键缓存和值缓存。键缓存通过CKA相似性动态分组注意力头,而值缓存则采用离线校准的方法来优化低秩分解。

关键创新:最重要的创新在于对键和值缓存的不同处理方式,以及动态分组注意力头的策略,这与现有方法的固定分组方式形成了显著区别。

关键设计:在参数设置上,采用了基于CKA相似性的动态分组策略,并在值缓存中引入了离线校准技术,以提高重构质量和模型性能。实验中还观察到在多头注意力模型中效果更佳。

🖼️ 关键图片

fig_0
img_1
img_2

📊 实验亮点

实验结果表明,DynaCalKV方法在三个指令调优的LLM上显著减少了键缓存参数数量,同时保持了竞争性的准确度。特别是在多头注意力模型中,性能提升尤为明显,而在分组查询注意力模型中则需更为谨慎应用,尤其是在长上下文设置下。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理、对话系统和智能助手等,能够有效提升大型语言模型在长上下文处理中的性能,具有重要的实际价值和未来影响。通过优化KV缓存,模型在处理复杂任务时能够更高效,响应速度更快。

📄 摘要(原文)

As the inference phase of Large Language Models (LLMs) requires handling long context windows, the Key-Value (KV) cache initially appears to address this challenge but eventually becomes a significant bottleneck as the context window continues to grow. Low-rank compression has recently been studied as an effective approach to reduce KV cache memory while maintaining model performance. However, only a few existing methods treat the Key and Value caches differently, despite their distinct roles. Moreover, these methods typically employ fixed attention-head grouping, which may not fully exploit the structural similarity among attention heads. In this paper, we propose an improved low-rank KV cache compression framework. For the Key cache, we dynamically group attention heads based on Centered Kernel Alignment (CKA) similarity and allocate the rank budget adaptively under a parameter budget. For the Value cache, we adopt the same approach as ReCalKV, refining the low-rank decomposition through offline calibration to improve reconstruction quality. Experimental results on three instruction-tuned LLMs show that our method reduces the number of Key cache parameters while maintaining competitive accuracy. We further observe that the proposed strategy is particularly effective for Multi-Head Attention (MHA) models, whereas it should be applied more conservatively to Grouped-Query Attention (GQA) models, especially in long-context settings.