Dynamic-LLaVA: Efficient Multimodal Large Language Models via Dynamic Vision-language Context Sparsification

Wenxuan Huang, Zijie Zhai, Yunhang Shen, Shaosheng Cao, Fei Zhao, Xiangfeng Xu, Zheyu Ye, Shaohui Lin

TL;DR

Dynamic-LLaVA is a novel framework designed to make Multimodal Large Language Models (MLLMs) significantly faster and more memory-efficient. By dynamically pruning redundant "tokens" from both visual inputs and generated text contexts, it slashes prefill computation by ~75% and cuts GPU memory usage by ~50% during decoding. Remarkably, it achieves these efficiency gains with almost no loss in accuracy, and in some cases, even improves performance.

The Bottleneck in Multimodal Inference

Multimodal models like LLaVA are incredibly powerful but computationally "heavy." When a model processes an image and generates a description, it goes through two main stages: the prefill stage (processing the initial image and prompt) and the decoding stage (generating words one by one).

The efficiency bottleneck is two-fold:

  1. Image Redundancy: High-resolution images generate hundreds of tokens. Many of these tokens represent uninformative background patches (like an empty sky) that contribute nothing to the final answer.
  2. The Decoding Wall: While existing methods successfully prune image tokens during the prefill stage, these efficiency gains vanish as the model starts generating text. As the generated text grows, the "KV cache" (the memory used to store past activations for fast recall) balloons. This eventually slows down the model or crashes it entirely due to out-of-memory (OOM) errors.

The authors identify a critical "diminishing returns" problem: if a framework only prunes the image at the start, the ever-growing text context inevitably becomes the new bottleneck.

Core Methodology: Dynamic Context Sparsification

The core innovation of Dynamic-LLaVA is Dynamic Vision-Language Context Sparsification. Rather than applying a static, one-time pruning step, the framework uses two lightweight, learnable "predictors" to continuously decide which tokens are worth keeping throughout the entire generation process.

Dynamic-LLaVA Architecture
  • Image Predictor ($P^I$): Operating during the prefill stage, this predictor analyzes visual features and drops non-essential image patches before they consume heavy compute.
  • Output Predictor ($P^{OT}$): This is the "online" component active during decoding. It evaluates each newly generated text token and decides whether its Key-Value (KV) activations are important enough to be stored in the cache for future steps.

Key Technical Innovations

  • Tailored Inference Schemes: The framework adapts its pruning strategy based on the specific inference mode (prefill, decoding with KV cache, or decoding without KV cache).
  • End-to-End Training: To make the discrete "keep or drop" decision differentiable for training, the authors employ the Gumbel-Softmax trick.
  • MaskedSoftmax: During training, instead of physically deleting tokens (which would disrupt the model's ability to learn sequences), the architecture uses a special mask in the attention mechanism to "silence" the influence of redundant tokens, teaching the model to ignore them naturally.

Key Insights

  • Online KV Cache Compression: Most traditional KV cache pruning happens after the cache is already full. Dynamic-LLaVA performs this "on the fly." By deciding at the exact moment of generation whether a token is worth remembering, it prevents memory bloat from occurring in the first place.
  • Attention Denoising: Surprisingly, pruning doesn't just maintain performance; it sometimes improves it. On the SciQA benchmark, the 7B model saw a +2.3% gain. This suggests that sparsification acts as a form of "attention denoising," helping the model focus strictly on relevant information.
  • Multimodal Awareness: Standard LLM pruning methods (like H2O) struggle with multimodal inputs because they treat pixels and words identically. Dynamic-LLaVA’s dual-predictor approach handles this modality gap natively.

Performance and Efficiency Results

The model was trained on the 656K Mixture Dataset and evaluated across a massive battery of benchmarks (including VQAv2, GQA, MME, MMBench, and new long-form generation subsets like LVIS-Instruct4V).

Efficiency Comparison: FLOPs and GPU Memory

The efficiency gains are substantial:

  • Prefill Efficiency: Dynamic-LLaVA reduces computation (FLOPs) by ~75% compared to the LLaVA-1.5 baseline.
  • Memory Savings: It saves ~50% of GPU memory during decoding by dynamically pruning the KV cache.
  • OOM Prevention: In practical tests on an A100 GPU, Dynamic-LLaVA successfully generated long sequences (e.g., 4K+ tokens) where standard models hit memory limits and crashed.
  • Negligible Degradation: Across most benchmarks, performance stayed within 0.5-1% of the full-context model, effectively offering a "free lunch" for inference efficiency.

Limitations and Future Work

While highly effective, the framework has a few limitations. The authors found that attempting to prune the initial text prompt (the user's question) during the prefill stage led to a noticeable performance drop (~1.45%), suggesting that prompt text requires a more refined sparsification design. Additionally, while the predictors are lightweight (less than 1% of total parameters), they still represent a marginal compute overhead.

Future work will explore more sophisticated ways to handle the initial text context and investigate integrating Dynamic-LLaVA with "speculative decoding" to push generation speeds even further.

Summary updated

BibTeX
@inproceedings{huang2025dynamic,
  author = {Wenxuan Huang and Zijie Zhai and Yunhang Shen and Shaosheng Cao and Fei Zhao and Xiangfeng Xu and Zheyu Ye and Shaohui Lin},
  title = {{Dynamic-LLaVA: Efficient Multimodal Large Language Models via Dynamic Vision-language Context Sparsification}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=hzVpZDrW73},
}
Figure