arXiv:2502.02406cs.CVcs.AI2025-02ICML被引 1

提出高效分布式注意力机制,显著加速长视频理解的多模态大模型推理

LV-XAttn: Distributed Cross-Attention for Long Visual Inputs in Multimodal Large Language Models

论文配图:LV-XAttn: Distributed Cross-Attention for Long Visual Inputs in Multimodal Large Language Models
图 1 · 摘自论文原文
  • 将大视觉键值块本地化,仅交换小查询块,减少跨GPU通信量
  • 在多个模型上实现最高10.62倍端到端加速,尤其适合长视觉输入场景
  • 适用于需要处理长视频或高分辨率图像的多模态大模型研究者

交叉注意力广泛用于多模态大语言模型(MLLMs)中融合视觉信息。但在处理大规模视觉输入(如视频理解)时,交叉注意力层需处理大量视觉标记,导致内存需求高,通常需跨多个GPU分布式计算。现有分布式注意力机制通信开销大,成为训练和推理的瓶颈。为此,我们提出LV-XAttn,一种通信开销极低的分布式精确交叉注意力机制。观察发现,在长视觉输入任务中,查询块尺寸远小于键值块。因此,LV-XAttn将大型键值块保留在各GPU本地,仅跨GPU交换较小查询块,并引入高效的激活重计算技术以支持更长视觉上下文。我们从理论上分析了其通信优势,证明其在多种模型下均能实现加速。在Llama 3-V、mPLUG-Owl3和OpenFlamingo模型上的评估表明,与现有方法相比,LV-XAttn可实现最高10.62倍的端到端速度提升。

原文摘要 · Abstract (English)

Cross-attention is commonly adopted in multimodal large language models (MLLMs) for integrating visual information into the language backbone. However, in applications with large visual inputs, such as video understanding, processing a large number of visual tokens in cross-attention layers leads to high memory demands and often necessitates distributed computation across multiple GPUs. Existing distributed attention mechanisms face significant communication overheads, making cross-attention layers a critical bottleneck for efficient training and inference of MLLMs. To address this, we propose LV-XAttn, a distributed, exact cross-attention mechanism with minimal communication overhead. We observe that in applications involving large visual inputs, the size of the query block is typically much smaller than that of the key-value blocks. Thus, in LV-XAttn we keep the large key-value blocks locally on each GPU and exchange smaller query blocks across GPUs. We also introduce an efficient activation recomputation technique to support longer visual context. We theoretically analyze the communication benefits of LV-XAttn and show that it can achieve speedups for a wide range of models. Our evaluations with Llama 3-V, mPLUG-Owl3 and OpenFlamingo models find that LV-XAttn achieves up to 10.62$\times$ end-to-end speedup compared to existing approaches.

多模态模型分布式计算注意力机制视频理解

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