SPOT: Sparsification with Attention Dynamics via Token Relevance in Vision Transformers
Oded Schlesinger, Amirhossein Farzam, J. Matias Di Martino, Guillermo Sapiro
TL;DR
This work tackles the high computational cost of Vision Transformers by introducing SPOT, a modular token-sparsification framework that leverages token embeddings and cross-layer attention dynamics to predict token relevance. A lightweight Token Relevance Module ingests per-token features, including compact attention statistics across layers, and uses an MLP to produce a soft and then hard masking of tokens via differentiable Gumbel-Softmax sampling, guided by a multi-iteration retention schedule $\rho_k=\rho^k$. Empirical results on ImageNet-1K with DeiT and LV-ViT show up to 40% GFLOPS savings while preserving or slightly improving accuracy, with strong robustness to perturbations and good cross-domain transfer. The approach is compatible with hard and soft sparsification and demonstrates interpretability through attention-based token pruning aligned with semantic content, offering a practical path to efficient ViT deployment.
Abstract
While Vision Transformers (ViT) have demonstrated remarkable performance across diverse tasks, their computational demands are substantial, scaling quadratically with the number of processed tokens. Compact attention representations, reflecting token interaction distributions, can guide early detection and reduction of less salient tokens prior to attention computation. Motivated by this, we present SParsification with attentiOn dynamics via Token relevance (SPOT), a framework for early detection of redundant tokens within ViTs that leverages token embeddings, interactions, and attention dynamics across layers to infer token importance, resulting in a more context-aware and interpretable relevance detection process. SPOT informs token sparsification and facilitates the elimination of such tokens, improving computational efficiency without sacrificing performance. SPOT employs computationally lightweight predictors that can be plugged into various ViT architectures and learn to derive effective input-specific token prioritization across layers. Its versatile design supports a range of performance levels adaptable to varying resource constraints. Empirical evaluations demonstrate significant efficiency gains of up to 40% compared to standard ViTs, while maintaining or even improving accuracy. Code and models are available at https://github.com/odedsc/SPOT .
