Towards Few-Shot Adaptation of Foundation Models via Multitask Finetuning

Zhuoyan Xu, Zhenmei Shi, Junyi Wei, Fangzhou Mu, Yin Li, Yingyu Liang

Introduction

Foundation models, such as GPT-4 and CLIP, have revolutionized machine learning by providing powerful general-purpose representations. However, adapting these models to specific "target" tasks with minimal labeled data—known as few-shot learning—remains a significant challenge. A common empirical strategy is Multitask Finetuning (MTF), where a model is first finetuned on a variety of auxiliary tasks before being adapted to the target task. While effective, this practice has largely lacked a formal theoretical foundation. This paper introduces a rigorous framework to justify MTF and proposes a principled algorithm for task selection.

Theoretical Framework: Diversity and Consistency

The authors identify two critical properties that determine the success of multitask adaptation:

  1. Diversity ($\nu$): This metric quantifies how well the set of auxiliary tasks covers the latent feature space required by the target task. High diversity ensures that the model explores a broad enough range of patterns to satisfy the target task's requirements.
  2. Consistency ($\kappa$): This measures the alignment or similarity between auxiliary tasks and the target task. High consistency implies the auxiliary tasks are relevant and "on-topic."
The concept of diversity illustrated through a coverage boundary. Auxiliary tasks ($T_1$-$T_4$) within the boundary help adapt to the target task $T_0$, while tasks outside ($T_5$-$T_9$) are less relevant.

Task Selection Algorithm

To bridge theory and practice, the researchers developed a greedy selection algorithm designed to maximize performance while minimizing computational waste. The algorithm operates by:

  • Ranking: Candidate auxiliary tasks are sorted based on their cosine similarity to the target task (serving as a proxy for consistency).
  • Iterative Selection: Tasks are added to the finetuning set sequentially, provided they significantly improve a "coverage score" (a proxy for diversity).
  • Pruning: The process stops when additional tasks yield diminishing returns, preventing "negative transfer" where irrelevant or noisy data degrades model performance.

Key Insights and Experimental Results

The framework was validated across diverse benchmarks in computer vision (e.g., miniImageNet, Meta-Dataset) and NLP (e.g., GLUE, SNLI) using architectures like ResNet, ViT, and RoBERTa.

Sample Efficiency and Scaling

A major finding is that the total sample size across all auxiliary tasks ($M \times m$) is a more critical driver of performance than the number of shots per individual auxiliary task. As shown in the experimental data, increasing the number of tasks ($M$) or the samples per task ($m$) leads to significant accuracy gains, whereas increasing the number of shots during the final finetuning phase shows marginal returns.

Performance scaling with respect to (a) shots per task, (b) number of tasks (M), and (c) samples per task (m). The results highlight that total sample volume is the primary performance driver.

Performance Gains

  • Accuracy Boost: On the DomainNet 1-shot task, MTF provided a ~9.3% accuracy improvement over standard direct adaptation using a DINO-v2 backbone.
  • Algorithm Superiority: The proposed selection algorithm outperformed random task selection by significant margins, such as an 8.9% to 19.7% lead on the Omniglot dataset.

Conclusion

By formalizing the roles of diversity and consistency, this work provides a roadmap for more efficient foundation model adaptation. The proposed task selection algorithm offers a practical way to harness the power of multitask finetuning without the overhead of exhaustive, unprincipled data collection. Future work will focus on more efficient heuristics for estimating task relationships in massive-scale generative settings.

Summary updated

BibTeX
@inproceedings{xu2024towards,
  author = {Zhuoyan Xu and Zhenmei Shi and Junyi Wei and Fangzhou Mu and Yin Li and Yingyu Liang},
  title = {{Towards Few-Shot Adaptation of Foundation Models via Multitask Finetuning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=1jbh2e0b2K},
}
Figure