Abstract
Contrastive Language-Image Pre-training (CLIP) models excel in integrating semantic information between images and text through contrastive learning techniques. It has achieved remarkable performance in various multimodal tasks. However, the deployment of large CLIP models is hindered in resource-limited environments, while smaller models frequently fail to meet the performance benchmarks required for practical applications. In this paper, we propose a novel approach, ComKD-CLIP: Comprehensive Knowledge Distillation for Contrastive Language-Image Pre-traning Model, which aims to comprehensively distill the knowledge from a large teacher CLIP model into a smaller student model, ensuring comparable performance with significantly reduced parameters. ComKD-CLIP is composed of two key mechanisms: Image Feature Alignment (IFAlign) and Educational Attention (EduAttention). IFAlign makes the image features extracted by the student model closely match those extracted by the teacher model, enabling the student to learn teacher's knowledge of extracting image features. EduAttention explores the cross-relationships between text features extracted by the teacher model and image features extracted by the student model, enabling the student model to learn how the teacher model integrates text-image features. In addition, ComKD-CLIP can refine the knowledge distilled from IFAlign and EduAttention by leveraging the text-image feature fusion results of the teacher model, ensuring the student model accurately absorbs the teacher's knowledge. Extensive experiments conducted on 11 datasets have demonstrated the superiority of the proposed method.
Introduction
Contrastive Language-Image Pre-training (CLIP) has revolutionized multimodal AI by bridging the gap between visual and textual understanding. However, the most capable CLIP models, such as ViT-L/14, are computationally expensive and difficult to deploy on edge devices or smartphones. While knowledge distillation offers a path to compress these models into smaller students (e.g., ViT-B/16), traditional methods often focus solely on the final output logits, neglecting the internal "reasoning" processes of the teacher model. ComKD-CLIP addresses this by distilling the teacher's internal feature extraction and cross-modal integration strategies.
Methodology
ComKD-CLIP introduces a comprehensive distillation framework that moves beyond simple logit matching. It employs two primary modules to transfer deep architectural knowledge:
Image Feature Alignment (IFAlign)
Rather than forcing a point-to-point vector match, IFAlign aligns the mean and variance statistics of the image features. This approach teaches the student the "style" of the teacher’s feature extraction, helping it identify salient visual regions with the same priority as the larger model.
Educational Attention (EduAttention)
To capture how the teacher relates text to images, EduAttention utilizes a cross-attention mechanism. It explores the relationship between the teacher’s text features and the student’s image features, forcing the student to learn the nuanced strategies used to integrate information across different modalities.
Experimental Results
Performance Across Diverse Benchmarks
The framework was evaluated on 11 datasets covering generic objects (ImageNet), fine-grained categories (OxfordPets, StanfordCars), and specialized domains (EuroSAT). ComKD-CLIP achieved state-of-the-art performance in 8 out of 11 recognition datasets, consistently outperforming other distillation methods like PromptKD and MaPLe.
Generalization and Robustness
A key strength of ComKD-CLIP is its ability to generalize to unseen categories. In base-to-novel generalization tests, it achieved a Harmonic Mean (HM) of 83.84%, surpassing previous leaders. Furthermore, the model demonstrated high robustness against domain shifts, maintaining superior accuracy when tested on sketches and adversarial variants of ImageNet.
Conclusion
ComKD-CLIP successfully bridges the performance gap between massive teacher models and deployable student models. By aligning internal feature statistics and cross-modal attention patterns, it ensures that smaller models do not just mimic the teacher's answers, but also its underlying multimodal intelligence. This framework paves the way for high-performance CLIP deployment in resource-constrained environments.
Summary updated