Interpreting CLIP's Image Representation via Text-Based Decomposition

Yossi Gandelsman, Alexei A. Efros, Jacob Steinhardt
2/12/2026

No official code found. Best implementation: yossigandelsman/clip_text_span (233 stars, MIT, last commit 2025-06-01).

Abstract

We investigate the CLIP image encoder by analyzing how individual model components affect the final representation. We decompose the image representation as a sum across individual image patches, model layers, and attention heads, and use CLIP's text representation to interpret the summands. Interpreting the attention heads, we characterize each head's role by automatically finding text representations that span its output space, which reveals property-specific roles for many heads (e.g. location or shape). Next, interpreting the image patches, we uncover an emergent spatial localization within CLIP. Finally, we use this understanding to remove spurious features from CLIP and to create a strong zero-shot image segmenter. Our results indicate that a scalable understanding of transformer models is attainable and can be used to repair and improve models.

View on arXivView PDF

Code Implementations(1)

MIT

official implementation of "Interpreting CLIP's Image Representation via Text-Based Decomposition"

23328Python, Jupyter NotebookOct 9, 20231 years agoMIT

Similar Papers

Cite this paper

@article{gandelsman2026interpreting,
  title  = {Interpreting CLIP's Image Representation via Text-Based Decomposition},
  author = {Yossi Gandelsman and Alexei A. Efros and Jacob Steinhardt},
  year   = {2026},
  eprint = {2310.05916},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2310.05916},
  journal = {ICLR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2310.05916.svg)](https://codeofpaper.com/paper/2310.05916)

Discussion