Efficient Vision Transformers via Token Merging with Head-wise Attention Correction

Yuki Ichikawa, Masato Motomura, Thiem Van Chu, 藤木大地, Daichi Fujiki

TL;DR

Vision Transformers (ViTs) are powerful but computationally expensive due to self-attention. Token Merging (ToMe) reduces this cost by merging tokens, but it introduces subtle distortions. This paper proposes Head-wise Attention Correction (HAC) to fix these distortions by accounting for head-specific characteristics, significantly improving the efficiency-accuracy trade-off without sacrificing performance.

What Problem Does This Paper Address?

Vision Transformers (ViTs) have achieved state-of-the-art results by effectively modeling global relationships in images. However, their core self-attention mechanism has a quadratic computational cost with respect to the number of image patches (tokens), making them computationally expensive, especially for high-resolution images or large models.

To address this, researchers have developed techniques like Token Merging (ToMe), which reduces the number of tokens by merging similar ones. While ToMe significantly improves efficiency, it can distort the attention mechanism. A previous attempt to mitigate this distortion, called proportional attention, scales the attention weights of merged tokens. However, this paper argues that proportional attention is insufficient because it only compensates for a merged token's influence on other tokens, neglecting the distortion within the merged token's own self-attention score. This internal distortion, amplified by the softmax normalization, leads to a redistribution of attention weights and can negatively impact model accuracy. The paper's key insight is that this distortion is not uniform across all attention heads but varies based on each head's specific projection weights.

Methods

The paper introduces Head-wise Attention Correction (HAC), a method designed to mitigate the attention distortions introduced by Token Merging (ToMe). HAC builds upon the idea of proportional attention but adds a crucial head-specific correction.

The core of HAC lies in understanding that the attention score between two tokens (say, A and B) for a specific attention head can be represented as a bilinear form involving their projected query and key vectors. When tokens are merged, this bilinear form changes, leading to attention distortion. The paper analyzes this distortion and finds it's strongly correlated with the statistical properties of each attention head's weight matrix, particularly the trace of the weight matrix.

HAC proposes two main approaches:

  1. Statistical HAC (S-HAC): This method empirically measures the average attention distortion for each head during a calibration phase. These average distortions are then used as correction terms, applied specifically to the diagonal elements of the attention score matrix (representing a token's attention to itself). While principled, S-HAC has limitations: it doesn't account for the cumulative effects of merging across multiple layers and can be computationally inefficient due to selective diagonal updates.
  2. Learning-Based HAC (L-HAC): This is the paper's primary proposed method. It overcomes S-HAC's limitations by learning a mapping from token size (which encodes the history of merging operations) to the appropriate correction value for each head. This is achieved using a lightweight, two-layer MLP for each attention head. L-HAC applies corrections to all attention scores for computational efficiency, unifying the proportional attention term and the distortion correction into a single learned function. This approach is more dynamic, accounts for cumulative merging effects, and is more practical for deployment.

Datasets

  • ImageNet: Used for training and evaluating classification performance.
  • MS-COCO 2017: Used for evaluating vision-language tasks (image-to-text and text-to-image retrieval).

Key Insights and Ideas

  • Proportional Attention is Incomplete: While proportional attention helps balance the influence of merged tokens on other tokens, it fails to address the internal distortion of a merged token's self-attention score. This internal distortion is a critical, overlooked problem.
  • Head-wise Distortion: The attention distortion introduced by merging is not uniform across all attention heads. It varies significantly and is strongly dependent on the specific projection weights (bilinear forms) of each head. This necessitates a head-specific correction strategy.
  • Bilinear Forms and Covariance: The paper provides a theoretical analysis showing that attention distortion can be understood through the statistical properties of bilinear forms, specifically how the cross-covariance matrix of tokens interacts with the attention weight matrix. The trace of the weight matrix plays a key role in determining whether distortion is amplified or diminished.
  • Token Size as a History Indicator: The size of a merged token (i.e., how many original tokens it represents) is a valuable indicator of its merging history and the resulting attention distortion. This insight is leveraged in the learning-based HAC approach.

Key Results

  • Improved Accuracy with HAC: Both S-HAC and L-HAC consistently outperform standard proportional attention in terms of top-1 accuracy on ImageNet classification, especially when token reduction is aggressive (higher r values). For example, on DeiT-B with r=20, L-HAC achieves 68.8% accuracy compared to 66.7% for proportional attention.
  • Efficiency-Accuracy Trade-off: L-HAC significantly improves the accuracy-throughput trade-off. While it introduces a slight overhead compared to pure ToMe, it achieves much higher accuracy for comparable throughputs. Figure 3 visually demonstrates this superior trade-off.
  • Effectiveness Across Architectures: L-HAC shows consistent improvements across various ViT architectures (DeiT-B, DeiT-S, DeiT-T, LV-ViT, MAE, AugReg, SAM) and even when combined with other state-of-the-art methods like ToFu, MCTF, DiffRate, and PPT.
  • Vision-Language Performance: HAC also demonstrates effectiveness in vision-language tasks, improving text-to-image and image-to-text retrieval metrics on the MS-COCO dataset when used with CLIP.

Limitations and Future Work

  • Training/Calibration Overhead: The paper acknowledges that the necessary training or calibration for HAC compromises ToMe's "off-the-shelf" advantage. This is a trade-off for improved performance.
  • Computational Complexity of S-HAC: The statistical approach (S-HAC) is noted to be less practical due to its computational overhead from random access operations for diagonal-only matrix updates.
  • Future Work: The authors suggest that a more detailed analysis of ToMe's impact on attention scores is a promising avenue for future research. This could potentially lead to even more refined correction methods.

Summary updated

BibTeX
@inproceedings{ichikawa2026efficient,
  author = {Yuki Ichikawa and Masato Motomura and Thiem Van Chu and 藤木大地 and Daichi Fujiki},
  title = {{Efficient Vision Transformers via Token Merging with Head-wise Attention Correction}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2026},
  doi = {10.1109/wacv61042.2026.00381},
}
Figure