ChatPaper.aiChatPaper

MMInference: Acelerando o Pré-preenchimento para VLMs de Contexto Longo por meio de Atenção Esparsa com Permutação Consciente da Modalidade

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

April 22, 2025
Autores: 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

Resumo

A integração de capacidades de contexto longo com compreensão visual desbloqueia um potencial sem precedentes para Modelos de Linguagem Visual (VLMs). No entanto, a complexidade quadrática da atenção durante a fase de pré-preenchimento continua sendo um obstáculo significativo para a implantação no mundo real. Para superar essa limitação, introduzimos o MMInference (Multimodality Million tokens Inference), um método dinâmico de atenção esparsa que acelera o estágio de pré-preenchimento para entradas multimodais de contexto longo. Primeiro, nossa análise revela que a localidade temporal e espacial da entrada de vídeo leva a um padrão esparso único, o padrão Grid. Simultaneamente, os VLMs exibem distribuições esparsas marcadamente diferentes entre as diferentes modalidades. Introduzimos um método baseado em permutação para aproveitar o padrão Grid único e lidar com problemas de fronteira de modalidade. Ao buscar offline os padrões esparsos ótimos para cada cabeça, o MMInference constrói a distribuição esparsa dinamicamente com base na entrada. Também fornecemos kernels GPU otimizados para cálculos esparsos eficientes. Notavelmente, o MMInference se integra perfeitamente aos pipelines existentes de VLMs sem qualquer modificação ou ajuste fino do modelo. Experimentos em benchmarks multimodais—incluindo Video QA, Captioning, VisionNIAH e Mixed-Modality NIAH—com VLMs de contexto longo de última geração (LongVila, LlavaVideo, VideoChat-Flash, Qwen2.5-VL) mostram que o MMInference acelera o estágio de pré-preenchimento em até 8,3x em 1M de tokens, mantendo a precisão. Nosso código está disponível em https://aka.ms/MMInference.
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