arXiv:2602.01901cs.CV2026-02AAAI

通过复用前层注意力,减少多模态大模型推理开销。

Q Cache: Visual Attention is Valuable in Less than Half of Decode Layers for Multimodal Large Language Model

论文配图:Q Cache: Visual Attention is Valuable in Less than Half of Decode Layers for Multimodal Large Language Model
图 1 · 摘自论文原文
  • 发现超过一半解码层注意力语义相似,可跨层复用。
  • 提出Q Cache机制,降低35%缓存占用,提速1.5倍。
  • 兼容现有框架,适合追求高效推理的开发者使用。

多模态大语言模型(MLLMs)因视觉编码器产生大量视觉标记而面临高昂的推理成本。冗余视觉标记导致显著计算负担和键值(KV)缓存瓶颈。现有方法聚焦于标记级优化,采用复杂的标记剪枝技术消除非关键视觉标记,但常破坏KV缓存完整性,影响长文本生成。为此,我们从新视角深入分析模型注意力机制,发现超过一半解码层的注意力具有语义相似性。据此,我们提出懒惰注意力(Lazy Attention),通过继承前层注意力实现跨层共享,有效减少层间冗余计算。设计了专为MLLMs定制的轻量级层共享缓存Q Cache,支持相邻层查询复用。Q Cache与Flash Attention及传统KV缓存完全兼容。该方法高度灵活,可独立部署或与标记剪枝结合。在多个基准测试中,本方法使KV缓存使用减少超35%,吞吐提升1.5倍,性能仅下降约1%。相比当前最优标记级方法,准确率保持更优。

原文摘要 · Abstract (English)

Multimodal large language models (MLLMs) are plagued by exorbitant inference costs attributable to the profusion of visual tokens within the vision encoder. The redundant visual tokens engenders a substantial computational load and key-value (KV) cache footprint bottleneck. Existing approaches focus on token-wise optimization, leveraging diverse intricate token pruning techniques to eliminate non-crucial visual tokens. Nevertheless, these methods often unavoidably undermine the integrity of the KV cache, resulting in failures in long-text generation tasks. To this end, we conduct an in-depth investigation towards the attention mechanism of the model from a new perspective, and discern that attention within more than half of all decode layers are semantic similar. Upon this finding, we contend that the attention in certain layers can be streamlined by inheriting the attention from their preceding layers. Consequently, we propose Lazy Attention, an efficient attention mechanism that enables cross-layer sharing of similar attention patterns. It ingeniously reduces layer-wise redundant computation in attention. In Lazy Attention, we develop a novel layer-shared cache, Q Cache, tailored for MLLMs, which facilitates the reuse of queries across adjacent layers. In particular, Q Cache is lightweight and fully compatible with existing inference frameworks, including Flash Attention and KV cache. Additionally, our method is highly flexible as it is orthogonal to existing token-wise techniques and can be deployed independently or combined with token pruning approaches. Empirical evaluations on multiple benchmarks demonstrate that our method can reduce KV cache usage by over 35% and achieve 1.5x throughput improvement, while sacrificing only approximately 1% of performance on various MLLMs. Compared with SOTA token-wise methods, our technique achieves superior accuracy preservation.

多模态注意力缓存优化推理加速

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