Seedlabs
Source research

Merging Vision Transformers from Different Tasks and Domains

Peng Ye, Chenyu Huang, Mingzhu Shen, Chen, Tao, Yongqi Huang, Yuning Zhang et al. · 2023 · 17 citationsRead the paper

This work targets to merge various Vision Transformers (ViTs) trained on different tasks (i.e., datasets with different object categories) or domains (i.e., datasets with the same categories but different environments) into one unified model, yielding still good performance on each task or domain. Previous model merging works focus on either CNNs or NLP models, leaving the ViTs merging research untouched. To fill this gap, we first explore and find that existing model merging methods cannot well handle the merging of the whole ViT models and still have improvement space. To enable the merging of the whole ViT, we propose a simple-but-effective gating network that can both merge all kinds of layers (e.g., Embedding, Norm, Attention, and MLP) and select the suitable classifier. Specifically, the gating network is trained by unlabeled datasets from all the tasks (domains), and predicts the probability of which task (domain) the input belongs to for merging the models during inference. To further boost the performance of the merged model, especially when the difficulty of merging tasks increases, we design a novel metric of model weight similarity, and utilize it to realize controllable and combined weight merging. Comprehensive experiments on kinds of newly established benchmarks, validate the superiority of the proposed ViT merging framework for different tasks and domains. Our method can even merge beyond 10 ViT models from different vision tasks with a negligible effect on the performance of each task.

What the full text shows

Working prototype
  • The proposed gating network and weight similarity metric reduce performance decay when merging 12 models compared to RegMean. — decay reduced from nearly 10% to 1.39% (at m=5) (Merging 12 ViT-B/16 models from different tasks)
  • The merged model achieves competitive performance with individual models while significantly reducing parameter count. — approximately 50% fewer parameters vs. 12 individual models (Merging 12 ViT-B/16 models at m=5)
  • The method enables merging of a large number of vision tasks with minimal impact on individual task performance. — beyond 10 ViT models (Different vision tasks)
  • The proposed method improves the average accuracy of merged models compared to baseline merging techniques. — Avg accuracy 95.72% (Ours+RegMean, m=5) vs 92.21% (RegMean) (Merging 6 different tasks)
Setup
ViT-B/16 models merged across 16 datasets (including ImageNet-1K, CIFAR-10, and Office-Home) for task and domain merging experiments.
How
The authors propose a gating network trained on unlabeled data to predict task probability for layer merging and classifier selection. They also introduce a model weight similarity metric to enable controllable and combined weight merging.
Limitations
Performance is positively related to the parameter count (m), creating a trade-off between accuracy and model size. · Existing merging methods (and the proposed one) rely on models sharing a common pre-training initialization to avoid failure (Linear Mode Connectivity).

Summarized by Gemma 4 from the open-access full text · 10 Nov 2026. Read it