通过动态稀疏化视觉令牌,显著提升大模型图文生成效率。
ZipVL: Efficient Large Vision-Language Models with Dynamic Token Sparsification
- 按层自适应分配重要令牌比例,动态优化计算
- 预填充阶段提速2.3倍,解码吞吐量提升2.8倍
- 适合高分辨率图像/视频场景的高效推理
大视觉语言模型(LVLMs)的效率受限于预填充阶段的注意力计算瓶颈和解码阶段的键值缓存内存瓶颈,尤其在处理高分辨率图像或视频时更为明显。视觉内容通常存在大量冗余,导致LVLM中注意力图高度稀疏。这种稀疏性可被利用来加速注意力计算或压缩KV缓存。然而,多数研究仅解决单一瓶颈,且难以动态调整不同层或任务的稀疏度。本文提出ZipVL,一种基于重要令牌动态比率分配的高效推理框架。该比率根据各层注意力分数分布自适应确定,而非固定超参数,从而在简单任务中提升效率,同时保障复杂任务性能。我们基于归一化注意力分数选取重要令牌,仅对这些令牌执行稀疏注意力,降低预填充延迟;将不重要令牌丢弃以减少KV缓存大小,缓解解码阶段内存压力。实验表明,ZipVL在LLaVA-Next-13B模型上使预填充阶段加速2.3倍,解码吞吐量提升2.8倍,仅带来0.5%的准确率下降(VQAv2基准),有效提升LVLM生成效率。
原文摘要 · Abstract (English)
The efficiency of large vision-language models (LVLMs) is constrained by the computational bottleneck of the attention mechanism during the prefill phase and the memory bottleneck of fetching the key-value (KV) cache in the decoding phase, particularly in scenarios involving high-resolution images or videos. Visual content often exhibits substantial redundancy, resulting in highly sparse attention maps within LVLMs. This sparsity can be leveraged to accelerate attention computation or compress the KV cache through various approaches. However, most studies focus on addressing only one of these bottlenecks and do not adequately support dynamic adjustment of sparsity concerning distinct layers or tasks. In this paper, we present ZipVL, an efficient inference framework designed for LVLMs through a dynamic ratio allocation strategy of important tokens. This ratio is adaptively determined based on the layer-specific distribution of attention scores, rather than fixed hyper-parameters, thereby improving efficiency for less complex tasks while maintaining high performance for more challenging ones. Then we select important tokens based on their normalized attention scores and perform sparse attention mechanism solely on those important tokens, reducing the latency in the prefill phase. Tokens deemed less important will be discarded to reduce KV cache size, alleviating the memory bottleneck in the decoding phase. Our experiments demonstrate that ZipVL can accelerate the prefill phase by 2.3$\times$ and improve decoding throughput by 2.8$\times$, with a minimal accuracy reduction of only 0.5\% on VQAv2 benchmark over LLaVA-Next-13B model, effectively enhancing the generation efficiency of LVLMs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。