TextCAVs: Debugging vision models using text

Angus Nicolson, Yarin Gal, J. Alison Noble · DOI

Introduction

Deep learning models are often criticized as "black boxes," making their internal decision-making processes difficult to interpret. Traditional interpretability methods, such as Concept Activation Vectors (CAVs), require expensive, hand-labeled "probe sets" of images to represent human-understandable concepts. This paper introduces TextCAVs, a novel method that eliminates the need for these image-based probes by leveraging natural language. By bridging standard vision models with Vision-Language Models (VLMs) like CLIP, TextCAVs allow researchers to interactively "ask" a model about the concepts it uses simply by typing text descriptions.

Methods

The core of the TextCAV framework is a "bridge" between a Target Model (e.g., a ResNet-50) and a Vision-Language Model (e.g., CLIP).

The authors train two linear layers: $h$, which maps CLIP features to the Target Model's activation space, and $g$, which performs the reverse mapping. These layers are optimized using a combination of Reconstruction Loss (to ensure feature fidelity across translations) and Cycle Consistency Loss (to maintain consistency when translating CLIP text embeddings). Once trained, any text string can be passed through CLIP’s text encoder and the linear bridge $h$ to produce a Concept Activation Vector ($v_c$) directly in the Target Model's feature space. Model sensitivity to a concept is then measured via the directional derivative, checking how internal activations change in the direction of $v_c$.

Experimental Setup

The method was validated across several diverse datasets:

  • ImageNet: Used for natural image validation and the SaTML interpretability competition.
  • MIMIC-CXR & CheXpert: A large-scale medical dataset of chest X-rays and radiology reports, where reports served as a source of concepts.

Results and Discussion

TextCAVs demonstrated significant utility in both security and bias detection tasks. In the SaTML competition, the method successfully identified all four hidden "trojan" triggers in vision models, placing third overall.

Bias Discovery

A key experiment involved intentionally biasing a chest X-ray model by pairing "Atelectasis" (lung collapse) exclusively with "Support Devices" (e.g., chest tubes).

While a standard model showed high sensitivity to clinical lung features, the biased model exhibited nearly zero sensitivity to clinical terms, instead relying heavily on concepts like "nasogastric tube" and "catheter." TextCAVs effectively identified this shortcut learning without requiring a pre-labeled image set of tubes or catheters.

Limitations

Despite its success, TextCAVs rely on the assumption of linearity in the penultimate layer, which may not hold for deeper, non-linear representations. Additionally, the quality of explanations is inherently tied to the underlying VLM's understanding of specific domains (e.g., specialized medical terminology). Future work will focus on extending this approach to non-linear layers and refining the feature mapping to reduce concept noise.

Conclusion

TextCAVs provide a scalable, zero-shot approach to model interpretability. By enabling real-time, text-based debugging, the method empowers researchers to test hypotheses and discover biases on the fly, significantly reducing the overhead of traditional concept-based explanation techniques.

Summary updated

BibTeX
@inproceedings{nicolson2024textcavs,
  author = {Angus Nicolson and Yarin Gal and J. Alison Noble},
  title = {{TextCAVs: Debugging vision models using text}},
  booktitle = {ISIC/iMIMIC/EARTH/DeCaF @ MICCAI},
  year = {2024},
  url = {https://openreview.net/forum?id=74qgK8gYGG},
}
Figure