TokenPacker: Efficient Visual Projector for Multimodal LLM

Wentong Li, Yuqian Yuan, Jian liu, Dongqi Tang, Song Wang, Jianke Zhu, Lei Zhang

Introduction

Multimodal Large Language Models (MLLMs), such as LLaVA, rely on a visual projector to bridge the gap between a vision encoder and a Large Language Model (LLM). While effective, standard projectors like Multi-Layer Perceptrons (MLPs) create a significant computational bottleneck. High-resolution images generate a vast number of visual tokens, and since LLM computational costs scale quadratically with token count, these models become slow and resource-intensive. Previous attempts to reduce token counts, such as resamplers, often resulted in a loss of fine-grained detail, negatively impacting performance on tasks like Optical Character Recognition (OCR) and small object detection.

Methodology: The TokenPacker Architecture

TokenPacker addresses visual redundancy through a novel coarse-to-fine "injection" strategy. Unlike the one-to-one mapping of standard projectors, TokenPacker enriches a reduced set of tokens with high-resolution local information.

Comparison of visual projectors: (a) Linear Projector (1:1 mapping), (b) Resampler (many-to-few), and (c) TokenPacker (region-to-point injection).

The architecture operates in two primary stages:

  1. Coarse Foundation: Visual features are downsampled using bilinear interpolation into a low-resolution grid of "point queries," providing a global context of the image.
  2. Region-to-Point Injection: For each point query, the module identifies the corresponding high-resolution local region in the original feature map. A cross-attention mechanism then "injects" multi-level details—sourced from both shallow and deep layers of the vision encoder—into that single token.

Additionally, TokenPacker utilizes a Dynamic Image Slicing scheme. This approach calculates an optimal grid layout based on the image's original aspect ratio, avoiding the distortion and wasted padding common in fixed-square cropping methods.

Experimental Setup

The model was evaluated across a diverse set of benchmarks after training on large-scale datasets:

  • Training Data: CC-558K for modality alignment, followed by instruction tuning on the LLaVA 665K mixture and the Mini-Gemini dataset (up to 1.5M samples).
  • Benchmarks: Evaluations included general QA (VQAv2, GQA, VizWiz), text-heavy tasks (TextVQA, OCRBench, DocVQA), and comprehensive reasoning (MMBench, MM-Vet).

Key Results and Performance

TokenPacker demonstrates that visual redundancy can be significantly reduced without compromising reasoning capabilities. By intelligently packing information, the model achieves superior efficiency and accuracy.

Accuracy vs. Throughput (TPS) for various projectors. TokenPacker (Ours) achieves higher accuracy with significantly higher throughput compared to the MLP baseline.
  • Efficiency Gains: TokenPacker reduces visual tokens by 75% to 89% (e.g., from 576 to 144 or 64 tokens). This leads to a massive speedup; the model achieved approximately 25 Tokens Per Second (TPS), a 5x improvement over the LLaVA-1.5 baseline (4.9 TPS).
  • Improved Accuracy: Despite the drastic reduction in tokens, TokenPacker outperformed LLaVA-1.5 on several benchmarks. For instance, it achieved a +0.8% improvement on MMBench while using 75% fewer tokens.
  • OCR Performance: The high-resolution dynamic slicing enabled state-of-the-art results on OCR tasks, reaching 70.6% on TextVQA.

Conclusion

TokenPacker proves that the majority of visual tokens in standard MLLMs are redundant. By focusing on local context and multi-level feature fusion, it enables high-performance multimodal reasoning at a fraction of the computational cost. While there is a performance floor when tokens are reduced below a certain threshold (roughly 32 tokens), TokenPacker sets a new standard for efficient visual projection in high-throughput and edge-computing environments. Future research will explore even denser "packing" algorithms to push the limits of token compression further.

Summary updated

BibTeX
@article{li2024tokenpacker,
  author = {Wentong Li and Yuqian Yuan and Jian liu and Dongqi Tang and Song Wang and Jianke Zhu and Lei Zhang},
  title = {{TokenPacker: Efficient Visual Projector for Multimodal LLM}},
  journal = {Int. J. Comput. Vis.},
  year = {2024},
  url = {https://openreview.net/forum?id=FS4Qa5zi7P},
}
Figure