Interpreting CLIP's Image Representation via Text-Based Decomposition
About
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.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Medical Image Classification | OrganMNIST3D | Accuracy12.42 | 44 | |
| Segmentation | PascalVOC Single-Class 2012 (val) | Accuracy75 | 23 | |
| Segmentation | ImageNet Segmentation (test) | Accuracy75.81 | 23 | |
| Image Classification | Galaxy10 | Accuracy24.07 | 19 | |
| Multi-concept grounding | Multi-Concept Confusion Dataset | mIoU (fg)25.47 | 13 | |
| Image Classification | BloodMNIST | Top-1 Accuracy11.04 | 10 | |
| Concept-based Classification | Gravity Spy | Top-1 Accuracy4.25 | 6 | |
| Concept-based Classification | iNaturalist | Top-1 Accuracy20 | 6 | |
| Concept-based Classification | HAM10000 | Top-1 Accuracy17.1 | 6 | |
| Concept-based Classification | OrganCMNIST | Top-1 Accuracy7.4 | 6 |