Domain Generalization using Pretrained Models without Fine-tuning

Ziyue Li, Kan Ren, Xinyang Jiang, Bo Li, Haipeng Zhang, Dongsheng LiarXiv 2022 · DOI

Introduction

Domain Generalization (DG) remains a critical challenge in machine learning, requiring models trained on a specific set of "source" domains to perform effectively on unseen "target" domains. The conventional industry standard involves taking a large model pretrained on a massive dataset (e.g., ImageNet) and fine-tuning it on source domain data.

However, this approach suffers from two primary drawbacks. First, the computational cost of fine-tuning increasingly massive models is becoming prohibitive. Second, recent evidence suggests "generalization washing," where fine-tuning can distort the robust, general-purpose features of a pretrained model, leading to overfitting on source domains and degraded performance on novel data. This paper introduces SEDGE (Specialized Ensemble Learning for Domain Generalization), a framework that leverages the knowledge of multiple pretrained models without the need for fine-tuning.

The SEDGE Framework

SEDGE shifts the focus from modifying model weights to intelligently selecting and combining existing features. The architecture consists of three core components:

  1. Fixed Pretrained Model Pool: A diverse collection of models (e.g., ResNets, ViTs, DenseNets) with frozen weights. This preserves the original robust features learned during pretraining.
  2. Linear Label Space Adapter: A lightweight linear layer that maps the output of each pretrained model to the specific label space of the target task.
  3. Specialty-Aware Dispatcher: The central innovation of SEDGE. This ensemble network determines which models in the pool are "experts" for a specific input sample. By embedding the input and matching it against learnable model embeddings, the dispatcher outputs weights to prioritize the most relevant models.
Overview of SEDGE compared to traditional fine-tuning and fixed model approaches.

During inference, the dispatcher can be configured to activate only the top $k$ models, significantly reducing computational overhead while maintaining high accuracy.

Experimental Setup

The authors evaluated SEDGE using the DomainBed suite, a rigorous benchmark for DG. The evaluation covered diverse datasets including PACS (Photos, Art, Cartoons, Sketches), VLCS, OfficeHome, TerraIncognita, and the massive DomainNet dataset (6 domains, 345 classes). Two model pools were tested: Model Pool-A (15 ImageNet-trained models) and Model Pool-B (Pool-A plus CLIP models).

Results and Discussion

SEDGE demonstrates that fine-tuning is often unnecessary if one can effectively select the right features for the right sample. The framework achieved state-of-the-art (SOTA) results with unprecedented efficiency.

  • Accuracy: SEDGE (Pool-A) reached 69.4% average accuracy, surpassing the previous SOTA (SWAD) by 2.5%. With Pool-B, accuracy increased to 74.1%.
  • Efficiency: Trainable parameters were reduced by approximately 99%. More strikingly, on the DomainNet dataset, SEDGE reduced training time from nearly 10 hours (standard ERM) to just 4.1 minutes—a 99.5% reduction.
Comparison of overall training time and average performance on DomainBed across various models.

Analysis of the dispatcher revealed that it makes "rational" selections based on sample-specific specialties. For instance, it avoids using certain models on datasets where they are known to be weak, even if those models perform well on average elsewhere. This granularity allows SEDGE to exploit the diverse strengths of a heterogeneous model pool.

Conclusion

SEDGE provides a paradigm shift for Domain Generalization, proving that ensembling fixed pretrained models via a specialty-aware dispatcher is both more accurate and significantly more efficient than standard fine-tuning. While the method's success depends on the diversity of the model pool, it opens new avenues for utilizing the vast ecosystem of publicly available pretrained models for robust, low-cost machine learning.

Summary updated

BibTeX
@misc{li2022domain,
  author = {Ziyue Li and Kan Ren and Xinyang Jiang and Bo Li and Haipeng Zhang and Dongsheng Li},
  title = {{Domain Generalization using Pretrained Models without Fine-tuning}},
  year = {2022},
  eprint = {2203.04600},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.04600},
}
Figure