ChatPaper.aiChatPaper

MMInference: Beschleunigung der Vorabfüllung für langkontextuelle VLMs durch modalitätsbewusste Permutations-Sparse-Attention

MMInference: Accelerating Pre-filling for Long-Context VLMs via Modality-Aware Permutation Sparse Attention

April 22, 2025
Autoren: Yucheng Li, Huiqiang Jiang, Chengruidong Zhang, Qianhui Wu, Xufang Luo, Surin Ahn, Amir H. Abdi, Dongsheng Li, Jianfeng Gao, Yuqing Yang, Lili Qiu
cs.AI

Zusammenfassung

Die Integration von Langkontext-Fähigkeiten mit visuellem Verständnis erschließt ein bisher unerreichtes Potenzial für Vision-Language-Modelle (VLMs). Allerdings bleibt die quadratische Aufmerksamkeitskomplexität während der Pre-Filling-Phase ein erhebliches Hindernis für den praktischen Einsatz. Um diese Einschränkung zu überwinden, führen wir MMInference (Multimodality Million Tokens Inference) ein, eine dynamische Sparse-Attention-Methode, die die Pre-Filling-Phase für Langkontext-Multimodal-Eingaben beschleunigt. Unsere Analyse zeigt zunächst, dass die zeitliche und räumliche Lokalität von Videoeingaben zu einem einzigartigen Sparse-Muster, dem Grid-Muster, führt. Gleichzeitig weisen VLMs deutlich unterschiedliche Sparse-Verteilungen über verschiedene Modalitäten hinweg auf. Wir stellen eine permutationsbasierte Methode vor, um das einzigartige Grid-Muster zu nutzen und Modalitätsgrenzprobleme zu bewältigen. Durch die Offline-Suche nach den optimalen Sparse-Mustern für jeden Kopf konstruiert MMInference die Sparse-Verteilung dynamisch basierend auf der Eingabe. Wir bieten auch optimierte GPU-Kernel für effiziente Sparse-Berechnungen an. Bemerkenswerterweise integriert sich MMInference nahtlos in bestehende VLM-Pipelines, ohne dass Modifikationen oder Feinabstimmungen am Modell erforderlich sind. Experimente auf Multimodal-Benchmarks – einschließlich Video-QA, Captioning, VisionNIAH und Mixed-Modality NIAH – mit state-of-the-art Langkontext-VLMs (LongVila, LlavaVideo, VideoChat-Flash, Qwen2.5-VL) zeigen, dass MMInference die Pre-Filling-Phase bei 1M Tokens um bis zu 8,3x beschleunigt, während die Genauigkeit erhalten bleibt. Unser Code ist unter https://aka.ms/MMInference verfügbar.
English
The integration of long-context capabilities with visual understanding unlocks unprecedented potential for Vision Language Models (VLMs). However, the quadratic attention complexity during the pre-filling phase remains a significant obstacle to real-world deployment. To overcome this limitation, we introduce MMInference (Multimodality Million tokens Inference), a dynamic sparse attention method that accelerates the prefilling stage for long-context multi-modal inputs. First, our analysis reveals that the temporal and spatial locality of video input leads to a unique sparse pattern, the Grid pattern. Simultaneously, VLMs exhibit markedly different sparse distributions across different modalities. We introduce a permutation-based method to leverage the unique Grid pattern and handle modality boundary issues. By offline search the optimal sparse patterns for each head, MMInference constructs the sparse distribution dynamically based on the input. We also provide optimized GPU kernels for efficient sparse computations. Notably, MMInference integrates seamlessly into existing VLM pipelines without any model modifications or fine-tuning. Experiments on multi-modal benchmarks-including Video QA, Captioning, VisionNIAH, and Mixed-Modality NIAH-with state-of-the-art long-context VLMs (LongVila, LlavaVideo, VideoChat-Flash, Qwen2.5-VL) show that MMInference accelerates the pre-filling stage by up to 8.3x at 1M tokens while maintaining accuracy. Our code is available at https://aka.ms/MMInference.
PDF92April 29, 2025