Distilling Vision-Language Foundation Models: A Data-Free Approach via Prompt Diversification

Yunyi Xuan, Weijie Chen, Shicai Yang, Di Xie, Luojun Lin, Yueting Zhuang

Foundation models like CLIP have revolutionized computer vision with their "zero-shot" ability to recognize objects in almost any context—from oil paintings to sketches. However, these models are massive, making them impractical for edge devices like smartphones or IoT sensors.

Standard "Knowledge Distillation"—where a small "student" model learns from a large "teacher"—usually requires the original training data. For CLIP, that’s a massive, private dataset of billions of image-text pairs. Data-Free Knowledge Distillation (DFKD) attempts to solve this by synthesizing "surrogate" data from the teacher's own weights, but it often struggles with "mode collapse," where the model generates the same few images over and over, losing the diversity that makes CLIP so powerful.

In their recent paper, Xuan et al. propose a novel solution: Prompt Diversification. By using the text encoder as a bridge, they force the model to "imagine" categories in a vast array of styles, creating a lightweight student that inherits the teacher's generalization powers without ever seeing a single real training image.

TL;DR

The authors introduce DFKD-VLFM, a method to distill large Vision-Language Foundation Models into compact students without using any real data. By diversifying text prompts through mix-ups, random sampling, and contrastive learning, they synthesize highly diverse surrogate datasets that allow small models (like ResNet18) to achieve impressive out-of-distribution generalization.

What Problem Does This Paper Address?

The core challenge is generalization under distribution shift. Most data-free distillation methods focus on matching the statistics of a specific dataset (like ImageNet). When the resulting student model encounters a "domain shift"—like seeing a "dog" as a cartoon instead of a photo—it often fails.

Because foundation models like CLIP are trained on the "entire internet," they contain a rich internal prior of what objects look like in different styles. The authors realized that the bottleneck in distilling this knowledge wasn't the image generator, but the prompts used to drive it. If you only ask the model for a "photo of a dog," the student only learns what a "photo of a dog" looks like.

Methods

The authors use VQGAN-CLIP as their image synthesis engine and propose three levels of Prompt Diversification to ensure the synthetic data covers as much "style space" as possible:

  1. Mix-Prompt: The researchers built a dictionary of 86 style words (e.g., "origami," "pop art," "isometric"). They then create new styles by interpolating between the embeddings of these words, effectively asking the model to generate images in "hybrid" styles.
  2. Random-Prompt: To go beyond human-defined styles, they treat the text embedding space as a distribution. They sample "pseudo-words" from a Gaussian distribution modeled after the text encoder’s codebook, allowing the model to explore abstract visual concepts that don't have names.
  3. Contrastive-Prompt (The Top Performer): This method uses a memory bank and a contrastive loss function. It forces each new generated prompt to be as different as possible from previously used prompts. This "pushes" the synthesis process to explore the furthest corners of the model's knowledge, preventing the repetitive "model collapse" seen in earlier DFKD work.

Datasets

The authors evaluated their distilled students on four major Domain Generalization (DG) benchmarks:

  • PACS: (Photo, Art Painting, Cartoon, Sketch) - The gold standard for testing style shifts.
  • VLCS: (VOC, LabelMe, Caltech, SUN) - Focuses on different photographic datasets.
  • ImageCLEF-DA: Cross-domain tasks between Caltech, ImageNet, and Pascal.
  • VisDA: A large-scale challenge involving shifts from synthetic (3D renders) to real images.

Key Insights and Ideas

  • Text as a Bridge: The most elegant insight is using the text encoder to control image diversity. Since styles are semantically encoded in text, manipulating the prompt is a much more efficient way to explore "data space" than trying to perturb pixels directly.
  • Diversity is Better than Realism: The synthetic images (see Figure 6 in the paper) often look "trippy" or surreal. However, because they contain the essential features of a category across many different "textures," they are actually better for training a robust student than a smaller set of "perfect" realistic images.
  • The "Grafted" Student: A student model trained this way acts as a "strong few-shot learner." Even with zero real data, it starts with a better "intuition" for OOD tasks than a model pre-trained on the massive (but domain-specific) ImageNet dataset.

Key Results

  • Superior Generalization: On the PACS dataset, the Contrastive-Prompt method achieved an average accuracy of 76.59% (ResNet18), vastly outperforming the baseline DFKD approach of 52.81%.
  • Beating ImageNet Pre-training: In few-shot scenarios (training on just 1-16 real images), the distilled student consistently outperformed standard ResNet models pre-trained on ImageNet. This suggests that CLIP’s "world knowledge" is successfully being compressed into the smaller architecture.
  • Qualitative Success: While traditional DFKD often produces noisy, uninterpretable textures, the proposed methods generated images that clearly retained category-identifying features (like the shape of a dog or a house) while varying the background, pose, and artistic style.

Limitations and Future Work

  • Synthesis Overhead: Generating thousands of high-quality images via VQGAN-CLIP optimization is computationally expensive compared to standard training.
  • Teacher Dependency: The method is only as good as the teacher's internal "prior." If the foundation model has biases or lacks knowledge of a specific niche category, the synthetic data will reflect that.
  • Future Directions: The authors suggest exploring how this "prompt-driven" distillation could be applied to even larger models (like Stable Diffusion) or to different modalities like video and 3D.

Reference: Xuan, Y., Chen, W., Yang, S., Xie, D., Lin, L., & Zhuang, Y. (2024). Distilling Vision-Language Foundation Models: A Data-Free Approach via Prompt Diversification. arXiv:2407.15155v1.

Summary updated

BibTeX
@inproceedings{xuan2023distilling,
  author = {Yunyi Xuan and Weijie Chen and Shicai Yang and Di Xie and Luojun Lin and Yueting Zhuang},
  title = {{Distilling Vision-Language Foundation Models: A Data-Free Approach via Prompt Diversification}},
  booktitle = {ACM Multimedia},
  year = {2023},
  doi = {10.1145/3581783.3611911},
}
Figure