When Large Language Models (LLMs) are extended to "see" the world, they typically rely on a Vision Transformer (ViT) to break an image down into a grid of patches, treating each patch as a visual "word" or token. While this works well for low-resolution images, modern multimodal tasks—such as document analysis, gigapixel medical imaging, and long-form video understanding—require processing massive amounts of visual data.
This creates a severe computational bottleneck. Because the self-attention mechanism inside transformers scales quadratically ($O(N^2)$) with the sequence length, passing thousands of raw visual patch tokens directly into an LLM causes memory usage and latency to skyrocket.
To solve this, researchers have developed visual token compression techniques. The core intuition is simple: images possess immense spatial and temporal redundancy. A language model does not need to look at every individual pixel patch of a blank wall or a repetitive texture to understand a scene. By compressing these features before they reach the LLM, we can drastically reduce sequence lengths while preserving critical semantic and spatial information.
Modern token compression strategies generally fall into three main categories: spatial aggregation, query-based resampling, and continuous downsampling.
Spatial Aggregation and Pixel Shuffling
The most direct way to reduce token count is to exploit local spatial redundancy by merging neighboring patches. Since adjacent patches in an image often belong to the same object or background, their embeddings are highly correlated.
One approach is direct spatial pooling or concatenation. In MiniGPT-v2, Chen et al. introduce a spatial token pooling strategy that concatenates neighboring visual embeddings into a single representation. This simple grouping allows the model to retain fine-grained details necessary for object grounding tasks while significantly lowering the computational overhead for the language backbone.
A more structured variant of this idea is the pixel shuffle operation, which re-organizes spatial dimensions into channel dimensions. As explored by Marafioti et al. in Idefics3 and Gao et al. in Mini-InternVL, pixel shuffling pools adjacent features into a single token, reducing the total sequence length by a factor of four. This spatial-to-channel transformation acts as an efficient downsampling mechanism, maintaining enough structural fidelity for high-resolution document understanding without overwhelming the transformer layers.
Raw ViT Patches (e.g., 4x4 grid) Pixel Shuffle / Concatenation
[A][B][C][D]
[E][F][G][H] ---> [A,B,E,F] [C,D,G,H]
[I][J][K][L] [I,J,M,N] [K,L,O,P]
[M][N][O][P] (Token count reduced by 4x)
Query-Based Resampling and Latent Bottlenecks
Instead of forcing the visual tokens into a smaller grid uniformly, we can use an attention mechanism to dynamically extract the most important information. This is achieved by introducing a fixed number of learnable "query tokens" that act as a latent bottleneck.
In the foundational Flamingo architecture, Alayrac et al. introduced the Perceiver Resampler. This module uses a fixed-size set of latent queries to attend to the variable-length visual features produced by the vision encoder. Because the number of queries is predetermined, the downstream language model always receives a constant, predictable number of tokens, completely decoupling the image resolution or video frame count from the LLM's internal attention cost.
This query-based bottleneck design has become a staple of modern multimodal architectures. For example, Liu et al. utilize a similar resampling module in InfiMM to standardize multi-source visual features. Similarly, Eom et al. demonstrate in Q-Mamba that bottlenecking visual information through learnable queries eliminates the need for manual 2D scanning heuristics, filtering out background noise and compressing high-dimensional features into a highly compact, semantically dense token space.
Continuous Interpolation and Pooling
A third paradigm applies classical computer vision downsampling operations directly to the continuous token representations. Rather than relying on learned attention weights or discrete patch shuffling, these methods treat the token sequence as a continuous 2D feature map and resize it.
In Dense Connector for MLLMs, Yao et al. implement bilinear token downsampling. By using standard 2D bilinear interpolation on the spatial grid of visual tokens, they reduce the token count before it enters the language model, significantly decreasing inference latency while retaining multi-layer visual features.
This type of mathematical pooling also helps balance modalities. In Towards Text-Image Interleaved Retrieval, Zhang et al. apply average pooling to compress visual features into reduced spatial grids. The authors show that without this compression, the sheer volume of image tokens mathematically overwhelms the textual tokens in joint embedding spaces, biasing the model. Compressing the visual tokens restores semantic equilibrium between text and sight.
Unlocking Long-Context Multimodal Applications
By shrinking the footprint of an individual image or video frame, token compression fundamentally changes what multimodal models can achieve.
- Massive Multi-Image Contexts: In CALICO, Yu leverages a query-based transformer to process co-segmentation tasks across multiple images simultaneously, achieving state-of-the-art results while using 18x fewer tokens. On an even larger scale, Wu et al. demonstrate in Visual Haystacks that aggressive token compression allows a model to search through up to 10,000 images within a single context window on a single GPU.
- Gigapixel Scale Processing: In specialized domains like digital pathology, images are too massive for standard architectures. Tran et al. show in HistoGPT that a latent bottleneck mechanism can aggregate thousands of variable-length image patches from gigapixel whole-slide images into a fixed set of tokens, enabling the automated generation of complex medical reports.
Ultimately, visual token compression shifts the paradigm of multimodal AI away from brute-force token processing. By treating vision-language projection as an information-distillation problem, these techniques allow transformers to see more, understand faster, and operate within realistic hardware constraints.
Key Foundational Work
MiniGPT-v2: large language model as a unified interface for vision-language multi-task learning (2023) — contributed 2 concept elements to this direction.
InternLM-XComposer: A Vision-Language Large Model for Advanced Text-image Comprehension and Composition (2023) — contributed 2 concept elements to this direction.
Flamingo: a Visual Language Model for Few-Shot Learning (2022) — contributed 2 concept elements to this direction.