A Closer Look at the Explainability of Contrastive Language-Image Pre-training
Yi Li, Hualiang Wang, Yiqun Duan, Jiheng Zhang, Xiaomeng Li
TL;DR
This work scrutinizes explainability gaps in CLIP, notably opposite foreground emphasis and noisy activations in CAM-based visualizations. It attributes these issues to inconsistent self-attention and redundant cross-modal features, and introduces CLIP Surgery, comprising Architecture Surgery (consistent self-attention with dual-paths) and Feature Surgery (removing redundant features) that operate at inference without fine-tuning. Across multiple backbones and datasets, the method delivers substantial gains in explainability metrics and enables open-vocabulary segmentation, multi-label recognition, interactive segmentation, and multimodal visualization, often surpassing state-of-the-art CAM approaches without extra training. The approach provides practical, high-quality CAM for CLIP and offers insights into the architecture and feature dynamics of multimodal transformers.
Abstract
Contrastive language-image pre-training (CLIP) is a powerful vision-language model that has shown great benefits for various tasks. However, we have identified some issues with its explainability, which undermine its credibility and limit the capacity for related tasks. Specifically, we find that CLIP tends to focus on background regions rather than foregrounds, with noisy activations at irrelevant positions on the visualization results. These phenomena conflict with conventional explainability methods based on the class attention map (CAM), where the raw model can highlight the local foreground regions using global supervision without alignment. To address these problems, we take a closer look at its architecture and features. Based on thorough analyses, we find the raw self-attentions link to inconsistent semantic regions, resulting in the opposite visualization. Besides, the noisy activations are owing to redundant features among categories. Building on these insights, we propose the CLIP Surgery for reliable CAM, a method that allows surgery-like modifications to the inference architecture and features, without further fine-tuning as classical CAM methods. This approach significantly improves the explainability of CLIP, surpassing existing methods by large margins. Besides, it enables multimodal visualization and extends the capacity of raw CLIP on open-vocabulary tasks without extra alignment. The code is available at https://github.com/xmed-lab/CLIP_Surgery.
