arXiv:2508.15212cs.CLcs.AI2025-08AAAI被引 6

通过动态恢复通道级稀疏的键值缓存,实现长序列推理的高效与高精度兼顾。

SparK: Query-Aware Unstructured Sparsity with Recoverable KV Cache Channel Pruning

  • 按通道维度动态剪枝键值缓存,保留重要特征信息。
  • 在相同内存下支持更长序列,存储量减少超30%。
  • 兼容现有压缩方法,80%剪枝率仍保持低性能损失。

大语言模型在长序列推理中受键值(KV)缓存瓶颈制约:内存占用随序列长度线性增长,注意力计算量则呈平方级上升。现有方法通过删除或合并历史令牌来压缩KV缓存,但忽略了特征维度(即通道轴)上的细粒度重要性差异,限制了效率与准确性的平衡。我们观察到,不同查询和位置下通道显著性差异极大——某些通道对特定查询几乎无信息量,而另一些则高度相关。为此,提出SPARK,一种无需训练的即插即用方法,通过通道级非结构化稀疏剪枝降低冗余,同时在注意力计算时动态恢复被剪枝项。该方法与现有压缩、量化技术正交,可集成以进一步加速。通过消除通道级冗余,SPARK在相同内存预算下可处理更长序列;对于等长序列,其不仅保持或提升模型精度,且相较基于删除的方法减少超过30%的缓存存储。即使采用80%的激进剪枝率,性能下降也仅约5%,显著优于基线方法,体现强大鲁棒性与有效性。

原文摘要 · Abstract (English)

Long-context inference in large language models (LLMs) is increasingly constrained by the KV cache bottleneck: memory usage grows linearly with sequence length, while attention computation scales quadratically. Existing approaches address this issue by compressing the KV cache along the temporal axis through strategies such as token eviction or merging to reduce memory and computational overhead. However, these methods often neglect fine-grained importance variations across feature dimensions (i.e., the channel axis), thereby limiting their ability to effectively balance efficiency and model accuracy. In reality, we observe that channel saliency varies dramatically across both queries and positions: certain feature channels carry near-zero information for a given query, while others spike in relevance. To address this oversight, we propose SPARK, a training-free plug-and-play method that applies unstructured sparsity by pruning KV at the channel level, while dynamically restoring the pruned entries during attention score computation. Notably, our approach is orthogonal to existing KV compression and quantization techniques, making it compatible for integration with them to achieve further acceleration. By reducing channel-level redundancy, SPARK enables processing of longer sequences within the same memory budget. For sequences of equal length, SPARK not only preserves or improves model accuracy but also reduces KV cache storage by over 30% compared to eviction-based methods. Furthermore, even with an aggressive pruning ratio of 80%, SPARK maintains performance with less degradation than 5% compared to the baseline eviction method, demonstrating its robustness and effectiveness. Our code will be available at https://github.com/Xnhyacinth/SparK.

KV缓存稀疏化长序列推理大模型

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