Manuscript Offprint
arXiv:2610.21642SCMerge: Spatial-Consistency-Aware Token Pair Merging for Efficient Semantic Segmentation
Abstract
Vision Transformer architectures have showcased impressive performance on semantic segmentation, yet their quadratic attention complexity hinders practical applications. Recent works have focused on merging tokens to reduce sequence length and thus improve transformer efficiency. However, existing token merging methods primarily rely on feature similarity to identify similar tokens, overlooking spatial consistency, which may introduce segmentation errors in semantic segmentation. In this work, we propose SCMerge, a training-free token merging method that jointly considers feature similarity and spatial consistency in pairing similar tokens. The pairwise tokens are then merged within the encoder, and the resulting token sequences are reconstructed onto the original patch grid after decoding. The proposed method is flexible and can be plugged into existing vision Transformer-based semantic segmentation pipelines. Extensive experiments on the benchmark datasets ADE20K, Pascal Context, and Cityscapes show that SCMerge consistently achieves a better trade-off between segmentation accuracy and efficiency than baseline methods.
1. Introduction
Semantic segmentation has made significant progress with the recent introduction of Vision Transformers (ViTs) [8, 24, 29, 37]. However, ViTs with self-attention suffer from quadratic computational complexity and long latency, limiting their application to high-resolution images. A primary avenue for addressing this issue is to reduce token sequence length in self-attention and streamline computation [1, 17, 23, 25, 28, 30, 36]. Although most existing token reduction methods work well for image classification, they often struggle in dense prediction tasks, such as semantic segmentation. The main challenge is to reduce the token sequence length while preserving the spatial and semantic details required by the segmentation decoder.
This work focuses on ViT-based semantic segmentation and aims to present a training-free token merging method to improve the efficiency of existing pipelines. Existing training-free token reduction methods have shown that merging similar tokens can effectively reduce the token sequence length and computational complexity. ToMe performs bipartite matching in feature space and merges similar tokens via averaging [1]. Mutual Pair Merging (MPM) employs mutual nearest-neighbor matching and combines the matched tokens, yielding computation and latency improvements without modifying segmentation decoders [26]. In addition, ALGM employs a segmentation-specific local-to-global merging schedule that combines local and global token matching [22]. Despite their potential, existing methods mainly match tokens based on feature similarity, which can cause segmentation errors when local feature content is similar but the tokens are spatially or globally different. Tokens near semantic boundaries may be incorrectly paired with interior tokens from neighboring regions, leading to boundary blurring. In addition, interior tokens from different objects can have similar features and be mistakenly identified as redundant. More recently, several works [13, 19] have proposed to address this issue by introducing spatial information or learned policies, but at the cost of additional inputs or training.
In this paper, we propose SCMerge, a training-free token merging method to reduce the token length in ViT-based semantic segmentation pipelines, aiming to achieve a better trade-off between segmentation accuracy and computational cost. To guide the merging process, We introduce a token-pairing criterion that jointly considers local feature similarity and spatial consistency. By merging only tokens that are similar in both feature and spatial consistency, this mechanism improves the efficiency–accuracy trade-off. Specifically, we first compute the cosine similarity between all token pairs. A local variance measure is then used to identify tokens that are near semantic boundaries or lie in a smooth interior region. For each candidate pair, we compute a spatial-consistency penalty that discourages merging of locally similar but boundary-sensitive tokens, as well as tokens belonging to different objects. Finally, paired tokens are merged via feature averaging, and the reduced token sequence is passed through the segmentation decoder before being mapped back to the original token grid. This design refines the token pairing process to preserve semantic boundaries and neighborhood spatial consistency, improving segmentation efficiency.
Our SCMerge does not require additional supervision, extra input modalities, or modifications to the segmentation head, allowing it to be plugged into ViT-based semantic segmentation pipelines. We evaluate the effectiveness of the proposed token merging module using ViT-based segmentation models [29] on three semantic segmentation datasets, including ADE20K [38], Pascal Context [21], and Cityscapes [5]. Experimental results demonstrate that plugging our SCMerge module into ViT-based semantic segmentation models improves the trade-off between computational complexity and segmentation accuracy. Our contributions can be summarized as follows:
• We propose a novel training-free token-pair merging method that incorporates a spatial-consistency penalty into feature-similarity-based matching. This method prevents the merging of locally similar but spatially incompatible tokens and improving the accuracy–efficiency trade-off.
• We design a local feature variation metric to identify boundary-sensitive tokens and introduce a spatial-consistency penalty, comprising a boundary-sensitive term and a neighborhood consistency term, to reduce incorrect merging near semantic boundaries and preserve fine spatial detail.
• Extensive experiments demonstrate that our method can be integrated into ViT-based semantic segmentation models to achieve a better accuracy-efficiency trade-off than baseline methods relying only on feature similarity.
Token Reduction in Vision Transformers. Many recent methods accelerate ViTs by reducing the token sequences passed to subsequent layers. DynamicViT [25] learns to prune uninformative tokens dynamically, while TokenLearner [28] learns a compact set of informative tokens. A-ViT [36] introduces adaptive token halting, and IA-RED [23] reduces redundancy with interpretability-aware token selection. Patch Slimming [30] and SPViT [15] study efficient token pruning, while ATS [9] samples tokens adaptively. Token Pooling [20], STViT [12], HeatViT [7], and DiffRate [3] further explore pooling, sampling, pruning, or learnable compression rates. These methods either target image classification or require learned policies, retraining, or architecture-specific modifications. Unlike classification tasks, preserving thin structures and fine boundaries is critical in dense prediction tasks. This depends on having a sufficient number of tokens for accurate reconstruction and precise predictions. This work introduces a training-free token merging method designed for dense prediction.
Training-free Token Merging. Token merging has emerged as an effective technique for improving the efficiency of ViTs. By combining similar tokens rather than discarding them, token merging methods substantially reduce computational complexity and latency in image classification and semantic segmentation. ToMe [1] is a training-free token merging method that matches feature-similar tokens and averages them progressively inside the encoder. Several works have extended token merging with learned or adaptive mechanisms, including learned patch merging [27], efficient token merging [10], delayed spatial merging [11], and learned pruning-and-merging thresholds [2]. In addition, fusion-based or saliency-driven methods, such as token fusion [14], multi-criteria fusion [16], spectrum-preserving merging [31], learnable token merging [33], and saliency-driven merging [35] have been studied for token merging. Mutual Pair Merging (MPM) [26] forms mutual nearest-neighbor token pairs and preserves a reconstruction map before the dense prediction decoder. These methods can significantly improve ViT efficiency by averaging similar tokens, but their token grouping strategies mainly rely on feature similarity, which neglects spatial consistency when measuring token similarity. Our SCMerge addresses this limitation by using local feature variation to pair tokens in a more spatial-aware manner.
Spatial-aware Token Merging for Semantic Segmentation. Several recent methods have incorporated task-specific or spatial information to improve token merging for semantic segmentation. CTS [19] learns a content-aware token-sharing policy to preserve semantic structures. ALGM [22] designs an adaptive local-to-global merging schedule for segmentation backbones. ToSA [13] introduces spatial awareness into token merging so that merging decisions consider both visual feature similarity and spatial information. These methods demonstrate the importance of spatial information for semantic segmentation, but they often rely on learned policies, specialized schedules, additional spatial information, or method-specific implementations. SCMerge follows the same motivation of spatial-aware token merging, but it is training-free and can be plugged into existing ViT-based semantic segmentation pipelines.
3. Method
As illustrated in Figure 1, SCMerge is a training-free module that can be inserted into multiple blocks of a ViT encoder to reduce the token sequence length from to (), while maintaining a merge map for reconstructing compact segmentation head outputs onto the original token grid after decoding. Let denote the image tokens at a merge layer, where is the number of input tokens and is the feature dimension. Each token is indexed by a representative coordinate for local neighborhood statistics, while a merge map tracks reconstruction assignments across merging stages. At each insertion, SCMerge first computes a feature-similarity matrix to measure content similarity between tokens. It then calculates local context variation within a token neighborhood and uses this variation to assign a spatial-consistency penalty score when forming matching pairs. The matched token pairs are merged into a reduced sequence . The merged tokens are then propagated through the remaining backbone layers, while the corresponding merge map is stored. The merged tokens are then fed into the decoder and segmentation head of the original ViT-based model to produce compact prediction logits. Finally, the merge map is used to reconstruct these compact logits onto the final semantic segmentation results.
3.1. Preliminaries
We follow existing semantic segmentation models [29] and use a standard Vision Transformer (ViT) encoder [8] and Mask Transformer decoder as our backbone. Given an input image of size and patch size , the image is divided into non-overlapping patches. Each patch is linearly projected into a d-dimensional embedding, which is added to a learned positional embedding, resulting in the initial token sequence . These tokens are then processed by a stack of Transformer blocks consisting of self-attention and feed-forward layers.
The decoder then jointly processes the tokens from the encoder together with C learnable class embeddings, where C denotes the number of semantic classes. After the Transformer decoder layers, the output image and class embeddings are projected and normalized, and the pairwise inner products between the image embeddings and the class embeddings produce patch-level class logits. In the original full-token model, these logits correspond to the patch locations and are reshaped into an patch grid. They are then upsampled to the input resolution via bilinear interpolation.
SCMerge Insertion. SCMerge is inserted after selected ViT encoder blocks and operates on the current token sequence. At each insertion, SCMerge reduces the token sequence length from N to . To support multiple merge layers, SCMerge maintains a representative coordinate for each token and a merge map. The coordinate indicates the token's position in the sparse token layout used for variation computation, while the merge map records, for each original patch location, the token that represents it. The merge map is updated after each merge stage. The reduced token sequence is then propagated through the remaining encoder blocks and passed through the Mask Transformer decoder. The decoder architecture and parameters remain unchanged, while only the number of input tokens is reduced. After decoding, the merge map restores the reduced logits to the original patch grid, followed by bilinear upsampling to the input resolution.
3.2. Spatial-Consistency-Aware Token Merging
Local Feature Variation. Following existing training-free token merging methods [1, 26], we use cosine similarity to measure token similarity. For each normalized token feature , the pairwise token similarity is given by
denotes the pairwise feature similarity between tokens i and j, and the diagonal entries of S are set to to avoid self-matching. To estimate local variation efficiently, we form a deterministic -channel sketch by averaging contiguous groups of the normalized feature channels. The sketches are placed on the current sparse token layout, where the channel-wise variance within each neighborhood is averaged to obtain a scalar variation . The sketch is used only for local-variation

