PuMer: Pruning and Merging Tokens for Efficient Vision Language Models

Qingqing Cao, Bhargavi Paranjape, Hannaneh Hajishirzi

TL;DR

Vision-language models are notoriously slow and memory-heavy due to the quadratic cost of attention over hundreds of image and text tokens. This paper introduces PuMer, a framework that progressively reduces token counts using text-informed pruning and modality-aware merging. PuMer achieves up to a 2x inference speedup and over 50% memory reduction with less than a 1% drop in downstream task accuracy.

What Problem Does This Paper Address?

State-of-the-art Vision-Language (VL) models rely heavily on Transformer architectures to fuse visual and textual data. However, cross-modal attention scales quadratically ($O(N^2)$) with the number of input tokens. While a text prompt might only consist of a dozen words, an image is typically split into hundreds of patches (tokens), creating a massive computational and memory bottleneck.

Existing token reduction techniques from vision-only or text-only domains fail here because they don't account for cross-modal dependencies. An image patch might look "uninformative" on its own, but be absolutely critical to answering a specific textual question. Conversely, simply merging tokens irrespective of their modality can confuse the model's alignment space.

Methods

PuMer introduces a non-parametric, cascaded framework consisting of two main components inserted into the cross-modal layers of a VL model:

  1. Text-Informed Pruner (TIP): Instead of using expensive learnable parameters to guess which image patches matter, TIP leverages the model's existing cross-attention scores. It calculates a text-saliency score for each image token and discards the least relevant ones (e.g., dropping background patches unrelated to the text prompt).
  2. Modality-Aware Merger (MAM): To prevent information loss from pure pruning, MAM groups semantically similar tokens together using a parallel bipartite soft matching algorithm. Crucially, it performs this merging independently for text and image modalities to avoid cross-modal representation confusion.

These reducers are scattered across multiple layers to progressively distill tokens in a cascaded fashion. Knowledge distillation from the original unpruned model is used during fine-tuning to minimize the accuracy gap.

Figure 3: PuMer applies token reducers in the cross-modal layers of a VL model. Each token reducer is non- parametric and uses text-informed pruning and modality-aware merging to reduce image and text tokens.

Datasets

The authors evaluated PuMer across two backbone architectures (ViLT and METER) using five standard vision-language benchmarks:

  • Flickr30K: For Image-to-Text (IR) and Text-to-Image (TR) retrieval.
  • VQAv2: For Visual Question Answering.
  • NLVR2: Natural Language for Visual Reasoning.
  • SNLI-VE: Visual Entailment.

No new datasets were introduced.

Key Insights and Ideas

  • Context-Driven Saliency: An image patch's importance is dynamic and text-dependent. For example, given an image of a soccer game, background patches are pruned if the question asks about the sport, but kept if the question asks about the environment or number of people.
  • Pruning + Merging > Either Alone: Pruning alone drops too much information, hurting accuracy. Merging alone doesn't clear out completely irrelevant clutter. Combining them yields the optimal Pareto frontier for speed vs. accuracy.
  • Zero-Parameter Efficiency: By reusing existing attention weights for pruning and using bipartite matching for merging, the token reducers add zero parameter overhead and actually speed up training by 15-20%, not just inference.

Key Results

  • Throughput & Memory: Across all tasks, PuMer achieved a 1.7x to 2.1x increase in inference throughput and a 38% to 51% reduction in memory footprint.
  • Minimal Accuracy Trade-off: The massive efficiency gains came at a cost of less than 1% accuracy drop compared to the original baseline models. For instance, on VQAv2 with the METER backbone, accuracy only dropped from 77.5% to 76.8% while throughput increased by 1.82x.
  • Outperforming Baselines: PuMer consistently beat vision-only token reduction methods like DynamicViT and ToMe adapted for VL tasks, providing higher accuracy at equivalent speedups.

Limitations and Future Work

  • Encoder Bottlenecks: PuMer is designed for models where the cross-modal encoder is the primary bottleneck (like ViLT and METER). It provides marginal benefits for architectures where heavy lifting occurs inside a standalone vision encoder prior to fusion (e.g., ALBEF or X-VLM).
  • Future Work: The authors suggest extending token reduction strategies directly into the early stages of the vision encoder itself to achieve end-to-end acceleration across a wider variety of VL architectures.

Summary updated

BibTeX
@inproceedings{cao2023pumer,
  author = {Qingqing Cao and Bhargavi Paranjape and Hannaneh Hajishirzi},
  title = {{PuMer: Pruning and Merging Tokens for Efficient Vision Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.721},
}
Figure