Repurposing Pretrained Models for Robust Out-of-domain Few-Shot Learning

Namyeong Kwon, Hwidong Na, Gabriel Huang, Simon Lacoste-Julien

Abstract

This paper presents a novel framework for adapting pretrained Model-Agnostic Meta-Learning (MAML) checkpoints to out-of-domain (OOD) tasks without requiring access to original meta-training data. By leveraging deep ensembles to estimate task-specific uncertainty, the proposed method introduces Uncertainty-based Stepsize Adaptation (USA) and Uncertainty-based Fast Gradient Sign Method (UFGSM). These techniques significantly enhance accuracy and hyperparameter robustness in cross-domain few-shot scenarios, such as adapting a general object classifier to specialized domains like botany or traffic signs.

Introduction

Meta-learning, particularly the Model-Agnostic Meta-Learning (MAML) framework, aims to find a model initialization that can quickly adapt to new tasks with minimal gradient updates. However, standard MAML faces two significant hurdles in practical deployment. First, it typically assumes access to the original meta-training dataset for calibration, which is often impossible due to privacy or intellectual property constraints. Second, MAML learns a fixed adaptation strategy optimized for the training domain, making it fragile when faced with significant distribution shifts (out-of-domain tasks).

This research addresses these challenges by repurposing "black box" MAML checkpoints for OOD tasks using task-specific uncertainty as a guiding signal.

Methodology

The authors propose a meta-testing procedure that intelligently adapts the model based on the uncertainty of its parameters relative to the new task. The approach consists of three core components:

1. Deep Ensembles from a Single Checkpoint

To estimate uncertainty without multiple training runs, the authors create an ensemble by adding multiplicative Gaussian noise to the weights of a single pretrained checkpoint. This ensemble provides a distribution of model responses, allowing for the identification of parameters that are most "confusing" for the new domain.

2. Uncertainty-based Stepsize Adaptation (USA)

A key insight of this work is that not all layers should adapt at the same rate. The authors calculate the variance of parameters across the ensemble. Counter-intuitively, layers with high variance (high uncertainty) are assigned smaller stepsizes. This prevents noisy gradients from the limited support data from destroying the robust features learned during pretraining.

Uncertainty of layers and the resulting stepsize adaptation strategy.

As shown in the figure above, Batch Normalization (BN) layers often exhibit the highest uncertainty, leading the algorithm to drastically reduce their stepsize compared to more stable layers like the final linear classifier.

3. Uncertainty-based Fast Gradient Sign Method (UFGSM)

To mitigate the "small data" problem inherent in few-shot learning, the authors employ adversarial training as a test-time regularizer. Unlike standard adversarial attacks, UFGSM scales perturbations based on the uncertainty of the input gradient. This creates task-specific adversarial examples that help the model generalize better from just 1 or 5 examples.

An adversarial example generated via the UFGSM method.

Experimental Results

The method was evaluated on several cross-domain benchmarks, including CUB-200-2011 (Birds), Traffic Signs, and VGG Flowers, using a model meta-trained on miniImageNet.

  • Cross-Domain Performance: The proposed method (SGD+All) consistently outperformed vanilla MAML. In 5-way 5-shot tasks, average accuracy improved from 40.34% to 46.42% across OOD datasets.
  • Hyperparameter Robustness: A significant contribution is the method's reduced sensitivity to the base learning rate. By measuring "Top-40%" accuracy (average performance across the best 40% of stepsize settings), the authors demonstrated that their uncertainty-based adaptation maintains high performance even without perfect hyperparameter tuning.
  • Ablation Studies: Both USA and UFGSM were found to contribute to the gains, with the combination of both providing the most robust results. Notably, freezing Batch Normalization layers during adaptation was often beneficial due to their high inherent uncertainty in OOD scenarios.

Conclusion

By repurposing pretrained MAML checkpoints through uncertainty estimation, this work provides a practical path for deploying meta-learning models in the real world where data access is restricted and distribution shifts are common. The inverse relationship between parameter uncertainty and adaptation stepsize proves to be a powerful heuristic for maintaining the integrity of pretrained features while allowing for task-specific refinement.

Summary updated

BibTeX
@inproceedings{kwon2021repurposing,
  author = {Namyeong Kwon and Hwidong Na and Gabriel Huang and Simon Lacoste-Julien},
  title = {{Repurposing Pretrained Models for Robust Out-of-domain Few-Shot Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=qkLMTphG5-h},
}
Figure