Manuscript Offprint
arXiv:2610.22921MaskMerge: Structure-aware Token Merging for Efficient Instance Segmentation
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Bavesh Balaji
University Of Waterloo
Letian Jiang
University Of Waterloo
Alexander Wong
University Of Waterloo
David Clausi
University Of Waterloo
Sirisha Rambhatla
University Of Waterloo
sirisha.rambhatla@uwaterloo.ca
Abstract
Token merging improves the efficiency of Vision Transformers by combining redundant tokens, but existing methods largely rely on feature similarity to determine which tokens to merge. This criterion is effective for semantic segmentation, yet can fail in instance segmentation, where adjacent objects of the same class often have highly similar features. We identify this failure mode as cross-instance token fusion. We introduce MaskMerge, an instance-aware token merging method that uses coarse intermediate mask predictions to constrain feature-based merging and preserve instance boundaries. We evaluate MaskMerge on two diverse instance segmentation domains characterized by high inter-instance visual similarity: PanNuke and iSAID. Against the SOTA token merging method ALGM, MaskMerge improves mAP from 30.1 to 32.1 on PanNuke while reducing computation from 229 to 153 GFLOPs and running faster, and from 33.1 to 36.2 on iSAID while reducing computation from 198 to 182 GFLOPs and running faster. Additionally, we also test it on Cityscapes and match ALGM's performance while using fewer FLOPs. The gains also transfer to an MAE-pretrained backbone, demonstrating that instance-aware merging enables more aggressive compression when appearance similarity alone cannot reliably preserve object identity.
1. Introduction
Vision Transformers (ViTs) have become powerful backbones for dense visual recognition, including semantic [49, 58, 63], instance [9, 21, 32], and panoptic segmentation [22]. Their ability to model long-range interactions enables strong spatial reasoning, but comes at a substantial computational cost: self-attention scales quadratically with the

Figure 1. Throughput–accuracy Pareto frontier on PanNuke [17] across ViT-S, ViT-B, and ViT-L backbones. MaskMerge consistently achieves a better accuracy–efficiency trade-off than ToMe [1] and ALGM [43] across model scales, indicating that instance-aware merging enables more aggressive token reduction while better preserving instance segmentation accuracy.
number of visual tokens [40, 60]. This cost is particularly pronounced in segmentation, where high-resolution inputs are required to preserve fine spatial detail [38, 43]. At the same time, dense ViT representations contain considerable redundancy, motivating a growing body of work on reducing the number of tokens processed by the network [10].
Existing token reduction methods broadly fall into pruning, halting, and merging approaches. Token pruning removes representations deemed uninformative, but permanently discarding spatial locations can be undesirable for dense prediction [14, 26, 48, 52, 61, 61]. Token halting reduces computation by terminating selected tokens at inter-mediate layers [13, 33, 50], but requires recovering their spatial information downstream. Token merging instead combines redundant tokens while maintaining a correspondence to the original spatial support, making it particularly attractive for segmentation [1, 24, 38, 43, 46]. Methods such as ToMe [1] and ALGM [43] have demonstrated that substantial computation can be removed with little or even no degradation on semantic segmentation.
A central assumption underlying most existing token merging methods is that feature similarity is a reliable proxy for merge compatibility [1, 42, 43]. Tokens with high cosine similarity are treated as redundant and are therefore natural candidates for aggregation. For semantic segmentation, this assumption is often well aligned with the task: neighboring regions representing the same semantic category should receive the same prediction, and merging similar features within such regions is generally benign.
The same assumption becomes considerably less reliable for instance segmentation specifically for homogeneous data. Here, the model must not only recognize what is present, but also preserve which object each spatial location belongs to [31]. Adjacent instances of the same category can have extremely similar visual representations despite requiring different output masks. Two neighboring nuclei in a histopathology image [17] or vehicles parked side-by-side in an aerial image [62] may therefore be highly similar in feature space while belonging to different instances. A similarity-only merge criterion may consequently aggregate tokens across instance boundaries, as shown in Fig. 2a, a failure mode we term cross-instance token fusion. Fig. 2b quantifies this effect: at the same merge budget, MaskMerge reduces cross-instance merges by and on PanNuke and iSAID respectively in comparison to ALGM [43]. This shows that feature similarity alone is insufficient to determine whether two tokens are safe to merge for an instance-level task, motivating the use of predicted instance structure to enable both safer and more aggressive token reduction.
Further, cross-instance token fusion affects not only accuracy, but also the attainable efficiency. Increasing the merge rate of a similarity-based method eventually introduces more erroneous cross-instance merges, forcing it to retain additional tokens to preserve segmentation quality. A safer merge criterion can instead support more aggressive compression without destroying instance boundaries. Thus, instance awareness offers a dual benefit: it preserves object identity while enabling greater inference throughput.
These insights motivate MaskMerge, an instance-aware token merging framework that incorporates predicted mask structure directly into the merge decision. Modern query-based segmentation models [8, 9, 21] progressively form object-specific representations throughout the network. MaskMerge exploits this intermediate structure rather than introducing an independent grouping mechanism. At an early stage of the encoder, a lightweight mask prediction operation combines the current object queries with the visual tokens to obtain coarse instance masks. These masks provide an inexpensive estimate of the instance assignment of each token. During subsequent token merging, MaskMerge restricts candidate matches to tokens assigned to the same predicted mask before selecting merges according to feature similarity. The resulting operation retains the efficiency and simplicity of similarity-based token merging while substantially reducing opportunities for cross-instance fusion.
We evaluate this distinction in two complementary domains where visually homogeneous instances make appearance-only merging particularly challenging: PanNuke [17] for nuclei instance segmentation and iSAID [62] for aerial instance segmentation. Across these domains, the instance constraint enables MaskMerge to operate at substantially more aggressive compression levels without incurring the degradation observed with similarity-only merging. On PanNuke, MaskMerge reaches 32.1 mAP, compared with 30.1 mAP for ALGM [43], while reducing computation from 229 to 153 GFLOPs and increasing throughput from 121.5 to 142.8 images/s. On iSAID, it improves mAP from 33.1 to 36.2, while reducing computation from 198 to 182 GFLOPs and increasing throughput from 168.8 to 206.9 tiles/s. Additionally, to test MaskMerge on real-world data, we ran ALGM and Maskmerge on Cityscapes, both methods achieve 19.8 AP, but MaskMerge requires only 298 GFLOPs compared with 347 GFLOPs. MaskMerge outperforms ALGM [1] and ToMe [1] across different backbone scales on PanNuke as shown in Fig. 1, demonstrating a better accuracy-throughput tradeoff than cosine methods. Moreover, the benefit is not tied to a single initialization: replacing the standard backbone with an MAE-pretrained variant on PanNuke preserves the advantage, with MaskMerge obtaining 34.0 mAP compared with 32.0 mAP for Compact ALGM.
Together, these results suggest a broader principle for efficient instance-level recognition: visual redundancy and task-level redundancy are not equivalent. Two tokens may be nearly indistinguishable in appearance yet encode different information for an instance segmentation objective. Efficient token reduction should therefore consider not only how similar two representations are, but also whether the task permits them to share a representation. MaskMerge provides a lightweight realization of this principle by using the model's emerging instance structure to guide token aggregation.
Our contributions are threefold:
• We identify and characterize cross-instance token fusion, a failure mode of similarity-based token merging in instance segmentation. Through per-instance analysis, we show that its impact is concentrated in crowded re-
Cross-instance token fusion: cosine merges across nuclei; MaskMerge stays within
ALGM (cosine similarity)
MaskMerge (ours)

