TL;DR
This paper introduces SparseVILA, a novel method for accelerating Vision-Language Models (VLMs) by decoupling sparsity between the context and decoding stages. By strategically applying query-agnostic pruning during context pre-filling and query-aware retrieval during generation, SparseVILA achieves significant speedups without sacrificing performance, particularly in multi-turn conversations and long-context tasks.
What Problem Does This Paper Address?
Vision-Language Models (VLMs) are powerful tools for understanding and interacting with visual information, but their inference process, especially with high-resolution images or long videos, is computationally expensive and slow. This latency stems from the large number of visual tokens that need to be processed by the underlying Large Language Models (LLMs). Existing methods often focus on pruning tokens either during the initial context processing (prefill) or during the generation phase, but these approaches can lead to performance degradation, especially in multi-turn conversational settings where context needs to be maintained across several interactions. The core challenge is to achieve significant speedups without compromising the VLM's ability to understand and generate relevant responses, particularly when dealing with extended visual inputs or extended dialogues.
Methods
SparseVILA tackles this challenge with a two-stage approach:
- Decoupled Sparsity: The key innovation is separating sparsity application into two distinct phases:
- Prefill Phase (Query-Agnostic Pruning): During the initial processing of the visual input (and system/first query), SparseVILA employs query-agnostic pruning. This means tokens are selected based on their intrinsic visual importance (e.g., using attention scores from the visual encoder) rather than their relevance to a specific query. This is crucial because this stage is performed only once per conversation, and query-agnostic pruning ensures that essential visual information is retained for future turns.
- Decode Phase (Query-Aware Retrieval): During the generation of the response, SparseVILA uses a query-aware retrieval mechanism. Here, the current query is used to selectively fetch the most relevant visual tokens from the pre-filled context (stored in the KV cache). This ensures that only the information pertinent to the immediate question is used, significantly speeding up the attention computation in the LLM.
- KV Cache Optimization: The query-aware retrieval in the decoding stage results in a more compact and efficient KV cache, reducing memory overhead and improving generation speed.
Datasets
The paper evaluates SparseVILA on a variety of benchmarks, including:
- Image Benchmarks: ChartQA, DocVQA, GQA, InfographicVQA, MME, POPE, ScienceQA, and TextVQA.
- Video Benchmarks: Video-MME, Video-ChatGPT, and LongVILA for long-context video tasks.
- Multi-turn Evaluation: The authors adapt existing benchmarks like POPE for multi-turn evaluation and propose a framework to support this.
Key Insights and Ideas
- Decoupling is Key: The most significant insight is that separating sparsity application into prefill and decoding stages is crucial for maintaining performance in multi-turn scenarios. Pruning too aggressively in the prefill stage can remove information vital for later turns.
- Query-Agnostic Prefill for Robustness: Using query-agnostic pruning in the prefill stage ensures that the model retains a rich representation of the visual input, making it robust to subsequent, potentially different, queries.
- Query-Aware Decoding for Efficiency: Leveraging the current query in the decoding stage allows for highly targeted retrieval of relevant visual information, leading to substantial speedups without losing critical context.
- Visual Sink Tokens: The research identifies "visual sink tokens" – tokens that are consistently important across different queries and layers – and "retrieval tokens" that are query-dependent. SparseVILA effectively retains both.
Key Results
SparseVILA demonstrates impressive performance gains:
- Image Benchmarks: Achieves state-of-the-art performance with a 1.4x speedup on LLaVA-NeXT, and a +5.9% accuracy improvement on image-centric benchmarks compared to previous methods.
- Long-Context/Generation: Achieves 3.6x speedup in prefill and 1.7x speedup in decoding for long-context tasks, with 2.2x end-to-end speedup on Video-MME.
- Multi-Turn Performance: Maintains comparable performance to the vanilla baseline on long-context video tasks, outperforming other pruning methods that degrade significantly.
- Efficiency: Reduces peak memory consumption by up to 39.3% for long-context video tasks.
Limitations and Future Work
- Simplicity vs. Granularity: The authors acknowledge that their sparsity configuration is straightforward for broad compatibility. More granular strategies (e.g., layer-wise or head-aware sparsity) could potentially offer further optimization but would introduce additional complexity.
- Future Work: The paper suggests that future work could explore these more granular sparsity strategies to further enhance performance. The authors also plan to release their multi-turn evaluation framework to foster further research in this area.
Summary updated