LLaVA-PruMerge: Adaptive Token Reduction for Efficient Large Multimodal Models

Yuzhang Shang,Mu Cai,Bingxin Xu,Yong Jae Lee,Yan Yan
2024-05-23
Abstract:Large Multimodal Models (LMMs) have shown significant visual reasoning capabilities by connecting a visual encoder and a large language model. LMMs typically take in a fixed and large amount of visual tokens, such as the penultimate layer features in the CLIP visual encoder, as the prefix content. Recent LMMs incorporate more complex visual inputs, such as high-resolution images and videos, which further increases the number of visual tokens significantly. However, due to the inherent design of the Transformer architecture, the computational costs of these models tend to increase quadratically with the number of input tokens. To tackle this problem, we explore a token reduction mechanism that identifies significant spatial redundancy among visual tokens. In response, we propose PruMerge, a novel adaptive visual token reduction strategy that significantly reduces the number of visual tokens without compromising the performance of LMMs. Specifically, to metric the importance of each token, we exploit the sparsity observed in the visual encoder, characterized by the sparse distribution of attention scores between the class token and visual tokens. This sparsity enables us to dynamically select the most crucial visual tokens to retain. Subsequently, we cluster the selected (unpruned) tokens based on their key similarity and merge them with the unpruned tokens, effectively supplementing and enhancing their informational content. Empirically, when applied to LLaVA-1.5, our approach can compress the visual tokens by 14 times on average, and achieve comparable performance across diverse visual question-answering and reasoning tasks. Code and checkpoints are at
Computer Vision and Pattern Recognition,Artificial Intelligence,Computation and Language
What problem does this paper attempt to address?
The paper primarily addresses the issue of computational efficiency in large multimodal models (LMMs). Specifically, it focuses on how to reduce the number of visual tokens input into the language model without sacrificing model performance, thereby lowering computational costs. Current LMMs exhibit strong visual reasoning capabilities by connecting visual encoders with large language models. These models typically receive a fixed and large number of visual tokens as input, such as features from the penultimate layer of the CLIP visual encoder. As the models handle more complex visual inputs, such as high-resolution images and videos, the number of visual tokens increases significantly, leading to a quadratic growth in computational costs for Transformer-based models. To address this issue, the paper proposes the PruMerge method, a novel adaptive visual token reduction strategy. PruMerge can significantly reduce the number of visual tokens while maintaining the performance of LMMs. The specific approach includes: 1. **Important Token Selection**: Utilizing the sparsity of attention scores in the visual encoder to measure the importance of each token and dynamically selecting key visual tokens to retain. 2. **Token Merging**: Clustering the selected (unpruned) tokens and merging them with the unpruned tokens to supplement and enhance their informational content. Experimental results show that when applied to the LLaVA-1.5 model, PruMerge can compress visual tokens by an average of approximately 14 times while maintaining comparable performance across various visual question answering and reasoning tasks. Additionally, PruMerge demonstrates its generality and efficiency across different modalities of data, particularly in video understanding tasks, where integrating PruMerge only during the inference stage can accelerate the processing speed of video LMMs and improve their performance. In summary, this research aims to improve the overall efficiency of LMMs by reducing the number of visual tokens without affecting the model's reasoning capabilities.