Vision Transformers (ViTs) have achieved state-of-the-art performance across a range of computer vision tasks, mainly thanks to the self-attention mechanism. However, its complexity, increasing quadratically with the number of tokens, remains the major obstacle to ViT efficiency and deployment at scale. Token merging reduces this cost by aggregating redundant tokens. Yet existing methods are typically evaluated within a single architecture, leaving open whether their effectiveness stems from the merging mechanism itself or from the specific decoder they are paired with. We extend Graph-Guided Token Merging (G2TM), a single module inserted early in a ViT-based network, beyond its original Segmenter setting. We evaluate G2TM across three semantic segmentation frameworks (Segmenter, SETR, EoMT) and three decoder families (Linear, Transformer-, convolution-based), as well as standard ViT image classification. Our results show that G2TM's behavior and accuracy-efficiency trade-off are consistent across every tested architecture for a given backbone size, indicating that its effectiveness is a property of the encoder rather than the decoder. G2TM also generalizes well to image classification, achieving an even smaller degradation in accuracy compared to semantic segmentation. We further find that G2TM's optimal hyperparameters, resulting in a consistent drop in GFLOPs of 22-47% and an increase in throughput by up to 74% for segmentation models on ADE20K dataset, depend primarily on the backbone's pre-training recipe and on the target dataset, rather than on the decoder choice.
Figures & tables
Framework
Decoder architecture
GFLOPs
Parameters (M)
Segmenter
Linear Layer
0.16
0.15
Segmenter
Mask Transformer
37.68
28.50
SETR-Naive
1×1 convolutions
1.07
0.30
SETR-PUP
3×3 convolutions
63.62
4.17
SETR-MLA
Multi-layer fusion & convolutions
39.53
17.65
EoMT
Transformer-based
90.82
62.11
Table 1: Decoder sizes across different segmentation frameworks on ADE20K dataset. We count both the number of parameters (in millions) and the number of floating-point operations needed (in GFLOPs). As a point of comparison, we also provide the size of the ViT’s classification head on ImageNet-1k. The models’ backbones are ViT-Large.
Figure 1: Integration of the G2TM module within the ith Transformer block of a ViT-based architecture. The module is inserted following the attention layer and the residual connection of one of the shallow Transformer blocks (typically, i=1 or 2 ).
Figure 2: Illustration of G2TM merging strategy . Tokens are arranged on a 2D grid. Their position in the grid corresponds to those of the patches in the original image. The final merging operation (last step) differs between training (left) and inference (right): during training, merged tokens are masked for self-attention (depicted as transparent), whereas during inference, they are entirely removed.
Threshold
Steps
Dataset
Framework
Initial
Final
Number of epochs
Warm-up
Intermediate
Final
ImageNet-1k
ViT
0.92
0.86
8
2
1
1
Segmenter
0.95
0.88
150
64
10
26
ADE20K
SETR
0.94
0.88
128
50
10
28
EoMT
0.95
0.88
30
6
3
6
Cityscapes
Segmenter
1.0
0.95
216
100
15
56
Table 2: Number of epochs of each step of the threshold curriculum technique across all frameworks. During the warm-up step, the threshold value τ is at its highest, while in the final step it is at its minimum: the threshold value intended for the model. The intermediate step corresponds to the number of epochs for each intermediate value of τ .
Tokens
Model
Decoder
mIoU ↗
FPS ↗
GFLOPs ↘
Count
Mean size
Seg-T
40.1
174.1
10.65
1024
-
+ G2TM@1
Linear
39.1
164.1
7.06
729
8.9
+ G2TM † @2
39.3
160.7
6.57
649
7.4
Seg-S
46.2
114.5
32.02
1024
-
+ G2TM@1
Linear
46.3
123.4
24.37
807
7.1
Table 3: Semantic segmentation results on ADE20K. We evaluate all models and their respective decoders and compare them with the chosen G2TM’s configurations inserted in the backbone. @ l indicates the application layer.
Figure 3: Distributions of cosine similarities between adjacent tokens in Seg across backbone sizes. From left to right: T, S, B and L backbone sizes. From top to bottom: distributions computed at 1st and 2nd layers. The decoder is a Mask Transformer. The distributions are computed over the training set of ADE20K.
Tokens
Model
Top-1 ↗
FPS ↗
GFLOPs ↘
Count
Mean size
ViT-T
78.0
226.5
4.70
576
-
+ G2TM@1
77.8
193.0
4.27
531
4.6
+ G2TM † @2
77.6
183.5
3.46
425
6.8
ViT-S
83.0
195.5
15.52
576
-
+ G2TM@1
82.9
179.5
14.98
558
3.2
Table 4: Image classification results on ImageNet-1k. We evaluate all ViT models with their linear classification decoder and compare them with the chosen G2TM’s configurations inserted in the backbone. @ l indicates the application layer.
Figure 4: Performance of ViT-S across threshold values. We apply G2TM at the second layer and report Top-1 accuracy (blue triangles) on the left axis and GFLOPs (orange squares) on the right axis. The x-axis indicates the threshold τ and, the bottom row provides the number of remaining tokens after the merging operation.
Figure 5: Visualization of fused tokens and segmentation maps. From top to bottom: fused token layout of G2TM applied to Seg with Mask Transformer decoder; ground truth segmentation maps; segmentation maps predicted by the latter Seg model; SETR-PUP; SETR-MLA; and EoMT. For all models, the backbone is a ViT-L and G2TM is applied at the second layer.
Table 10
Model
Top-1 ↗
FPS ↗
GFLOPs ↘
ViT-B
84.8
88.0
55.54
+ G2TM@1
84.6
101.2
50.04
+ G2TM@2
83.7
103.8
41.68
ViT-L
86.2
31.6
191.21
+ G2TM@1
86.1
32.7
173.36
+ G2TM@2
84.3
43.5
126.90
Table 7: Off-the-shelf models for image classification on ImageNet-1k. @ l indicates the application layer.
Model
Decoder
mIoU ↗
FPS ↗
GFLOPs ↘
Seg-S
46.5
94.8
38.62
+ G2TM@1
Mask Transformer
45.8
105.5
29.61
+ G2TM@2
45.3
114.0
25.84
SETR-B
49.5
46.0
170.30
+ G2TM@1
PUP
46.6
60.6
132.25
+ G2TM@2
46.4
59.9
130.17
Table 8: Off-the-shelf models for semantic segmentation on ADE20K. @ l indicates the application layer.
Tokens
Model
Pre-training
mIoU ↗
FPS ↗
GFLOPs ↘
Count
Mean size
EoMT
AugReg
52.3
60.9
392.82
1024
-
+ G2TM@1
AugReg
52.0
71.4
297.10
773
4.1
+ G2TM † @2
AugReg
52.2
77.8
260.23
655
8.1
EoMT
DINOv2
58.1
59.5
394.44
1024
-
+ G2TM@1
DINOv2
52.5
81.2
231.71
590
14.3
Table 9: EoMT’s semantic segmentation results using two different backbone’s pre-training weights. We compare them with G2TM’s configurations chosen in Section 4 . @ l and [ τ ] indicate the application layer and the threshold value respectively.
Figure 6: Distributions of cosine similarities between adjacent tokens in EoMT. From top to bottom: AugReg and DINOv2 pretraining weights. From left to right: distributions computed at 1st, 2nd, 3rd and 4th layers. The distributions are computed over the training set of ADE20K.
Tokens
Model
mIoU ↗
FPS ↗
GFLOPs ↘
Count
Mean size
Seg-T
73.5
64.7
43.55
2304
-
+ G2TM † @2
72.0
80.1
29.66
1722
8.3
Seg-S
76.6
31.5
115.98
2304
-
+ G2TM † @2
76.2
48.7
84.04
1767
8.2
Seg-B
77.6
14.4
347.60
2304
-
Table 10: Semantic segmentation results on Cityscapes 768×768 . We evaluate Segmenter models with a Mask Transformer decoder and compare them with the chosen G2TM’s configuration inserted in the backbone. @ l indicates the application layer.
Tokens
Model
mIoU ↗
FPS ↗
GFLOPs ↘
Count
Mean size
Seg-T
73.1
32.8
116.86
4096
-
+ G2TM † @2
71.9
42.8
70.85
2857
8.9
Seg-S
76.6
15.7
285.03
4096
-
+ G2TM † @2
75.4
20.9
186.59
2956
8.6
Seg-B
77.1
6.8
775.51
4096
-
Table 11: Semantic segmentation results on Cityscapes 1024×1024 . We evaluate Segmenter models with a Mask Transformer decoder and compare them with the chosen G2TM’s configuration inserted in the backbone. @ l indicates the application layer.
The quadratic cost of self-attention in Vision Transformers (ViTs) constitutes a fundamental bottleneck for practical deployment, motivating a vibrant line of research on token reduction. Among existing approaches, token merging (ToMe) has emerged as an elegant training-free solution; yet its design rests on an unspoken premise of token equality, which contravenes the well-documented non-uniformity of self-attention and leads to information loss in high-salience tokens under aggressive compression. We address this limitation with AdaMerge, a token-merging framework based on two complementary mechanisms. First, salience-weighted similarity leverages column-wise feature-affinity centrality as a token-importance proxy and incorporates the resulting salience scores into the bipartite matching score, ensuring that pivotal tokens contribute more strongly to the merged representation. Second, adaptive merging intensity uses pre-computed layer-wise similarity statistics to dynamically modulate the per-layer reduction count in accordance with input-specific redundancy. On ImageNet-1k with ViT-B/16, AdaMerge consistently outperforms ToMe, PiToMe, and DSM across all FLOPs-matched regimes. The accuracy gap widens monotonically with compression: at the 13.4G FLOPs operating point, AdaMerge sustains a Top-1 degradation of only -1.06%, compared to -1.45% for PiToMe and -4.62% for DSM. To our knowledge, AdaMerge is the first to combine salience-weighted similarity and adaptive per-layer reduction into a single training-free token merging framework, advancing the accuracy-FLOPs Pareto frontier of ViT acceleration.
Semi Lee, Hyejin Go, Hyesong Choi
Electronic Engineering · Soongsil University · Seoul, South Korea
Decreasing sequence length is a common way to accelerate transformers, but prior token reduction work often targets classification and reports proxy metrics rather than end-to-end latency. For semantic segmentation, token reduction is further constrained by the need to reconstruct dense, pixel-aligned features, and on modern accelerators the overhead of computing merge maps can erase expected gains. We propose Mutual Pair Merging (MPM), a training-free token aggregation module that forms mutual nearest-neighbor pairs in cosine space, averages each pair, and records a merge map enabling a gather-based reconstruction before the decoder so that existing segmentation heads can be used unchanged. MPM introduces no learned parameters and no continuous compression knob (no keep-rate or threshold). The speed-accuracy trade-off is set by a discrete insertion schedule. We benchmark end-to-end latency on an NVIDIA H100 GPU (with and without FlashAttention-2) and a Raspberry Pi 5 across standard segmentation datasets. On ADE20K, MPM reduces per-image latency by up to 60% for ViT-Tiny on Raspberry Pi 5, and increases throughput by up to 20% on H100 with FlashAttention-2 while keeping the mIoU drop below 3%. These results suggest that simple, reconstruction-aware, training-free token merging can translate into practical wall-clock gains for segmentation when overhead is explicitly accounted for.
Simon Ravé, Pejman Rasti, David Rousseau
LARIS University of Angers Angers, France · UMR INRAe-IRHS Angers, France
Vision Transformers achieve strong performance but incur high computational costs from quadratic token interactions. Training-free token reduction methods improve efficiency, but their robustness remains underexplored. We propose Prune-and Merge ViT, a training-free framework for off-the-shelf models. It combines class attention-based pruning with similarity-based merging to reduce redundancy while preserving semantic information. To evaluate robustness we introduce two metrics. Relative Accuracy Drop (RAD) measures relative accuracy degradation under transformations, and Prediction Flip Rate (PFR) quantifies prediction consistency. On pretrained ViT and DeiT, Prune-and-Merge reduces computation competitively while maintaining robustness and better accuracy than existing token reduction methods. Our analysis suggests that hybrid token reduction does not introduce hallucination-like behavior and preserves prediction stability for common image transformations.
Vatsal, Soumil Malhotra, Priyanshu Chahal +1
Department of Mathematics, Indian Institute of Technology Roorkee