Abstract
Vision-Language Models (VLMs) demand substantial computational resources during inference, largely due to the extensive visual input tokens for representing visual information. Previous studies have noted that visual tokens tend to receive less attention than text tokens, suggesting their lower importance during inference and potential for pruning. However, their methods encounter several challenges: reliance on greedy heuristic criteria for token importance and incompatibility with FlashAttention and KV cache. To address these issues, we introduce TopV, a compatible TOken Pruning with inference Time Optimization for fast and low-memory VLM, achieving efficient pruning without additional training or fine-tuning. Instead of relying on attention scores, we formulate token pruning as an optimization problem, accurately identifying important visual tokens while remaining compatible with FlashAttention. Additionally, since we only perform this pruning once during the prefilling stage, it effectively reduces KV cache size. Our optimization framework incorporates a visual-aware cost function considering factors such as Feature Similarity, Relative Spatial Distance, and Absolute Central Distance, to measure the importance of each source visual token, enabling effective pruning of low-importance tokens. Extensive experiments demonstrate that our method outperforms previous token pruning methods, validating the effectiveness and efficiency of our approach.
Introduction
Modern Vision-Language Models (VLMs), such as LLaVA and InternVL, have demonstrated remarkable capabilities in multimodal reasoning. However, these models are computationally intensive, primarily because high-resolution images are decomposed into hundreds or even thousands of visual tokens. In models like InternVL, a single image can generate nearly 1,800 tokens, accounting for up to 95% of the total input sequence.
Processing this volume of data imposes significant burdens on inference latency and memory usage, particularly regarding the Key-Value (KV) cache. While visual redundancy is a known phenomenon, existing pruning techniques often rely on "greedy" heuristics—such as simple attention scores—that fail to capture the true contribution of a token. Furthermore, many current methods are incompatible with modern hardware optimizations like FlashAttention and KV caching, as they frequently alter sequence lengths dynamically, negating the performance gains they seek to provide.
The TopV Framework
TopV addresses these limitations by reframing token pruning as a global optimization problem rather than a local heuristic choice. It introduces a training-free approach that optimizes token selection during the prefilling stage, ensuring compatibility with hardware accelerators.
1. Optimal Transport and the Sinkhorn Algorithm
Rather than using raw attention weights, TopV utilizes an Optimal Transport framework to identify the most influential visual tokens. By defining "source" tokens (input) and "target" tokens (the output of a specific transformer layer), the model calculates a Contribution Matrix. To ensure this process does not become a bottleneck itself, TopV employs the Sinkhorn algorithm. This iterative solver finds the optimal transport plan in milliseconds, allowing the model to identify critical information with high precision during inference.
2. Visual-Aware Cost Function
To improve pruning accuracy, TopV incorporates three specific "visual priors" into its optimization cost function:
- Feature Similarity: Prioritizes tokens that share high semantic similarity with the target output.
- Relative Spatial Distance: Leverages the assumption that neighboring tokens in the image grid are more likely to be contextually related.
- Absolute Central Distance: Applies a bias toward tokens located in the center of the image, where the primary subject of interest is typically situated.
3. Hardware-Compatible "One-and-Done" Pruning
A key innovation of TopV is its execution strategy. Pruning is performed only once during the prefilling stage (specifically at the second layer, $L_i=2$). By fixing the token count early in the process, the sequence length remains constant for all subsequent generation steps. This makes TopV fully compatible with FlashAttention and KV caching, allowing the model to leverage the full speed of GPU hardware without the overhead of dynamic sequence management.
4. Token Recovery Mechanism
To mitigate the risk of "visual collapse"—where the model loses the broader context of an image—TopV implements a uniform sampling strategy. A small subset of pruned tokens is reintegrated as a "sketch" of the original image, ensuring that the model retains global structural awareness even after aggressive pruning.
Experimental Results
The researchers evaluated TopV across a diverse suite of benchmarks, including general reasoning (MMMU, MMBench), hallucination assessment (POPE), and OCR tasks (OCRBench).
Efficiency and Performance Gains
TopV consistently outperformed previous state-of-the-art methods like FastV across multiple architectures:
- InternVL2-2B: TopV achieved a 2.1× speedup and a 61% reduction in dynamic memory usage. Notably, it also improved accuracy by 1.2% over the baseline, suggesting that removing redundant noise can actually benefit model reasoning.
- LLaVA-v1.5-7B: The method delivered a 1.68× efficiency gain while maintaining or slightly improving performance (+0.39%) compared to the unpruned baseline.
- OCR and Video Tasks: On OCRBench, TopV's token recovery strategy proved vital, preserving the fine-grained details necessary for text recognition that other pruning methods often discarded.
Insights and Future Directions
Analysis of TopV reveals that the "Post-Layer Norm" (Post-LN) stage is the optimal point for measuring token importance, as it captures interactions more effectively than earlier stages or the MLP output. By prioritizing hardware sympathy, TopV demonstrates that theoretical computational savings can be translated into real-world wall-clock time reductions.
Future work may involve adaptive layer selection, where the model determines the optimal pruning point based on image complexity. Additionally, combining TopV with other compression techniques, such as quantization or KV cache 4-bit compression, could further push the boundaries of VLM efficiency on edge devices.
Summary updated