Knowledge Transfer from Vision Foundation Models for Efficient Training of Small Task-specific Models

Raviteja Vemulapalli, Hadi Pouransari, Fartash Faghri, Sachin Mehta, Mehrdad Farajtabar, Mohammad Rastegari, Oncel Tuzel

Introduction

Vision Foundation Models (VFMs) like CLIP and DINOv2 are the "heavyweights" of modern AI. Pretrained on billions of images, they perform exceptionally well on new tasks even with very little labeled data. However, their massive size makes them impractical for real-world deployment on edge devices—such as mobile phones, drones, or industrial sensors—where inference compute, energy, and latency must remain low.

The core challenge this paper addresses is: How can we transfer the broad intelligence of a massive VFM into a tiny, fast model when we only have a handful of labeled examples for a specific target task?

Standard approaches typically involve pretraining a small model on ImageNet or distilling the general features of a VFM. The authors argue these "task-agnostic" methods are suboptimal because they force the small model to learn everything the big model knows, rather than focusing its limited capacity on the specific task at hand.

Methodology

To solve this, the authors propose a three-step Task-oriented Knowledge Transfer pipeline:

  1. Teach the Teacher: First, take a large VFM (the teacher) and finetune it on the small amount of labeled data available for the target task (e.g., identifying satellite land cover).
  2. Distill the Task: Use this newly specialized teacher to generate predictions on a large set of unlabeled images (the "transfer set"). The small target model (the student) is then trained to match the teacher’s predictions on this unlabeled set.
  3. Finetune the Student: Finally, finetune the small student model on the original small labeled dataset to lock in its task-specific performance.
Proposed task-oriented knowledge transfer and retrieval pipeline

A key innovation in this pipeline is Retrieval-Augmented Knowledge Transfer. If a highly relevant unlabeled dataset isn't readily available, the authors use the few labeled images they have as "queries" to search through massive web-scale galleries (like DataComp-1B). This retrieves visually similar images, creating a high-quality, task-relevant transfer set from scratch.

Datasets

The researchers evaluated their approach across five diverse computer vision tasks:

  • HAM10K: Skin disease classification (medical).
  • EuroSAT: Land cover classification from satellite imagery.
  • Places365: Scene recognition.
  • ImageNet-1K: General object classification.
  • ADE20K: Semantic segmentation.

For the unlabeled transfer sets, they utilized CC3M (3 million generic images) and curated sets retrieved from YFCC15M and DataComp-1B.

Key Insights

  • Specialization Trumps Generality: Distilling a VFM that has been specialized for a task is significantly more effective than distilling a "raw" VFM. Because small models have limited capacity, filling that capacity with task-specific expertise yields better results than general-purpose features.
  • The Transfer Set is Critical: The choice of unlabeled data used during distillation matters immensely. While generic web images help, using images that are visually similar to the target task (retrieved via the proposed search method) provides a massive performance boost.

Results

The proposed task-oriented approach consistently outperformed all baselines in both accuracy and efficiency.

Accuracy vs. Pretraining Compute on EuroSAT
  • Accuracy Gains: The method beat task-agnostic distillation by up to 11.6%, CLIP pretraining by 22.1%, and DINO pretraining by a staggering 29.8%.
  • Compute Savings: It achieved these superior results with a 9x reduction in pretraining compute compared to task-agnostic distillation, and a 15x reduction compared to DINO pretraining.
  • Retrieval Success: On the ADE20K segmentation task, using the retrieval-augmented transfer set significantly improved performance over using generic unlabeled data, proving the viability of "manufacturing" effective training sets by mining the web.

Limitations and Future Work

While highly efficient overall, finetuning a giant VFM (like ViT-L/14) in the first step still requires a baseline level of high-end hardware. Additionally, the retrieval strategy relies on the target domain being somewhat represented in web-scale datasets; for extremely niche industrial or medical data, retrieval might be less effective.

Future work will explore more sophisticated ways to curate transfer sets, such as using active learning or adversarial techniques to find the "hardest" examples for the student to learn from, and applying this methodology to even more constrained model architectures.

Summary updated

BibTeX
@inproceedings{vemulapalli2024knowledge,
  author = {Raviteja Vemulapalli and Hadi Pouransari and Fartash Faghri and Sachin Mehta and Mehrdad Farajtabar and Mohammad Rastegari and Oncel Tuzel},
  title = {{Knowledge Transfer from Vision Foundation Models for Efficient Training of Small Task-specific Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=OKYfaYQlML},
}
Figure