Visual-Word Tokenizer: Beyond Fixed Sets of Tokens in Vision Transformers
Leonidas Gee, Wing Yan Li, Viktoriia Sharmanska, Novi Quadrianto
TL;DR
This work introduces Visual-Word Tokenizer (VWT), a training-free method to reduce the energy cost of Vision Transformers by dynamically compressing input sequences via two strategies: intra-image dropping of low-variance patches and inter-image grouping of patches into visual words using a Bag-of-Visual-Words. By forming a vocabulary of visual words through k-means clustering on patches and selectively masking or averaging patches with respect to these words, VWT achieves substantial energy savings (up to ~47%) with limited performance loss, and can complement existing compression techniques like quantization. The approach demonstrates improved robustness on certain subgroups and provides rich visualizations of how patches are grouped and dropped, offering a practical path toward efficient online inference in vision systems. The results indicate that selecting intra-image or inter-image strategies depends on the task (global classification vs. detailed captioning), and that VWTs are compatible with other compression pipelines, providing a versatile, training-free tool for energy-aware ViT deployment.
Abstract
The cost of deploying vision transformers increasingly represents a barrier to wider industrial adoption. Existing compression techniques require additional end-to-end fine-tuning or incur a significant drawback to energy efficiency, making them ill-suited for online (real-time) inference, where a prediction is made on any new input as it comes in. We introduce the $\textbf{Visual-Word Tokenizer}$ (VWT), a training-free method for reducing energy costs while retaining performance. The VWT groups visual subwords (image patches) that are frequently used into visual words, while infrequent ones remain intact. To do so, $\textit{intra}$-image or $\textit{inter}$-image statistics are leveraged to identify similar visual concepts for sequence compression. Experimentally, we demonstrate a reduction in energy consumed of up to 47%. Comparative approaches of 8-bit quantization and token merging can lead to significantly increased energy costs (up to 500% or more). Our results indicate that VWTs are well-suited for efficient online inference with a marginal compromise on performance. The experimental code for our paper is also made publicly available.