Figure 1. Overview of SCMerge. SCMerge is a plug-and-play module that can be inserted into multiple ViT encoder blocks to reduce the token sequence length while maintaining a merge map. It combines feature similarity with a spatial-consistency penalty to guide similar token pairing and merging. The reduced token sequence remains compact throughout decoding and is reconstructed onto the original dense prediction grid only after the decoder.
estimation, while token similarity and merging retain the full-dimensional features. We then apply min-max normalization across the active tokens:
represents a normalized local variation score that quantifies the feature variation around . A low indicates a spatially homogeneous neighborhood, while a high indicates strong local feature variation, typically occurring near semantic boundaries, thin structures, or heterogeneous regions.
Spatial-Consistency-Aware Token Pairing. We first define a score to detect token pairs that may cross semantic boundaries, that is,
Since takes the maximum local variation of the two endpoints, it grows when either token lies in a high-variation region, such as near boundaries or thin structures. This penalty term discourages boundary tokens from being merged with interior tokens, thus reducing boundary blurring and preserving spatial detail.
Next, we define a neighborhood consistency score between candidate tokens i and j as the absolute difference of their local variation values:
where measures the difference in local feature variation between tokens i and j. Even if two tokens have similar local content, a large implies they belong to different structural regions and should not be merged. The final spatial-consistency penalty is defined as the Euclidean norm of the boundary-sensitivity term and the neighborhood consistency term :
The merge score is defined by subtracting the spatial-consistency penalty from the feature similarity:
where is the final merge score used for mutual pair selection. A high indicates that tokens i and j are feature-similar and that their merge is spatially consistent (i.e., the pair is less likely to involve boundary-sensitive or locally inconsistent regions). The merge score matrix A is used to determine which pairs of tokens are similar and can be merged. For each token i, we find its most similar neighbor token j by selecting the one with the highest merge score:
The most similar token is selected as the maximum . Since the pair selection only relies on the ranking of , is not constrained to be non-negative. As with the similarity matrix S, the diagonal of A is set to to avoid self-matching. As in [26], we define that a pair
Algorithm 1 SCMerge at one insertion
Input: token sequence , representative coordinates, merge map
Output: reduced sequence , representative coordinates, merge map
1: Compute the feature similarity , where
2: Compute from the -channel sketch over the neighborhood and normalize
3: Compute the spatial-consistency penalty and the merge score
4: Find and select mutual pairs
5: Merge each pair by and retain its representative coordinate; keep unmatched tokens
6: return , representative coordinates, and merge map
is selected only when the nearest-neighbor relation is reciprocal:
where P denotes the set of selected mutual pairs. Tokens that do not belong to any selected pair remain as singletons.
Token Pair Merging. For each selected token pair , the two tokens are merged by averaging their features, producing a new token:
The merged token retains its representative coordinate, keeping all active coordinates on the original patch grid. Unpaired tokens are kept unchanged as singletons. The resulting token sequence is , where denotes the total number of tokens after merging. Algorithm 1 summarizes the overall procedure of SCMerge.
3.3. Decoding and Reconstruction
The reduced token sequence Y is passed through the segmentation decoder without spatial expansion, and the original token grid is reconstructed only after decoding for dense prediction. The segmentation decoder processes the merged token sequence Y and produces class logits , where C is the number of semantic classes. The merge map maps each merged token's logits back to the original patch locations, reconstructing the patch logits. These logits are then reshaped into the original patch grid and bilinearly upsampled to the input resolution. For the Mask Transformer decoder, the M reduced tokens are jointly processed with C class embeddings, resulting in a sequence of tokens. Thus, the token reduction is preserved across the entire encoder–decoder pipeline. The decoder remains unchanged in architecture and parameters, introducing no extra learnable parameters.
4. Experiments
This section evaluates the effectiveness and generalization of our method on semantic segmentation. We plug our token merging method into existing ViT-based semantic segmentation models and present quantitative and qualitative comparisons on three benchmark semantic segmentation datasets among full-token baseline models, models with feature-similarity-based token merging, and models with our method. Later, we also provide a comprehensive ablation study supporting our design choices.
4.1. Experimental Setup
Datasets and Models. We conduct experiments on three datasets: ADE20K [38], Pascal Context [21], and Cityscapes [5], which respectively cover scene parsing, object and stuff segmentation, and high-resolution street scenes. Our experiments use Segmenter [29] as a baseline full-token model. To provide a fair comparison, we retain its released encoder and Mask Transformer decoder and keep the input resolution and validation protocol of each checkpoint unchanged. We insert the token merging operation after the second and fifth encoder blocks by default.
Implementation Details. We fix the deterministic channel-sketch width to across all datasets and backbones, using zero padding only when the feature dimension is not divisible by . After each merge stage, the remaining tokens are scattered onto a zero-filled sparse grid at their retained representative coordinates; only token features are averaged during merging. We use zero-padded average pooling with a fixed denominator to compute the first and second moments, and derive the variance as the centered second moment. Assignment maps are combined across merge stages and used to reconstruct the dense logits after decoding the reduced tokens.
Baselines. We use the officially released Segmenter checkpoint as the full-token baseline model and as the backbone of all training-free token merging methods: ToMe [1], MPM [26], and SCMerge. For ToMe [1], we use r = 200 for the 1024-token Segmenter-B/16 setting and scale r proportionally with the initial token count for other resolutions and backbones, preserving the same per-layer reduction ratio. To compare our method with MPM under a similar token budget, we configure MPM to merge the top 76% of token pairs, and refer to this configuration as MPM-top.
Evaluation Metrics. We report mIoU, the average final token count , GFLOPs, and latency. Since
Table 1. Quantitative comparison results on ADE20K, Pascal Context, and Cityscapes with Segmenter backbones.
| Model/Method | mIoU | GFLOPs | Latency (ms) | R↑ | |
|---|---|---|---|---|---|
| ADE20K | |||||
| Segmenter-B/16 | 48.48 | 1024.00 | 258.80 | 29.77 | - |
| ToMe (r=200) | 48.01 | 624.00 | 193.65 | 20.13 | 20.51 |
| MPM | 47.81 | 563.29 | 182.75 | 19.58 | 15.21 |
| MPM-top (76%) | 48.22 | 655.46 | 198.36 | 22.90 | 26.42 |
| SCMerge | 48.42 | 653.98 | 181.21 | 20.82 | 149.17 |
| Segmenter-B/8 | 49.57 | 4096.00 | 1319.38 | 158.80 | - |
| ToMe | 49.15 | 2496.00 | 854.96 | 100.33 | 139.21 |
| MPM | 49.20 | 2247.40 | 802.61 | 91.81 | 181.05 |
| MPM-top | 49.26 | 2621.96 | 911.04 | 110.23 | 156.68 |
| SCMerge | 49.38 | 2639.09 | 908.26 | 107.86 | 268.11 |
| Segmenter-L/16 | 51.81 | 1600.00 | 1343.32 | 134.13 | - |
| ToMe | 51.48 | 976.00 | 886.72 | 80.58 | 162.27 |
| MPM | 51.02 | 876.40 | 818.72 | 73.89 | 76.25 |
| MPM-top | 51.45 | 1020.21 | 919.94 | 89.29 | 124.56 |
| SCMerge | 51.64 | 1040.61 | 892.82 | 87.43 | 274.71 |
| Pascal Context | |||||
| Segmenter-L/16 | 58.08 | 900.00 | 685.67 | 56.89 | - |
| ToMe | 57.74 | 548.00 | 461.34 | 38.69 | 53.53 |
| MPM | 57.46 | 486.28 | 418.49 | 34.87 | 35.52 |
| MPM-top | 57.78 | 567.75 | 470.45 | 41.00 | 52.97 |
| SCMerge | 57.94 | 581.48 | 456.49 | 39.51 | 124.14 |
| Cityscapes | |||||
| Segmenter-S/16 | 76.35 | 2304.00 | 232.07 | 35.98 | - |
| ToMe | 75.43 | 1404.00 | 161.97 | 24.90 | 12.04 |
| MPM | 75.30 | 1334.67 | 159.70 | 24.42 | 11.01 |
| MPM-top | 75.52 | 1530.32 | 174.66 | 28.72 | 8.75 |
| SCMerge | 75.68 | 1565.60 | 162.22 | 26.52 | 14.12 |
| Segmenter-L/16 | 79.01 | 2304.00 | 2010.69 | 208.92 | - |
| ToMe | 78.03 | 1404.00 | 1266.86 | 125.36 | 85.27 |
| MPM | 77.72 | 1299.06 | 1190.04 | 118.68 | 69.95 |
| MPM-top | 78.23 | 1498.76 | 1346.05 | 133.54 | 96.64 |
| SCMerge | 78.48 | 1535.59 | 1337.82 | 132.80 | 143.62 |
token reduction is input-dependent, and GFLOPs are averaged over the entire validation set. Latency is measured on an NVIDIA RTX 3090 with batch size 1 in FP32 with TF32 disabled. We time the complete model forward pass, including merging and reconstruction but excluding data loading and preprocessing. After 50 warm-up iterations, the full validation set is evaluated five times with explicit CUDA synchronization, and the mean per-image latency is reported. All methods use the same hardware and software environment. Moreover, to quantify the trade-off between latency improvement and accuracy drop, we define
where the numerator denotes the latency reduction relative to the full-token baseline and the denominator denotes the corresponding mIoU decrease. A larger R indicates greater latency reduction per unit of accuracy loss. We report R jointly with the corresponding raw mIoU and latency values.
4.2. Quantitative Comparison
Table 1 reports quantitative comparison results between the full-token baseline and token-merging methods in terms of mIoU, , GFLOPs, latency and accuracy-latency trade-off ratio . We observe that all training-free methods can be plugged into existing segmentation models and improve their accuracy-latency trade-off. MPM achieves the lowest latency but sacrifices more segmentation accuracy than other token merging methods. Under a matched token budget, MPM-top achieves better segmentation accuracy than the original MPM but leads to higher latency. Our SCMerge, with spatial-consistency-aware token merging, achieves the best accuracy-latency trade-off among all training-free token merging methods. Specifically, on ADE20K, our SCMerge consistently achieves the highest mIoU and the highest among the training-

