Skip to main content
QUICK REVIEW

[Paper Review] A Closer Look at the Explainability of Contrastive Language-Image Pre-training

Yi Li, Hualiang Wang|arXiv (Cornell University)|Apr 12, 2023
Multimodal Machine Learning ApplicationsComputer Science42 citations
TL;DR

The paper introduces CLIP Surgery, a method to improve CLIP explainability by architecture and feature modifications during inference, yielding substantial gains in open-vocabulary tasks without retraining.

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.

Motivation & Objective

  • Identify why CLIP exhibits counterintuitive (opposite) visualization and noisy activations in its similarity maps.
  • Develop a surgery-based inference technique to correct visualization and suppress noise without retraining.
  • Demonstrate improvements of the explainability framework across open-vocabulary segmentation, multi-label recognition, and multimodal visualization.
  • Show robustness across backbones (CNNs and ViTs) and datasets.

Proposed method

  • Propose CLIP Architecture Surgery that replaces q-k self-attention with v-v self-attention and introduces dual paths to merge multi-layer outputs during inference.
  • Introduce CLIP Feature Surgery to remove redundant features by estimating and subtracting common activations using an empty text prompt and category weights.
  • Analyze self-attention and FFN contributions to explain why opposite visualization occurs and why noisy activations arise.
  • Provide inference-time modifications that do not require fine-tuning or backpropagation for labels.

Experimental results

Research questions

  • RQ1Why does CLIP produce opposite visualization compared to ground-truth foregrounds across backbones?
  • RQ2What causes noisy activations in CLIP similarity maps, and can they be mitigated without retraining?
  • RQ3Can architecture and feature-level interventions during inference improve explainability and open-vocabulary tasks across multiple datasets and backbones?
  • RQ4How does CLIP Surgery affect open-vocabulary semantic segmentation and multi-label recognition performance?
  • RQ5Is the method applicable to multimodal visualization and interactive segmentation tools?

Key findings

  • Opposite visualization is linked to self-attention query-key (q-k) parameters; replacing with v-v self-attention during inference aligns attention to same-semantic regions.
  • Noisy activations stem from redundant CLIP features; removing redundant features via CLIP Feature Surgery significantly reduces spurious activations.
  • CLIP Surgery yields large explainability gains across backbones (CNNs and ViTs) and datasets, with up to 38.42% mIoU and 72.48% mSC improvements in explainability metrics.
  • Open-vocabulary multi-label recognition improves by 4.41% at mAP on NUS-Wide without extra training.
  • Open-vocabulary semantic segmentation improves by 8.74% mIoU on Cityscapes and 4.56%/4.44% on COCO Stuff and PASCAL Context respectively (relative to baselines).
  • The approach also benefits multimodal visualization and interactive segmentation tools (e.g., SAM).
  • The method operates at inference time, avoiding fine-tuning and enabling broad applicability across backbones and tasks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.