TeachCLIP: Multi-Grained Teaching for Efficient Text-to-Video Retrieval

Kaibin Tian, Ruixiang Zhao, Hu Hu, Runquan Xie, Fengzong Lian, Zhanhui Kang, Xirong LiarXiv 2023 · DOI

Introduction

Text-to-video retrieval (T2VR) is a critical task for navigating massive video databases. Historically, models have fallen into two categories: efficient models that aggregate frames into a single vector (e.g., CLIP4Clip) and effective models that perform exhaustive cross-modal matching (e.g., X-CLIP). While the former is fast, it lacks fine-grained detail; the latter is accurate but computationally prohibitive for large-scale applications.

Effectiveness vs. Efficiency of TeachCLIP compared to other SOTA models.

TeachCLIP bridges this gap by employing a "multi-grained teaching" approach. It enables a lightweight student model to inherit the fine-grained insights of heavy state-of-the-art (SOTA) models, achieving high accuracy while remaining orders of magnitude faster and more compact.

Methodology: Multi-Grained Teaching

The core of TeachCLIP is a knowledge distillation framework where a heavy "Teacher" model (such as X-CLIP) trains an efficient "Student" model based on CLIP4Clip.

Attentional Frame-Feature Aggregation (AFA)

Unlike standard efficient models that use simple mean pooling to aggregate video frames, TeachCLIP introduces the Attentional frame-Feature Aggregation (AFA) block. This component learns to assign varying weights to different frames based on their relevance to the query. Crucially, these weights are pre-computed during the retrieval stage, ensuring no extra overhead at inference.

The TeachCLIP architecture featuring the Attentional frame-Feature Aggregation (AFA) block and multi-grained teaching framework.

Teaching Levels

The distillation occurs at two distinct levels:

  1. Coarse-grained Teaching (CgT): The student aligns its overall video-text similarity scores with the teacher's using Pearson distance. This focuses on matching the relative ranking or correlation of videos rather than absolute numerical values.
  2. Fine-grained Teaching (FgT): The student's AFA block is trained to mimic the teacher's frame-level relevance scores. This allows the student to "see" which specific frames are most important for a query without performing heavy cross-modal computation during inference.

Experimental Results

TeachCLIP was evaluated on five standard benchmarks: MSRVTT-1k, MSRVTT-3k, MSVD, VATEX, and ActivityNet-Caption.

Performance and Efficiency

TeachCLIP significantly reduces the performance gap between efficient and heavy models. On MSRVTT-1k, the gap between CLIP4Clip and X-CLIP was reduced from 5.3 to 1.0 points in SumR. Remarkably, TeachCLIP outperformed its teacher on the MSVD and VATEX datasets, suggesting that the distillation process can act as a form of ensemble learning.

In terms of efficiency, TeachCLIP requires only 0.5k FLOPs per matching and 2KB of storage per video, compared to X-CLIP’s 220.9k+ FLOPs and 26KB+ storage. This massive efficiency gain makes it highly scalable for real-world search engines where heavy models would be too slow or expensive.

Conclusion

TeachCLIP demonstrates that fine-grained knowledge can be distilled into efficient architectures without adding inference overhead. By treating efficiency as a hard constraint and using the AFA block as a specialized communication channel for teacher insights, the model achieves a superior balance of speed and accuracy. Future work may explore extending this multi-grained approach to the textual encoder or utilizing multiple teachers simultaneously.

Summary updated

BibTeX
@misc{tian2023teachclip,
  author = {Kaibin Tian and Ruixiang Zhao and Hu Hu and Runquan Xie and Fengzong Lian and Zhanhui Kang and Xirong Li},
  title = {{TeachCLIP: Multi-Grained Teaching for Efficient Text-to-Video Retrieval}},
  year = {2023},
  eprint = {2308.01217},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.01217},
}
Figure