轻量化多模态模型推理,加速效果显著且不损失性能。
LightVLM: Acceleraing Large Multimodal Models with Pyramid Token Merging and KV Cache Compression
- 分阶段优化:编码阶段用分层令牌合并压缩图像特征,解码阶段通过压缩键值缓存提升速度。
- 仅保留3%图像令牌仍保持98%性能,吞吐量提升2.02倍,预填充时间减少3.65倍。
- 适合部署大型多模态模型的场景,尤其对长文本生成有明显加速优势。
本文提出 LightVLM,一种可无缝集成至现有视觉语言模型(VLMs)的训练无关加速方法,无需重新训练即可显著提升推理效率。我们将 VLM 推理过程分为编码与解码两个阶段,分别设计优化策略:在编码阶段,采用分层金字塔令牌合并(Pyramid Token Merging),逐层压缩不同 LLM 层的视觉令牌,最终仅保留少数关键令牌以实现高效处理;在解码阶段,提出键值缓存压缩(KV Cache Compression),移除冗余缓存以降低长序列输出延迟。实验表明,当仅保留 35% 图像令牌时,模型性能保持 100%;仅保留 3% 时仍维持约 98% 性能。LightVLM 可使网络吞吐量提升 2.02 倍,预填充时间减少 3.65 倍。对于大模型(如 InternVL2.5 26B),其推理速度甚至超过更小模型(如 InternVL2.5 8B)。在生成长达 4096 令牌的文本时,推理时间缩短 3.21 倍,显著优于现有方法。
原文摘要 · Abstract (English)
In this paper, we introduce LightVLM, a simple but effective method that can be seamlessly deployed upon existing Vision-Language Models (VLMs) to greatly accelerate the inference process in a training-free manner. We divide the inference procedure of VLMs into two stages, i.e., encoding and decoding, and propose to simultaneously accelerate VLMs in both stages to largely improve model efficiency. During encoding, we propose pyramid token merging to reduce tokens of different LLM layers in a hierarchical manner by finally only keeping a few dominant tokens to achieve high efficiency. During decoding, aimed at reducing the high latency of outputting long sequences, we propose KV Cache compression to remove unnecessary caches to increase the network throughput. Experimental results show that LightVLM successfully retains 100% performance when only preserving 35% image tokens, and maintains around 98% performance when keeping only 3% image tokens. LightVLM could 2.02$\times$ the network throughput and reduce the prefilling time by 3.65$\times$. LightVLM also makes large VLMs faster again by enabling a heavy model (e.g., InternVL2.5 26B) to infer faster than significantly smaller models (e.g., InternVL2.5 8B), hopefully facilitating the real-world deployment. When generating long text sequences (e.g., 4096 tokens), LightVLM could reduce the inference time by 3.21$\times$, largely outperforming existing methods.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。