GT nucleus (instance)
cross-instance merge — wrong
within-instance merge — safe

(a) Qualitative viz. of cross-instance token fusion in ALGM.
MaskMerge makes far fewer cross-instance merges, at the same token budget → better performance

(b) Cross-instance merge rate at a matched token budget.
Figure 2. Cross-instance token fusion in similarity-based token merging. (a) ALGM frequently merges tokens across different nuclei instances, whereas MaskMerge constrains merges within predicted instances. (b) At the same merge budget, ALGM produces and more cross-instance merges than MaskMerge on PanNuke [17] and iSAID [62], respectively, demonstrating that instance-aware constraints enable safer token reduction.
gions containing adjacent, visually similar instances.
• We introduce MaskMerge, an instance-aware token merging method that uses intermediate coarse masks to constrain feature-based aggregation. MaskMerge exploits structural information already present in the segmentation model and requires neither additional supervision nor an auxiliary training objective.
• We demonstrate a consistently improved accuracy–efficiency trade-off across three distinct instance segmentation domains. MaskMerge outperforms similarity-based ALGM on PanNuke and iSAID and matches its accuracy on Cityscapes at substantially lower computation. The improvement also transfers to a backbone with a different pre-training strategy, supporting the robustness of the proposed merge criterion.
2.1. ViTs for Instance Segmentation
Vision Transformers (ViTs) are well suited to instance segmentation because self-attention captures global object context, while hierarchical or multi-scale features preserve the spatial detail needed for precise mask prediction [15, 27, 53]. Query-based approaches such as DETR represent objects as a set of learned queries, enabling separate predictions for multiple instances of the same category without handcrafted proposal generation [4, 34, 36, 65]. Building on this, MaskFormer reframed segmentation as mask classification, providing a unified formulation that supports multiple segmentation tasks [8]. Mask2Former extended this paradigm with masked attention, improving both accuracy and scalability for universal image segmentation [9]. More recently, EoMT showed that generic ViT backbones can act as strong universal segmentation models when equipped with suitable token-to-mask prediction heads, highlighting the potential of model-agnostic ViT architectures for unified segmentation [21]. Our work follows this line by enhancing efficiency within ViT-based segmentation frameworks while preserving instance structure.
2.1.1. Token reduction in general
In image classification and related settings, token reduction is mainly achieved by pruning, merging, or hybrid strategies. Pruning methods remove uninformative tokens using auxiliary predictors or attention-derived saliency scores, and are often optimized to preserve top-layer semantics under reduced token budgets [16, 23, 30, 40, 45, 52, 59–61, 64]. Beyond token dropping, efficiency is also improved through compressed token representations and quantization-aware formulations [28, 35, 41, 44, 56], as well as through alternative attention mechanisms such as linearized kernels and local-window computation [7, 20, 34, 39, 54].
Merging approaches reduce sequence length by combining redundant tokens either with learned mappings [5, 46, 47, 66] or with similarity-driven matching rules [1–3, 6, 18, 19, 24, 30, 37, 48, 51, 55]. In practice, these methods differ in when reduction is applied (early vs. layer-wise), whether token identities remain recoverable, and how much extra routing computation is introduced. Hybrid methods explicitly combine pruning, merging, and/or token fusing to improve the speed–accuracy frontier [2, 3, 6, 37, 57]. Despite strong gains, many approaches still rely on learned token-selection policies or threshold schedulers, which can increase optimization complexity, reduce hardware-friendliness, and limit end-to-end training-time acceleration [11, 14, 40, 60].
2.1.2. Token reduction for semantic segmentation
Applying token reduction to semantic segmentation is more constrained because dense prediction requires reconstructing per-location outputs while preserving object boundaries and fine structures. Classification-oriented methods can be adapted by tracking assignment maps and remapping merged tokens to original positions [1, 5, 18, 30, 37], but direct transfer is often brittle and can degrade mIoU, especially around thin regions and small objects [29]. This creates a stronger requirement for spatially faithful reduction mechanisms than in global classification.
Task-specific segmentation approaches therefore emphasize recoverability. Token pausing/halting methods skip updates for confident regions and restore them later [13, 33, 50], improving efficiency but reducing cross-region interaction once tokens are paused. Clustering-based methods such as ELViT and AiluRus merge neighboring redundant tokens while maintaining dense outputs [25, 29]; however, practical gains are constrained by clustering overhead, one-shot grouping, and limited adaptability to scene-level global redundancy. CTS introduces a CNN policy for token sharing before the transformer [38], which improves locality-aware reduction but adds model complexity. ALGM [43] improves upon previous token merging methods by adding a local module and a global merging module inspired by ToMe [1]. While these methods have been great for semantic segmentation, they have not been evaluated for instance segmentation. Additionally, prior work focuses on using feature cosine similarity as the metric to merge tokens. However, for instance-level tasks, this leads to many erroneous merges which deteriorates their performance in instance segmentation. Hence, we incorporate an additional object-level mask constraint to mitigate these erroneous merges and improve performance on these tasks.
3. Methodology
In this section, we introduce MaskMerge, our mask-based adaptive token merging framework for efficient universal image segmentation. Our approach leverages object-level mask proposals as proxies to define our token merging metric, enabling the model to perform segmentation and token refinement jointly within a unified transformer architecture. We first revisit the standard patch-based tokenization used in Vision Transformers [15] (Sec. 3.1). We then present our mask-based token merging module in Sec. 3.2. The overall architecture is illustrated in Fig. 3.
3.1. Vision Transformers with Patch-based Tokenization
Vision Transformers (ViTs) represent an image as a sequence of tokens obtained from fixed-size patches. Specifically, the image is partitioned into non-overlapping patches of size . Each patch is flattened and projected through a linear embedding layer to produce a token representation of dimension . This yields the initial token sequence
where denotes the embedding of the -th patch.
The tokens are processed through a stack of L Transformer blocks. Each block consists of a Multi-Head Self-Attention (MHSA) module followed by a two-layer feedforward network (MLP), both preceded by Layer Normalization. The update rule at layer i is given by
After the final layer, the token sequence can be reshaped into a spatial feature map .
While patch-based tokenization provides a structured representation, it lacks spatial adaptivity. All image regions contribute an equal number of tokens regardless of their semantic complexity. Consequently, simple regions incur redundant computation while complex object boundaries remain under-represented. To address this limitation, we introduce an adaptive token merging mechanism that dynamically merges tokens while preserving object-level structure.
3.2. Mask-based Token Merging
To introduce spatial adaptivity and reduce redundancy, we progressively transform fixed patch tokens into content-aware tokens through a two-stage merging strategy: (i) local token merging to remove redundancy within small spatial neighborhoods, and (ii) object-level adaptive merging that consolidates tokens belonging to the same instance.
3.2.1. Local Token Merging
Given the token sequence after the first transformer layers,
we perform an initial merging step to remove redundant tokens in local spatial neighborhoods following [43].
We first partition the tokens into non-overlapping windows of size in the spatial grid induced by the original patch layout. Let denote the set of tokens within the -th window and be the number of tokens in that window. For each window, we compute the average pairwise cosine similarity