Figure 2. Token-reduction and spatial-consistency visualization. SCMerge selects spatial-consistency token pairs with lower boundary sensitivity and neighborhood consistency than competing methods.
Reference

Predictions
Error maps
Correct Incorrect
Figure 3. Qualitative segmentation comparison on ADE20K. Prediction and error maps show that SCMerge produces fewer segmentation errors than the baseline token-merging methods, achieving the lowest pixel error rate.
free methods, showing that its accuracy–latency advantage is maintained as token density and backbone capacity increase. The same trend transfers to Pascal Context and Cityscapes. Although MPM generally achieves lower raw latency, SCMerge consistently preserves higher segmentation accuracy and yields a higher R, indicating a more favorable accuracy–latency trade-off. Across all six model–dataset settings, SCMerge improves over MPM by 0.18–0.76 mIoU while reducing full-token latency by approximately 26%–36%, without retraining or dataset-specific fine-tuning.
4.3. Qualitative Comparison
In Figure 2, we visualize the token assignment maps that indicate the source patches for each merged token, along with the spatial-consistency penalty values of the selected pairs. Our SCMerge achieves the lowest average values of both and across all compared methods. This result is consistent with the intended effect of the spatial-consistency penalty, which prioritizes pairs with low boundary sensitivity and small neighborhood inconsistency. The corresponding visualization shows that the proposed criterion encourages more spatially consistent
Table 2. Quantitative ablation study of spatial-consistency penalty and post-decoder reconstruction on ADE20K with Segmenter-B/16
| Variant | mIoU | Latency | R |
|---|---|---|---|
| Full tokens | 48.48 | 29.77 | - |
| w/o penalty and Post-decoder Reconstruction | 47.69 | 19.97 | 12.41 |
| w/o penalty | 47.56 | 16.63 | 14.28 |
| w/o Post-decoder | 48.44 | 24.01 | 144.00 |
| Full model | 48.42 | 20.82 | 149.17 |
token merging.
Figure 3 provides a visual comparison of the resulting segmentation predictions and the corresponding pixel-wise error maps. The visualization results show that our SCMerge achieves higher segmentation accuracy and a fewer pixel-wise error rate that baseline token-merging methods: ToMe, MPM, and MPM-top, with an error rate of compared to , , and , respectively. This is consistent with the quantitative comparison results, demonstrating that spatial-consistency-aware token pairing is effective in preserving segmentation quality after token reduction.
4.4. Ablation
Table 2 provides the effectiveness of spatial-consistency-aware token pairing and post-decoder reconstruction. We compare our full design with three variants: 1) without both spatial-consistency penalty and post-decoder reconstruction, i.e., reconstructing the original token grid before the decoder (w/o penalty and Post-decoder); 2) without spatial-consistency penalty (w/o penalty); and 3) without post-decoder reconstruction (w/o Post-decoder). We observe that the spatial-consistency penalty improves segmentation accuracy while slightly increasing latency, whereas post-decoder reconstruction significantly reduces latency but slightly reduces accuracy. Our full design with both spatial-consistency penalty and post-decoder reconstruction achieves a better overall accuracy-latency trade-off.
Figure 4 analyzes the effect of insertion depth on the accuracy–efficiency trade-off. Applying token merging at earlier encoder stages yields greater computational savings in subsequent layers but makes token matching more susceptible to incorrect pairing. In contrast, merging at later stages preserves finer spatial structures and segmentation accuracy at the cost of reduced latency gains. Therefore, token merging is performed in the early-to-middle encoder blocks.
4.5. Analyses
Boundary Preservation. Table 3 reports B-mIoU@5 (mIoU within 5 pixels of boundaries) and B-Merge (fraction of boundary tokens involved in merges). Our

