提出针对视觉语言模型的缓存压缩方法,大幅降低内存占用并加速推理。
VL-Cache: Sparsity and Modality-Aware KV Cache Compression for Vision-Language Model Inference Acceleration
- 按层自适应分配缓存预算,结合视觉与文本令牌的稀疏特性。
- 仅保留10%缓存即可保持接近全量精度,内存减少90%。
- 适合需要高效推理的多模态大模型部署场景。
视觉语言模型(VLMs)在多种任务中表现卓越,但其推理加速面临存储和访问长视觉上下文(如图像或视频)所生成的大规模键值(KV)缓存的挑战。现有针对大语言模型(LLMs)的缓存压缩方法直接迁移至VLMs时,性能和加速效果均不理想。为此,我们提出专为VLM推理加速设计的VL-Cache方法。通过分析预填充和解码阶段中视觉与文本令牌的特殊稀疏模式,我们提出一种层自适应的稀疏感知缓存预算分配机制,有效将有限缓存预算分配至不同层,显著减小缓存体积且不损失精度。此外,设计了模态感知的令牌重要性评分策略。多个基准数据集上的实证结果表明,仅保留10%的KV缓存即可达到与全量缓存相当的准确率。在端到端生成100个标记的速度测试中,该方法最高提升2.33倍,解码速度最快提升7.08倍,同时使GPU上KV缓存内存占用降低90%。
原文摘要 · Abstract (English)
Vision-Language Models (VLMs) have demonstrated impressive performance across a versatile set of tasks. A key challenge in accelerating VLMs is storing and accessing the large Key-Value (KV) cache that encodes long visual contexts, such as images or videos. While existing KV cache compression methods are effective for Large Language Models (LLMs), directly migrating them to VLMs yields suboptimal accuracy and speedup. To bridge the gap, we propose VL-Cache, a novel KV cache compression recipe tailored for accelerating VLM inference. In this paper, we first investigate the unique sparsity pattern of VLM attention by distinguishing visual and text tokens in prefill and decoding phases. Based on these observations, we introduce a layer-adaptive sparsity-aware cache budget allocation method that effectively distributes the limited cache budget across different layers, further reducing KV cache size without compromising accuracy. Additionally, we develop a modality-aware token scoring policy to better evaluate the token importance. Empirical results on multiple benchmark datasets demonstrate that retaining only 10% of KV cache achieves accuracy comparable to that with full cache. In a speed benchmark, our method accelerates end-to-end latency of generating 100 tokens by up to 2.33x and speeds up decoding by up to 7.08x, while reducing the memory footprint of KV cache in GPU by 90%.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。