Figure 3. Overall pipeline of MaskMerge. Given an input image , the standard patch tokens of the image are initially passed through layers of the transformer encoder. After that, similar tokens within a small neighbourhood are merged together using the local merge module resulting in where . After this, the model is passed through transformer layers to get where our object-level adaptive token merging (OLAM) module further reduces tokens from to while preserving instance identities. These reduced tokens are processed by the rest of the transformer encoder layers and then unmerged back to the original dimensions before being fed to the segmentation head.
If the similarity exceeds a threshold , the tokens in the window are merged into a single token. The merged token representation is computed using size-aware averaging
Formally, for , , the merging operation defines a mapping
This step reduces token redundancy while preserving spatial locality, which has been shown to be important for stable early-layer representations [38, 43].
3.2.2. Object-level Adaptive Token Merging (OLAM)
While local merging removes redundant tokens within small neighborhoods, it does not account for higher-level object structure. We therefore introduce a global merging mechanism that leverages instance-level information predicted by the segmentation model.
After passing the locally merged tokens through an additional transformer layers, we obtain
We construct a bipartite matching graph between two partitions of the token set like [1, 43]. Let the tokens be divided into two disjoint subsets
The similarity between tokens is computed as
However, relying solely on feature similarity can result in merges across different object instances. To address this limitation, we incorporate object-consistency constraints using coarse instance masks predicted by the segmentation model.
Let denote the set of coarse masks associated with object queries. Each token is assigned an object identifier
where denotes the mask value at the spatial location corresponding to token i. We then define a mask-constrained similarity as
To further improve robustness, we incorporate a mask confidence-aware constraint. Let
denote the confidence of predicted mask corresponding to token i. We allow merging only if
where is a training-dependent threshold that gradually decreases as training progresses. Given the masked similarity matrix , we compute bipartite matching pairs and merge each pair using weighted averaging
where denote token sizes that track how many original patches contributed to each token. This produces the final merged token sequence
3.2.3. Token Unmerging
After the OLAM module, the merged tokens are processed by the remaining transformer layers. Before passing the features to the segmentation decoder, the tokens must be restored to their original spatial resolution. To enable this, we maintain a lightweight index mapping during merging. Specifically, for each merged token , we store the set of original token indices
representing all tokens that contributed to the merged representation.
During the unmerging step, the embedding of token k is copied back to all indices in :
This restores the token sequence to its original length N, allowing the decoder to operate on a dense spatial grid.
Unlike prior methods that maintain dense source matrices of size to track token ancestry [1], our approach maintains only a compact index list for each merged token. This sparse bookkeeping mechanism reduces memory overhead from to while enabling efficient reconstruction of the original token layout.
4. Experiments
We evaluate MaskMerge on three questions: (1) does instance-aware merging improve the accuracy–efficiency trade-off over similarity-based merging across domains with high inter-instance similarity? (2) does the benefit generalize across backbone pre-training strategies? and (3) can the same principle be applied to a segmentation architecture in which mask prediction is decoupled from the backbone?
4.1. Experimental Setup
Datasets. We evaluate on three instance segmentation datasets spanning substantially different visual domains. PanNuke [17] contains nuclei from histopathology images across five classes; we train on folds 1–2 and evaluate on fold 3. iSAID [62] contains 15 categories in high-resolution aerial imagery and includes many small, visually similar object instances; we use tiles. Additionally, to test it on real-world data, we use Cityscapes [12]. It contains eight instance categories in urban driving scenes, where visually similar vehicles and pedestrians frequently occur in close proximity. We evaluate on the 500-image validation set using sliding-window crops.
Model and training. Our primary experiments use EoMT with a DINOv2 ViT-B backbone. Following ALGM, we apply local merging in the first encoder block and perform instance-aware merging at layer 5. For the PanNuke ViT-S and ViT-L experiment, we applied global merge at layers 5 and 8 respectively. We initialize from the trained model and fine-tune with token merging enabled for 15 epochs to make sure that the mask queries are adapted to the intermediate representations.
We compare against ToMe [1] and ALGM [43] as feature-similarity-based token merging baselines. We additionally evaluate an MAE-pretrained ViT-B backbone to study sensitivity to backbone pre-training, and apply MaskMerge to Mask2Former with a DINOv2 ViT-B backbone to examine whether instance-aware merging transfers beyond EoMT.
Metrics. We report instance segmentation mean average precision (mAP), end-to-end throughput, and GFLOPs. Throughput and FLOPs are measured with batch size 4 using FP16 forward inference. Throughput is reported in images/s for PanNuke and tiles/s for Cityscapes and iSAID.
4.2. Main Results
Table 1 compares MaskMerge with standard full-token EoMT inference and two similarity-based token merging baselines. ToMe and ALGM determine merge candidates from feature similarity, whereas MaskMerge additionally
Table 1. Instance segmentation across datasets and backbone scales. All models use EoMT with DINOv2-pretrained ViTs. Throughput is images/s for PanNuke and tiles/s for iSAID and Cityscapes.
| Dataset | Backbone | Method | mAP ↑ | Throughput ↑ | GFLOPs ↓ |
|---|---|---|---|---|---|
| PanNuke | ViT-S | EoMT [21] | 35.1 | 95.1 | 140.8 |
| ToMe [1] | 27.1 | 220.1 | 76.1 | ||
| ALGM [43] | 25.4 | 224.2 | 41.6 | ||
| MaskMerge | 29.5 | 229.9 | 35.3 | ||
| ViT-B | EoMT [21] | 39.4 | 49.1 | 623 | |
| ToMe [1] | 29.5 | 114 | 369 | ||
| ALGM [43] | 30.1 | 121.5 | 229 | ||
| MaskMerge | 32.1 | 142.8 | 153 | ||
| ViT-L | EoMT [21] | 41.3 | 26.4 | 1654 | |
| ToMe [1] | 32.8 | 49.8 | 1093 | ||
| ALGM [43] | 34.7 | 55.2 | 546 | ||
| MaskMerge | 35.2 | 58.9 | 482 | ||
| iSAID | ViT-B | EoMT [21] | 41.6 | 83.9 | 383 |
| ToMe [1] | 31.5 | 160.5 | 207 | ||
| ALGM [43] | 33.1 | 168.8 | 198 | ||
| MaskMerge | 36.2 | 206.9 | 182 | ||
| Cityscapes | ViT-B | EoMT [21] | 21.6 | 39.5 | 827 |
| ToMe [1] | 10.6 | 109.7 | 330 | ||
| ALGM [43] | 19.8 | 107.4 | 347 | ||
| MaskMerge | 19.8 | 105.2 | 298 |
constrains candidate pairs using predicted instance structure.
MaskMerge consistently improves the accuracy–efficiency trade-off over similarity-based merging across datasets and backbone scales. On PanNuke, it improves over ALGM by 2.0 mAP on ViT-B while using 1.50× fewer FLOPs and achieving 1.18× higher throughput. Fig. 1 and Ta. 1 further shows gains of 4.1 mAP and 0.5 mAP on ViT-S and ViT-L, with corresponding throughput improvements of 3% and 7%. On iSAID, MaskMerge improves mAP by 3.1 points, reduces computation by 1.08×, and runs 1.23× faster. We additionally evaluate on the more heterogeneous real-world Cityscapes benchmark, where MaskMerge matches ALGM at 19.8 mAP while using fewer FLOPs. Its throughput is similar to ALGM because coarse-mask prediction introduces runtime overhead; on the more homogeneous PanNuke and iSAID datasets, however, high inter-instance similarity allows MaskMerge to perform substantially more aggressive yet instance-consistent merging, and the resulting token reduction more than offsets this overhead.
The results highlight an important limitation of similarity-based merging. As the merge rate increases, feature similarity alone can increasingly combine visually similar tokens from different instances. ALGM must therefore retain more tokens to avoid substantial accuracy degradation. By constraining candidate merges with predicted instance structure, MaskMerge supports more aggressive token reduction while better preserving instance separation. This effect is particularly pronounced on PanNuke and
Table 2. Backbone generalization on PanNuke. Results use an MAE-pretrained ViT-B backbone.
| Method | mAP ↑ | APs ↑ |
|---|---|---|
| EoMT [21] | 36.8 | 36.0 |
| ALGM [43] | 32.0 | 31.5 |
| MaskMerge | 34.0 | 33.4 |
iSAID, where distinct instances frequently exhibit highly similar local appearance.
MaskMerge also consistently outperforms ToMe despite operating at comparable or lower computational cost. On PanNuke, ToMe requires 369 GFLOPs yet reaches only 29.5 mAP, compared with 32.1 mAP at 153 GFLOPs for MaskMerge. Similarly, on iSAID, MaskMerge improves mAP from 31.5 to 36.2 while using fewer FLOPs. These results suggest that increasing the aggressiveness of appearance-only merging cannot provide the same accuracy–efficiency trade-off as incorporating instance structure into the merge decision.
4.3. Generalization Across Backbone Pre-training
We next test whether the benefit of MaskMerge depends on the DINOv2 representation. We replace it with an MAE-pretrained ViT-B backbone and repeat the PanNuke experiment.
MaskMerge improves overall mAP from 32.0 to 34.0 and small-instance performance from 31.5 to 33.4 as shown in Tab. 2. The advantage therefore persists under a substantially different self-supervised pre-training strategy, suggesting that the improvement is not specific to the DINOv2 feature representation.
4.4. Extension to Mask2Former
EoMT exposes intermediate query-token interactions directly in the encoder, making coarse instance masks readily available for MaskMerge. We next study whether the same principle can be applied to Mask2Former [9], where mask prediction occurs in a separate decoder.
A direct implementation requires two passes: a dense forward pass to obtain decoder masks followed by a second mask-guided pass. We therefore additionally introduce a lightweight single-pass variant in which a two-layer convolutional head predicts coarse instance structure directly from backbone features. The head learns from the decoder masks of the frozen model and is used at inference time to constrain token merging.
The results in Table 3 show that instance-aware merging remains beneficial when mask prediction is decoupled from the backbone. The single-pass MaskMerge retains 32.53 mAP, only 1.36 points below the standard Mask2Former model, compared with 30.69 for ToMe and 24.44 for
Table 3. MaskMerge with Mask2Former on PanNuke. All methods use the same DINOv2 ViT-B backbone. The single-pass variant predicts coarse instance structure directly from backbone features, while the two-pass variant obtains masks from a separate dense forward pass.
| Method | Passes | mAP ↑ | GFLOPs ↓ | img/s ↑ |
|---|---|---|---|---|
| Mask2Former [9] | 1 | 33.89 | 167.9 | 36.1 |
| ALGM [43] | 1 | 24.44 | 154.7 | 36.6 |
| ToMe [1] | 1 | 30.69 | 158.3 | 36.1 |
| MaskMerge | 1 | 32.53 | 161.2 | 36.1 |
ALGM. This indicates that predicted instance structure provides a substantially safer criterion for token aggregation than feature similarity alone.
These results demonstrate that the principle underlying MaskMerge is not specific to EoMT. When intermediate instance masks are unavailable, a lightweight predictor can provide sufficient structural information to guide token aggregation in a decoupled segmentation architecture. The particularly favorable efficiency gains observed with EoMT arise because instance information is directly available within the model, whereas Mask2Former requires an auxiliary prediction mechanism.
4.5. Ablation Study
In order to understand more about the different components of our technique, we conduct rigorous ablations and highlight the importance of our design choices. All the ablations are conducted on PanNuke using EoMT-B.
4.5.1. Impact of each module
Table 5 isolates the contribution of OLAM from conventional cosine-similarity-based global merging. Using global cosine merging alone gives 29.5 mAP, whereas replacing the similarity-only criterion with OLAM improves performance to 33.4 mAP, showing that predicted instance structure provides a substantially safer merge signal. The difference is even clearer when combined with local merging: cosine-based global merging reaches 30.1 mAP at 229 GFLOPs, while OLAM attains 32.1 mAP with only 153 GFLOPs and increases throughput from 121.5 to 142.8 images/s. This indicates that OLAM is better suited to aggressive early token reduction, as its instance-aware constraint allows more tokens to be merged without sacrificing instance separation.
4.5.2. OLAM module position
Table 4 studies the trade-off induced by the layer at which OLAM is applied. Applying OLAM earlier yields the highest efficiency, but the coarse instance predictions are less mature and lead to lower accuracy; placing it at layer 4 reaches 31.4 mAP at 145 GFLOPs. Delaying OLAM progressively improves accuracy, reaching 33.8 mAP at layer
Table 4. Impact of OLAM module position on overall performance on PanNuke. The blue row indicates the final setting used for our main table result.
| Layer | mAP↑ | GFLOPs↓ | img/s↑ |
|---|---|---|---|
| 4 | 31.4 | 145 | 153.15 |
| 5 | 32.1 | 153 | 142.8 |
| 6 | 33.0 | 171 | 134.2 |
| 7 | 33.8 | 181 | 125.6 |
Table 5. Impact of the local and OLAM modules on overall performance on PanNuke. The blue row indicates the final setting used for our main table result.
| Local | OLAM | OLAM w/o mask | mAP↑ | GFLOPs↓ | img/s↑ |
|---|---|---|---|---|---|
| ✕ | ✕ | ✓ | 29.5 | 369 | 114 |
| ✓ | ✕ | ✓ | 30.1 | 229 | 121.5 |
| ✕ | ✓ | ✕ | 33.4 | 287 | 116.2 |
| ✓ | ✓ | ✕ | 32.1 | 153 | 142.8 |
7, but retains more tokens for longer and therefore increases computation and reduces throughput. We choose layer 5 as the default operating point, which achieves 32.1 mAP at 153 GFLOPs and 142.8 images/s, providing a favorable balance between accuracy and efficiency.
5. Conclusion
We introduced MaskMerge, an instance-aware token merging framework that addresses cross-instance token fusion, a key failure mode of similarity-based merging for instance segmentation. By using intermediate coarse masks to constrain token aggregation, MaskMerge preserves instance structure while enabling more aggressive token reduction. This leads to consistently better accuracy–efficiency trade-offs than cosine-based merging on PanNuke and iSAID, where visually similar instances are common, and the advantage persists across ViT scales and different backbone pre-training strategies. MaskMerge also matches ALGM on the more heterogeneous Cityscapes benchmark at lower computation and transfers to Mask2Former. Overall, our results show that effective token reduction for instance segmentation should account not only for feature similarity, but also for instance identity, making structural guidance a simple and effective principle for efficient dense prediction.
References
[1] Daniel Bolya, Cheng-Yang Fu, Xiaoliang Dai, Peizhao Zhang, Christoph Feichtenhofer, and Judy Hoffman. Token merging: Your vit but faster. arXiv preprint arXiv:2210.09461, 2022. 1, 2, 3, 4, 5, 6, 7, 8
[2] Maxim Bonnaerens and Joni Dambre. Learned Thresholds Token Merging and Pruning for Vision Transformers. TMLR, 2023. 3
[3] Qingqing Cao, Bhargavi Paranjape, and Hannaneh Ha-jishirzi. PuMer: Pruning and Merging Tokens for Efficient Vision Language Models. In ACL, 2023. 3
[4] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pages 213–229. Springer, 2020. 3
[5] Shuning Chang, Pichao Wang, Ming Lin, Fan Wang, David Junhao Zhang, Rong Jin, and Mike Zheng Shou. Making Vision Transformers Efficient from A Token Sparsification View. In CVPR, 2023. 3, 4
[6] Mengzhao Chen, Wenqi Shao, Peng Xu, Mingbao Lin, Kaipeng Zhang, Rongrong Ji Fei Chao, Yu Qiao, and Ping Luo. DiffRate: Differentiable Compression Rate for Efficient Vision Transformers. In ICCV, 2023. 3
[7] Xuanyao Chen, Zhijian Liu, Haotian Tang, Li Yi, Hang Zhao, and Song Han. SparseViT: Revisiting Activation Sparsity for Efficient High-Resolution Vision Transformer. In CVPR, 2023. 3
[8] Bowen Cheng, Alexander G. Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. 2021. 2, 3
[9] Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, and Rohit Girdhar. Masked-attention mask transformer for universal image segmentation. 2022. 1, 2, 3, 7, 8
[10] Rohan Choudhury, JungEun Kim, Jinhyung Park, Eunho Yang, László A. Jeni, and Kris M. Kitani. Accelerating vision transformers with adaptive patch sizes. arXiv preprint arXiv:2510.18091, 2025. 1
[11] Rohan Choudhury, Guanglei Zhu, Sihan Liu, Koichiro Niniuma, Kris Kitani, and László Jeni. Don’t look twice: Faster video transformers with run-length tokenization. Advances in Neural Information Processing Systems, 37:28127–28149, 2025. 4
[12] 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 CVPR, 2016. 6
[13] Evann Courtier, Prabhu Teja Sivaprasad, and François Fleuret. Paumer: Patch pausing transformer for semantic segmentation. arXiv preprint arXiv:2311.00586, 2023. 2, 4
[14] Shuangrui Ding, Peisen Zhao, Xiaopeng Zhang, Rui Qian, Hongkai Xiong, and Qi Tian. Prune spatio-temporal tokens by semantic-aware temporal accumulation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16945–16956, 2023. 1, 4
[15] 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 image is worth words: Transformers for image recognition at scale. ICLR, 2021. 3, 4
[16] Mohsen Fayyaz, Soroush Abbasi Kouhpayegani, Farnoush Rezaei Jafari, Eric Sommerlade, Hamid Reza Vaezi Joze, Hamed Pirsiavash, and Juergen Gall. Adaptive token sam-
pling for efficient vision transformers. European Conference on Computer Vision (ECCV), 2022. 3
[17] Jevgenij Gamper, Navid Alemi Koohbanani, Ksenija Benet, Ali Khuram, and Nasir Rajpoot. Pannuke: an open pancancer histology dataset for nuclei instance segmentation and classification. In European congress on digital pathology, pages 11–19. Springer, 2019. 1, 2, 3, 6
[18] Jung Hwan Heo, Arash Fayyazi, Mahdi Nazemi, and Massoud Pedram. A Fast Training-Free Compression Framework for Vision Transformers. arXiv preprint arXiv:2303.02331, 2023. 3, 4
[19] Julie Kallini, Shikhar Murty, Christopher D Manning, Christopher Potts, and Róbert Csordás. Mrt5: Dynamic token merging for efficient byte-level language models. arXiv preprint arXiv:2410.20771, 2024. 3
[20] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In International conference on machine learning, pages 5156–5165. PMLR, 2020. 3
[21] Tommie Kerssies, Niccolò Cavagnero, Alexander Hermans, Narges Norouzi, Giuseppe Averta, Bastian Leibe, Gijs Dubbelman, and Daan de Geus. Your ViT is Secretly an Image Segmentation Model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2025. 1, 2, 3, 7
[22] Alexander Kirillov, Kaiming He, Ross Girshick, Carsten Rother, and Piotr Dollár. Panoptic segmentation. In 2019 IEEE/CVF conference on computer vision and pattern recognition (CVPR), pages 9396–9405. Ieee, 2019. 1
[23] Zhenglun Kong, Peiyan Dong, Xiaolong Ma, Xin Meng, Wei Niu, Mengshu Sun, Xuan Shen, Geng Yuan, Bin Ren, Hao Tang, et al. SPViT: Enabling Faster Vision Transformers via Latency-Aware Soft Token Pruning. In ECCV, 2022. 3
[24] Dong Hoon Lee and Seunghoon Hong. Learning to merge tokens via decoupled embedding for efficient vision transformers. Advances in Neural Information Processing Systems, 37:54079–54104, 2024. 2, 3
[25] Jin Li, Yaoming Wang, XiaopengIAOPENG ZhangHANG, Bowen Shi, Dongsheng Jiang, Chenglin Li, Wenrui Dai, Hongkai Xiong, and Qi Tian. AiluRus: A Scalable ViT Framework for Dense Prediction. In NeurIPS, 2023. 4
[26] Ling Li, David Thorsley, and Joseph Hassoun. SaiT: Sparse Vision Transformers through Adaptive Token Pruning. arXiv preprint arXiv:2210.05832, 2022. 1
[27] Yanghao Li, Hanzi Mao, Ross Girshick, and Kaiming He. Exploring plain vision transformer backbones for object detection. In European conference on computer vision, pages 280–296. Springer, 2022. 3
[28] Yanjing Li, Sheng Xu, Baochang Zhang, Xianbin Cao, Peng Gao, and Guodong Guo. Q-vit: Accurate and fully quantized low-bit vision transformer. Advances in neural information processing systems, 35:34451–34463, 2022. 3
[29] Weicong Liang, Yuhui Yuan, Henghui Ding, Xiao Luo, Weihong Lin, Ding Jia, Zheng Zhang, Chao Zhang, and Han Hu. Expediting Large-Scale Vision Transformer for Dense Prediction without Fine-tuning. In NeurIPS, 2022. 4
[30] 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 ICLR, 2022. 3, 4
[31] Shu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In 2018 IEEE/CVF conference on computer vision and pattern recognition, pages 8759–8768. Ieee, 2018. 2
[32] Yifei Liu, Mathias Gehrig, Nico Messikommer, Marco Cannici, and Davide Scaramuzza. Revisiting Token Pruning for Object Detection and Instance Segmentation. arXiv preprint arXiv:2306.07050, 2023. 1
[33] Yuang Liu, Qiang Zhou, Jing Wang, Zhibin Wang, Fan Wang, Jun Wang, and Wei Zhang. Dynamic token-pass transformers for semantic segmentation. In 2024 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 1816–1825, 2024. 2, 4
[34] 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 ICCV, 2021. 3
[35] Zhenhua Liu, Yunhe Wang, Kai Han, Wei Zhang, Siwei Ma, and Wen Gao. Post-training quantization for vision transformer. Advances in Neural Information Processing Systems, 34:28092–28103, 2021. 3
[36] Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, and Baining Guo. Swin Transformer V2: Scaling Up Capacity and Resolution. In CVPR, 2022. 3
[37] Sifan Long, Zhen Zhao, Jimin Pi, Shengsheng Wang, and Jingdong Wang. Beyond Attentive Tokens: Incorporating Token Importance and Diversity for Efficient Vision Transformers. In CVPR, 2023. 3, 4
[38] 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. 1, 2, 4, 5
[39] Jiachen Lu, Jinghan Yao, Junge Zhang, Xiatian Zhu, Hang Xu, Weiguo Gao, Chunjing Xu, Tao Xiang, and Li Zhang. Soft: Softmax-free transformer with linear complexity. Advances in Neural Information Processing Systems, 34: 21297–21309, 2021. 3
[40] Lingchen Meng, Hengduo Li, Bor-Chun Chen, Shiyi Lan, Zuxuan Wu, Yu-Gang Jiang, and Ser-Nam Lim. Adavit: Adaptive vision transformers for efficient image recognition, 2021. 1, 3, 4
[41] Jaehyeon Moon, Dohyung Kim, Junyong Cheon, and Bum-sub Ham. Instance-aware group quantization for vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16132–16141, 2024. 3
[42] Duy MH Nguyen, Tuan A Tran, Duong Nguyen, Siwei Xie, Trung Q Nguyen, Mai TN Truong, Daniel Palenicek, An T Le, Michael Barz, TrungTin Nguyen, et al. Structsam: Structure-and spectrum-preserving token merging for segment anything models. arXiv preprint arXiv:2603.07307, 2026. 2
[43] Narges Norouzi, Svetlana Sorlova, Daan de Geus, and Gijs Dubbelman. ALGM: Adaptive Local-then-Global Token Merging for Efficient Semantic Segmentation with Plain Vision Transformers. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2024. 1, 2, 4, 5, 6, 7, 8
[44] Jeongsoo Park and Justin Johnson. Rgb no more: Minimally-decoded jpeg vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22334–22346, 2023. 3
[45] Yongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. Dynamicvit: Efficient vision transformers with dynamic token sparsification, 2021. 3
[46] Cedric Renggli, Andre Susano Pinto, Neil Houlsby, Basil Mustafa, Joan Puigcerver, and Carlos Riquelme. Learning to Merge Tokens in Vision Transformers. arXiv preprint arXiv:2202.12015, 2022. 2, 3
[47] Michael S. Ryoo, AJ Piergiovanni, Anurag Arnab, Mostafa Dehghani, and Anelia Angelova. TokenLearner: What Can 8 Learned Tokens Do for Images and Videos? In NeurIPS, 2021. 3
[48] Yuzhang Shang, Mu Cai, Bingxin Xu, Yong Jae Lee, and Yan Yan. Llava-prumerge: Adaptive token reduction for efficient large multimodal models. arXiv preprint arXiv:2403.15388, 2024. 1, 3
[49] Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for Semantic Segmentation. In ICCV, 2021. 1
[50] Quan Tang, Bowen Zhang, Jiajun Liu, Fagui Liu, and Yifan Liu. Dynamic token pruning in plain vision transformers for semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 777–786, 2023. 2, 4
[51] Chau Tran, Duy MH Nguyen, Manh-Duy Nguyen, TrungTin Nguyen, Ngan Le, Pengtao Xie, Daniel Sonntag, James Y Zou, Binh Nguyen, and Mathias Niepert. Accelerating transformers with spectrum-preserving token merging. Advances in Neural Information Processing Systems, 37:30772–30810, 2024. 3
[52] Hongjie Wang, Bhishma Dedhia, and Niraj K. Jha. Zero-TPrune: Zero-Shot Token Pruning through Leveraging of the Attention Graph in Pre-Trained Transformers. arXiv preprint arXiv:2305.17328, 2023. 1, 3
[53] 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. 3
[54] Cong Wei, Brendan Duke, Ruowei Jiang, Parham Aarabi, Graham W Taylor, and Florian Shkurti. Sparsifiner: Learning sparse instance-dependent attention for efficient vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22680–22689, 2023. 3
[55] Siyuan Wei, Tianzhu Ye, Shen Zhang, Yao Tang, and Jiajun Liang. Joint Token Pruning and Squeezing Towards More
Aggressive Compression of Vision Transformers. In CVPR, 2023. 3
[56] Chao-Yuan Wu, Manzil Zaheer, Hexiang Hu, R Manmatha, Alexander J Smola, and Philipp Krähenbühl. Compressed video action recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6026–6035, 2018. 3
[57] Xinjian Wu, Fanhu Zeng, Xiudong Wang, Yunhe Wang, and Xinghao Chen. PPT: Token Pruning and Pooling for Efficient Vision Transformers. arXiv preprint arXiv:2310.01812, 2023. 3
[58] 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. 1
[59] Huanrui Yang, Hongxu Yin, Maying Shen, Pavlo Molchanov, Hai Li, and Jan Kautz. Global vision transformer pruning with hessian-aware saliency. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 18547–18557, 2023. 3
[60] 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. 1, 4
[61] Lu Yu and Wei Xiang. X-Pruner: eXplainable Pruning for Vision Transformers. arXiv preprint arXiv:2303.04935, 2023. 1, 3
[62] Syed Waqas Zamir, Aditya Arora, Akshita Gupta, Salman Khan, Guolei Sun, Fahad Shahbaz Khan, Fan Zhu, Ling Shao, Gui-Song Xia, and Xiang Bai. isaid: A large-scale dataset for instance segmentation in aerial images. arXiv preprint arXiv:1905.12886, 2019. 2, 3, 6
[63] Bowen Zhang, Zhi Tian, Quan Tang, Xiangxiang Chu, Xiaolin Wei, Chunhua Shen, et al. Segvit: Semantic segmentation with plain vision transformers. Advances in Neural Information Processing Systems, 35:4971–4982, 2022. 1
[64] Chuanyang Zheng, Kai Zhang, Zhi Yang, Wenming Tan, Jun Xiao, Ye Ren, Shiliang Pu, et al. Savit: Structure-aware vision transformer pruning via collaborative optimization. Advances in Neural Information Processing Systems, 35:9010–9023, 2022. 3
[65] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. 3
[66] Zhuofan Zong, Kunchang Li, Guanglu Song, Yali Wang, Yu Qiao, Biao Leng, and Yu Liu. Self-slimmed Vision Transformer. In ECCV, 2022. 3