Figure 4. Accuracy–latency trade-off of MPM and our SCMerge on ADE20K. Labels denote zero-based encoder-block indices. Our SCMerge consistently achieves a higher mIoU and a better accuracy–latency trade-off than MPM.
Table 3. Effect of the boundary-sensitivity term on ADE20K.
| Method | B-mIoU@5 ↑ | B-Merge (%) ↓ |
|---|---|---|
| Full tokens | 35.37 | - |
| MPM | 34.22 | 50.33 |
| MPM-top | 34.59 | 42.55 |
| SCMerge | 35.29 | 22.55 |
Table 4. Effect of the neighborhood consistency term on ADE20K.
| Method | Cross-cls (%) ↓ | N-Agree (%) ↑ |
|---|---|---|
| MPM | 3.874 | 93.28 |
| MPM-top | 3.252 | 94.01 |
| SCMerge | 2.168 | 95.25 |
SCMerge improves B-mIoU@5 while sharply reducing B-Merge, confirming that the boundary-sensitivity term prevents boundary tokens from being merged, improving boundary segmentation quality.
Neighborhood Consistency. Table 4 reports the neighborhood consistency of selected token pairs. Cross-cls denotes the fraction of pairs connecting tokens from different classes, while N-Agree measures the position-wise label agreement between the neighborhoods of paired tokens. Our SCMerge produces significantly fewer cross-class pairs and achieves higher N-Agree, indicating that effectively promotes the selection of semantically consistent token pairs.
5. Conclusion
In this work, we presented SCMerge, a training-free token merging method that conducts token merging based on both feature similarity and spatial consistency for semantic segmentation. The method is flexible and can be plugged into existing ViT-based semantic segmentation models for improving computation efficiency with less quality drop. Extensive comparison experiments on three benchmark semantic segmentation datasets ADE20K, Pascal Context, and Cityscapes demonstrate that our SCMerge can achieve better accuracy-latency trade-off compared with existing state-of-the-art training-free token merging methods. Although our SCMerge with the spatial-consistency penalty mitigates boundary blurring, very small objects and extremely thin structures may still be smoothed due to information aggregation. In addition, since SCMerge is training-free and introduces no learnable parameters, its merging decisions are based on fixed, hand-designed criteria. This may limit its adaptability to diverse or unseen visual patterns. Addressing these limitations is a direction for our future work while preserving the plug-and-play and training-free advantages of SCMerge.
References
[1] Daniel Bolya, Cheng-Yang Fu, Xiaoliang Dai, Peizhao Zhang, Christoph Feichtenhofer, and Judy Hoffman. Token merging: Your vit but faster. In International Conference on Learning Representations, 2023.
[2] Maxim Bonnaerens and Joni Dambre. Learned thresholds token merging and pruning for vision transformers. Transactions on Machine Learning Research, 2023.
[3] Mengzhao Chen, Wenqi Shao, Peng Xu, Mingbao Lin, Kaipeng Zhang, Fei Chao, Rongrong Ji, Yu Qiao, and Ping Luo. Diffrate: Differentiable compression rate for efficient vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 17164–17174, 2023.
[4] Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, and Rohit Girdhar. Masked-attention mask transformer for universal image segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1290–1299, 2022.
[5] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3213–3223, 2016.
[6] Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memory-efficient exact attention with io-awareness. Advances in neural information processing systems, 35:16344–16359, 2022.
[7] Peiyan Dong, Mengshu Sun, Alec Lu, Yanyue Xie, Kenneth Liu, Zhenglun Kong, Xin Meng, Zhengang Li, Xue Lin, Zhenman Fang, and Yanzhi Wang. Heatvit: Hardware-efficient adaptive token pruning for vision transformers. In 2023 IEEE International Symposium on High-Performance Computer Architecture (HPCA), pages 442–455. IEEE, 2023.
[8] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An im-
age is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021.
[9] Mohsen Fayyaz, Soroush Abbasi Koohpayegani, Farnoush Rezaei Jafari, Sunando Sengupta, Hamid Reza Vaezi Joze, Eric Sommerlade, Hamed Pirsiavash, and Juergen Gall. Adaptive token sampling for efficient vision transformers. In European Conference on Computer Vision, pages 396–414. Springer, 2022.
[10] Zhanzhou Feng and Shiliang Zhang. Efficient vision transformer via token merger. IEEE Transactions on Image Processing, 32:4156–4169, 2023.
[11] Jung Hwan Heo, Seyedarmin Azizi, Arash Fayyazi, and Massoud Pedram. Training-free acceleration of vits with delayed spatial merging. arXiv preprint arXiv:2303.02331, 2023.
[12] Huaibo Huang, Xiaoqiang Zhou, Jie Cao, Ran He, and Tieniu Tan. Vision transformer with super token sampling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22690–22699, 2023.
[13] Hsiang-Wei Huang, Wenhao Chai, Kuang-Ming Chen, Cheng-Yen Yang, and Jeng-Neng Hwang. Tosa: Token merging with spatial awareness. In 2025 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 9654–9660. IEEE, 2025.
[14] Minchul Kim, Shangqian Gao, Yen-Chang Hsu, Yilin Shen, and Hongxia Jin. Token fusion: Bridging the gap between token pruning and token merging. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 1383–1392, 2024.
[15] Zhenglun Kong, Peiyan Dong, Xiaolong Ma, Xin Meng, Wei Niu, Mengshu Sun, Xuan Shen, Geng Yuan, Bin Ren, Hao Tang, Minghai Qin, and Yanzhi Wang. Spvit: Enabling faster vision transformers via latency-aware soft token pruning. In European Conference on Computer Vision, pages 620–640. Springer, 2022.
[16] Sanghyeok Lee, Joonmyung Choi, and Hyunwoo J. Kim. Multi-criteria token fusion with one-step-ahead attention for efficient vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15741–15750, 2024.
[17] Youwei Liang, Chongjian Ge, Zhan Tong, Yibing Song, Jue Wang, and Pengtao Xie. Not all patches are what you need: Expediting vision transformers via token reorganizations. In International Conference on Learning Representations, 2022.
[18] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF international conference on computer vision, pages 10012–10022, 2021.
[19] Chenyang Lu, Daan De Geus, and Gijs Dubbelman. Content-aware token sharing for efficient semantic segmentation with vision transformers. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 23631–23640, 2023.
[20] Dmitrii Marin, Jen-Hao Rick Chang, Anurag Ranjan, Anish Prabhu, Mohammad Rastegari, and Oncel Tuzel. Token pooling in vision transformers for image classification. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 12–21, 2023.
[21] Roozbeh Mottaghi, Xianjie Chen, Xiaobai Liu, Nam-Gyu Cho, Seong-Whan Lee, Sanja Fidler, Raquel Urtasun, and Alan Yuille. The role of context for object detection and semantic segmentation in the wild. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 891–898, 2014.
[22] Narges Norouzi, Svetlana Orlova, Daan De Geus, and Gijs Dubbelman. Algm: Adaptive local-then-global token merging for efficient semantic segmentation with plain vision transformers. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 15773–15782, 2024.
[23] Bowen Pan, Rameswar Panda, Yifan Jiang, Zhangyang Wang, Rogerio Feris, and Aude Oliva. Ia-red : Interpretability-aware redundancy reduction for vision transformers. In Advances in Neural Information Processing Systems, pages 24898–24911, 2021.
[24] René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12179–12188, 2021.
[25] Yongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. Dynamicvit: Efficient vision transformers with dynamic token sparsification. Advances in neural information processing systems, 34: 13937–13949, 2021.
[26] Simon Ravé, Pejman Rasti, and David Rousseau. MPM: Mutual pair merging for efficient vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Findings, pages 2998–3008, 2026.
[27] Cédric Renggli, André Susano Pinto, Neil Houlsby, Basil Mustafa, Joan Puigcerver, and Carlos Riquelme. Learning to merge tokens in vision transformers. arXiv preprint arXiv:2202.12015, 2022.
[28] Michael S. Ryoo, A. J. Piergiovanni, Anurag Arnab, Mostafa Dehghani, and Anelia Angelova. Tokenlearner: Adaptive space-time tokenization for videos. In Advances in Neural Information Processing Systems, pages 12786–12797, 2021.
[29] Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for semantic segmentation. In Proceedings of the IEEE/CVF international conference on computer vision, pages 7262–7272, 2021.
[30] Yehui Tang, Kai Han, Yunhe Wang, Chang Xu, Jianyuan Guo, Chao Xu, and Dacheng Tao. Patch slimming for efficient vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12165–12174, 2022.
[31] Hoai-Chau Tran, Duy M. H. Nguyen, Duy M. Nguyen, TrungTin Nguyen, Ngan Le, Pengtao Xie, Daniel Sonntag, James Y. Zou, Binh T. Nguyen, and Mathias Niepert. Accelerating transformers with spectrum-preserving token
merging. In Advances in Neural Information Processing Systems, pages 30772–30810, 2024.
[32] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In Proceedings of the IEEE/CVF international conference on computer vision, pages 568–578, 2021.
[33] Yancheng Wang and Yingzhen Yang. Efficient visual transformer by learnable token merging. IEEE Transactions on Pattern Analysis and Machine Intelligence, 47(11):9597–9608, 2025.
[34] Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. Advances in neural information processing systems, 34:12077–12090, 2021.
[35] Weiying Xie, Xiaoyu Chen, Xin Zhang, Chenhe Hao, Jitao Ma, Yunsong Li, and Leyuan Fang. Saliency-driven token merging for vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 32184–32193, 2026.
[36] Hongxu Yin, Arash Vahdat, Jose M. Alvarez, Arun Mallya, Jan Kautz, and Pavlo Molchanov. A-vit: Adaptive tokens for efficient vision transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10809–10818, 2022.
[37] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip H. S. Torr, and Li Zhang. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6881–6890, 2021.
[38] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 633–641, 2017.