Text2Concept: Concept Activation Vectors Directly from Text

Mazda Moayeri, Keivan Rezaei, Maziar Sanjabi, Soheil Feizi

Abstract

Concept Activation Vectors (CAVs) are a powerful tool for interpreting deep learning models, yet their creation typically requires labor-intensive manual curation of image datasets. We present Text2Concept, a novel framework that generates CAVs directly from natural language descriptions. By training a simple linear aligner to map the feature space of off-the-shelf vision models into CLIP’s embedding space, we enable the extraction of semantic concepts without any image-based concept supervision. Our method facilitates zero-shot classification and the construction of interpretable Concept Bottleneck Models (CBMs). Experimental results demonstrate that Text2Concept achieves high accuracy across standard benchmarks and provides a scalable interface for model interpretability.

Introduction

The "black box" nature of deep neural networks remains a significant hurdle for their deployment in high-stakes domains. Concept Activation Vectors (CAVs) were introduced to bridge the gap between high-dimensional model features and human-understandable concepts. However, the traditional approach to defining a CAV involves curating a set of positive and negative image examples for every concept of interest—a process that is both time-consuming and difficult to scale. Text2Concept addresses this bottleneck by allowing researchers to define concepts using language alone, leveraging the cross-modal alignment of large-scale pre-trained models like CLIP.

Methods

The Text2Concept pipeline relies on three primary components:

  1. The Aligner: A linear transformation is trained to map the feature representations of a "source" vision model (e.g., a self-supervised ViT or ResNet) to the feature space of a "target" CLIP vision encoder. This alignment is performed using a general dataset like ImageNet.
  2. The Bridge: Once the source model is aligned with CLIP’s vision space, it inherits the alignment with CLIP’s text encoder.
  3. Concept Generation: CAVs are generated by passing text prompts (e.g., "an object in a tree") through the CLIP text encoder. These vectors can then be used to probe the aligned features of the source model via cosine similarity.

This approach is highly efficient: the linear aligner is trained once per model, after which generating new concept vectors is instantaneous and requires no additional data curation.

Key Results and Insights

The effectiveness of Text2Concept is evidenced by its performance in zero-shot classification and model interpretability tasks. Aligned self-supervised models achieved up to 85% accuracy on multi-class classification tasks without explicit training. Furthermore, Concept Bottleneck Models built using Text2Concept reached 93.8% accuracy on the RIVAL10 dataset while providing interpretable attribute scores.

Figure 1: Visualization of the "in a tree" concept across different object categories. The "Most Similar" row identifies images where objects are situated in trees, while the "Least" row shows the same objects in different contexts, such as close-ups.
  • Latent Semantic Knowledge: Standard vision models capture rich semantic information that can be unlocked via a language interface. Surprisingly, a simple linear transformation is sufficient to align the feature spaces of vastly different architectures.
  • Diagnostic Utility: Text2Concept can be used to identify distribution shifts. For instance, it revealed that performance drops on the ObjectNet dataset were linked to a massive shift in the "indoors" concept relative to ImageNet, providing a semantic explanation for model failure.

Discussion and Limitations

While Text2Concept significantly reduces the overhead of concept-based interpretability, it is constrained by the capabilities of the underlying CLIP model. Concepts not well-represented in CLIP's training data cannot be accurately extracted. Additionally, while linear mappings are efficient, they may not capture all nuances of the relationship between different feature spaces. Future research will explore non-linear alignment techniques and the use of text-derived CAVs for model editing and debiasing.

Conclusion

Text2Concept provides a scalable and efficient path toward interpretable machine learning. By bypassing the need for manual image curation, it allows for the rapid exploration of model behavior through the intuitive medium of natural language.

Summary updated

BibTeX
@inproceedings{moayeri2023text,
  author = {Mazda Moayeri and Keivan Rezaei and Maziar Sanjabi and Soheil Feizi},
  title = {{Text2Concept: Concept Activation Vectors Directly from Text}},
  booktitle = {Workshops @ CVPR},
  year = {2023},
  doi = {10.1109/cvprw59228.2023.00386},
}
Figure