Distilling Knowledge from Text-to-Image Generative Models Improves Visio-Linguistic Reasoning in CLIP

Samyadeep Basu, Shell Xu Hu, Maziar Sanjabi, Daniela Massiceti, Soheil Feizi

Introduction

Contrastive Language-Image Pre-training (CLIP) has become the standard for zero-shot image classification and retrieval. However, it suffers from a significant "bag-of-words" limitation: while it can identify objects within an image, it often fails to understand the compositional relationships between them. On benchmarks like Winoground, which require distinguishing between captions like "a dog catching a frisbee" and "a frisbee catching a dog," CLIP often performs near random chance.

In contrast, generative models like Stable Diffusion demonstrate superior visio-linguistic reasoning because their training objective requires a fine-grained mapping of text to pixels. However, using these models for inference is computationally expensive—often up to 18 times slower than CLIP. This research introduces SDS-CLIP, a method to distill the reasoning capabilities of generative models into the efficient CLIP architecture.

Figure 1: The trade-off between reasoning performance (Winoground) and inference time. Generative models (Diffusion Score) achieve high accuracy but are orders of magnitude slower than CLIP variants.

Methodology

SDS-CLIP employs a parameter-efficient fine-tuning approach using Score Distillation Sampling (SDS). The method treats a frozen Stable Diffusion model as a "teacher" that provides feedback to a CLIP "student."

  1. Distillation Loss: The core innovation is the addition of a denoising diffusion loss as a regularizer ($L_{total} = L_{CLIP} + \lambda L_{SDS}$). This objective encourages CLIP's embeddings to align with the generative "common sense" of the diffusion model.
  2. Lightweight Tuning: To maintain efficiency and prevent catastrophic forgetting, the authors fine-tune only the LayerNorm parameters and a small linear projection layer. This updates only approximately 8 million parameters, making the process highly sample-efficient.
  3. Data: Fine-tuning was performed on the MS-COCO dataset (118k pairs), demonstrating that significant reasoning improvements can be achieved without massive new datasets.

Key Results and Discussion

The researchers evaluated SDS-CLIP across several challenging benchmarks, including Winoground and ARO (Attribution, Relation, and Order).

Reasoning Benchmarks

As shown in the table below, SDS-CLIP consistently outperforms both vanilla CLIP and standard fine-tuning ($L_{CLIP}$) across multiple architectures. For instance, the ViT-B/16 variant saw a jump from 0.24 to 0.31 on Winoground Overall scores.

Figure 4: Quantitative results on Winoground and ARO benchmarks. SDS-CLIP (FT with L_CLIP + L_SDS) consistently improves performance across various model backbones compared to vanilla CLIP and standard fine-tuning.

Efficiency and Generalization

  • Inference Speed: SDS-CLIP retains the rapid inference speed of the original CLIP, avoiding the high latency associated with pure generative matching.
  • Zero-Shot Performance: Unlike many fine-tuning methods, SDS-CLIP does not degrade general classification performance. In fact, it improved zero-shot accuracy on several datasets, such as an 8% gain on MNIST for the ViT-B/16 model.
  • Compositionality: The results suggest that the generative objective is fundamentally better at learning compositionality than the contrastive objective alone, and this knowledge can be successfully transferred via distillation.

Conclusion

SDS-CLIP demonstrates that the reasoning gap in contrastive models can be bridged by distilling knowledge from generative models. By focusing on lightweight parameter updates and a hybrid loss function, the authors improved CLIP's understanding of spatial relationships and object attributes while maintaining the speed and versatility that make CLIP a cornerstone of modern computer vision.

Summary updated

BibTeX
@inproceedings{basu2024distilling,
  author = {Samyadeep Basu and Shell Xu Hu and Maziar Sanjabi and Daniela Massiceti and Soheil Feizi},
  title = {{Distilling Knowledge from Text-to-Image Generative Models Improves Visio-Linguistic Reasoning in CLIP}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.351},
}
Figure