Inference Optimal VLMs Need Fewer Visual Tokens and More Parameters

📄 arXiv: 2411.03312v2 📥 PDF

作者: Kevin Y. Li, Sachin Goyal, Joao D. Semedo, J. Zico Kolter

分类: cs.CV, cs.AI, cs.LG

发布日期: 2024-11-05 (更新: 2025-04-21)

备注: Published at ICLR 2025

🔗 代码/项目: GITHUB


💡 一句话要点

视觉语言模型推理优化:减少视觉tokens,增大模型参数更有效

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 视觉语言模型 token压缩 推理优化 模型缩放 视觉推理

📋 核心要点

  1. 现有视觉语言模型推理成本高昂,主要瓶颈在于图像token数量过多,导致LLM计算负担重。
  2. 论文核心思想是,在固定推理预算下,应尽可能使用最大的LLM,并最小化视觉token数量,甚至压缩到单个token。
  3. 实验结果表明,在高压缩比下,定制的token压缩算法能够有效提升视觉语言模型的推理效率和性能。

📝 摘要(中文)

视觉语言模型(VLMs)通过将图像表示融入大型语言模型(LLMs)的token输入中,在各种视觉理解和推理任务中表现出强大的能力。然而,由于LLM需要处理大量输入token(主要来自图像),导致推理过程中计算量巨大,限制了VLMs的实际部署。为了降低推理成本,可以缩小LLM的规模或减少表示图像所需的输入token数量。本文通过建立缩放定律来描述视觉token数量和LLM参数之间的最佳权衡,该定律捕捉了性能随这两个因素的变化。结果表明,对于视觉推理任务,VLMs的最佳推理行为是通过使用适合推理预算的最大LLM,同时最小化视觉token数量(通常为一个token)来实现的。基于这些见解,本文首次尝试设计针对高压缩设置的token压缩算法,利用基于prompt的token压缩。这项工作强调了在低视觉token状态下运行的性能和效率优势,以及为此类条件开发定制token减少算法的重要性。

🔬 方法详解

问题定义:视觉语言模型(VLMs)在推理时面临高延迟问题,这主要是由于需要处理大量的视觉token。现有方法主要集中在适度减少token数量,以保持模型性能,但并未充分探索token数量和模型大小之间的最佳平衡。

核心思路:论文的核心思路是,在给定的推理预算下,存在一个最佳的视觉token数量和LLM参数的权衡。研究发现,对于视觉推理任务,最佳策略是使用尽可能大的LLM,同时将视觉token数量最小化,甚至压缩到单个token。

技术框架:论文首先通过实验确定了视觉token数量和LLM参数之间的缩放定律,该定律描述了性能随这两个因素的变化。然后,基于这些缩放定律,论文设计了一种针对高压缩设置的token压缩算法。该算法利用prompt来压缩token,以在保持性能的同时减少token数量。

关键创新:论文的关键创新在于发现了视觉语言模型推理优化的一个反直觉的趋势:在固定计算预算下,减少视觉token数量,同时增大LLM参数,可以获得更好的性能。此外,论文还提出了针对高压缩比的token压缩算法。

关键设计:论文设计了一种基于prompt的token压缩算法。具体来说,该算法使用一个prompt来引导LLM生成一个压缩的视觉表示。该prompt可以被设计成鼓励LLM保留图像中最相关的信息,同时丢弃冗余信息。论文还探索了不同的prompt设计策略,并评估了它们在不同视觉推理任务上的性能。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

论文通过实验验证了在高压缩比下,定制的token压缩算法能够有效提升视觉语言模型的推理效率和性能。具体来说,实验结果表明,将视觉token数量减少到单个token,同时使用更大的LLM,可以在视觉推理任务上获得更好的性能。此外,论文还展示了基于prompt的token压缩算法在高压缩比下的有效性。

🎯 应用场景

该研究成果可应用于各种需要高效视觉推理的场景,例如移动设备上的图像搜索、自动驾驶中的场景理解、以及机器人导航等。通过减少视觉token数量,可以显著降低计算成本和延迟,使得视觉语言模型能够在资源受限的环境中部署。此外,该研究也为未来视觉语言模型的设计提供了新的思路,即应该更加注重模型大小和token数量之间的平衡。

📄 摘要(原文)

Vision Language Models (VLMs) have demonstrated strong capabilities across various visual understanding and reasoning tasks, driven by incorporating image representations into the token inputs of Large Language Models (LLMs). However, their real-world deployment is often constrained by high latency during inference due to the substantial compute required by the LLM to process the large number of input tokens, predominantly arising from the image. To reduce inference costs, one can either downsize the LLM or reduce the number of input tokens needed to represent the image, the latter of which has been the focus of many recent efforts around token compression. However, it is unclear what the optimal trade-off is given a fixed inference budget. We first characterize this optimal trade-off between the number of visual tokens and LLM parameters by establishing scaling laws that capture variations in performance with these two factors. Our results reveal a surprising trend: for visual reasoning tasks, the inference-optimal behavior in VLMs is achieved by using the largest LLM that fits within the inference budget while minimizing visual token count - often to a single token. While the token reduction literature has mainly focused on maintaining base model performance by modestly reducing the token count (e.g., $5-10\times$), our results indicate that the compute-optimal inference regime requires operating under even higher token compression ratios. Based on these insights, we take the first steps toward designing token compression algorithms tailored for high-compression settings, utilizing prompt-based compression of tokens. Our work underscores the performance and efficiency benefits of operating in low visual token regimes and the importance of developing tailored token reduction algorithms for such conditions. Code is available at https://github.com/locuslab/llava-token-compression.