Explaining Image Similarity with Automatically Extracted Concept Activation Vectors

Isaac Roberts, Petra Bevandic, Alexander Schulz, Barbara HammerarXiv 2026

TL;DR

This paper introduces a model- and metric-agnostic framework that explains why deep learning models judge two images as similar. By automatically extracting human-interpretable concepts using Sparse Autoencoders (SAEs), the method perturbs image embeddings directly in the latent space to quantify concept importance, outperforming traditional pixel-space masking in both faithfulness and data distribution preservation.

What Problem Does This Paper Address?

While explainable AI (xAI) has made massive strides in single-input tasks like image classification (e.g., highlighting which pixels caused a "cat" label), explaining image similarity is significantly harder. Similarity functions require two inputs, and standard saliency maps struggle to show what global features—like texture, shape, or color—drive the comparison.

Existing similarity xAI methods typically rely on manually defined, pre-labeled attribute databases or crude pixel-space perturbations (like blurring or blacking out parts of an image). Pixel masking often pushes the image off the natural "data manifold," confusing the underlying model and leading to unfaithful explanations. This paper tackles these gaps by automatically discovering concepts and explaining similarity via clean, latent-space interventions.

Methods

The authors propose a three-step framework:

  1. Sparse Dictionary Learning: They use Sparse Autoencoders (SAEs)—specifically Top-K, JumpReLU, and Vanilla formulations—to decompose the embeddings of a foundation model into a large dictionary of sparse, human-interpretable Concept Activation Vectors (CAVs). This requires zero manual labeling.
  2. Latent Perturbation: To measure how much a specific concept (e.g., "stripes") contributes to the similarity between two images, they mathematically subtract that concept's vector from the images' embeddings. They then measure the drop in the similarity score (e.g., cosine similarity or Euclidean distance).
  3. Symmetric & Group-Level Extensions: The framework ensures a symmetric explanation (the similarity reason from Image A to B is the same as B to A). Crucially, it also scales up to explain group-level similarity, showing what drives the cohesion of an entire cluster of images.

The authors also introduce a new downstream task called Exemplar Retrieval: given a pair of similar images, the goal is to find other image pairs that are similar for the exact same semantic reasons.

Overview of the proposed CAV-based explanation method versus traditional predefined attribute baselines.

Datasets

The method was evaluated across six distinct vision backbones (including DINOv2, DINOv3, ResNet50, SigLIP, and ViT) on two datasets:

  • Multi-CIFAR-10 Collage: A synthetic dataset created by the authors where each sample is a 2×2 grid of distinct CIFAR-10 images. This provides an absolute ground truth for concept presence and eliminates spatial confounding.
  • VITON-HD: A real-world fashion dataset consisting of high-resolution images of top body garments, used to test the framework on complex, unlabelled natural data.

Key Insights and Ideas

  • Latent Space > Pixel Space: Modifying images in pixel space (blurring/masking) creates unnatural artifacts that distort the model's internal representations. Subtracting concepts directly in the latent space keeps the modified embeddings firmly within the model's expected data distribution.
  • Linear Recoverability: The generated explanation vectors are so high-fidelity that a simple linear regression model can reconstruct the original similarity score using only the concept importances.
  • Unsupervised Granularity: Without any human labels, the SAEs automatically disentangle highly specific sub-categories. For instance, when analyzing a "stripes" concept, the latent space naturally segregates short-sleeve striped shirts from long-sleeve striped shirts.

Key Results

  • Distributional Faithfulness: Across all tested foundation models, the latent-space interventions consistently achieved lower Out-of-Distribution (OOD) scores and lower 1-Wasserstein ($W_1$) distances compared to pixel-space masking baselines like blurring or quadrant averaging.
  • Reconstructing Similarity: In linear recoverability experiments, the proposed method achieved an $R^2$ score of 0.94 for Cosine similarity and 0.87 for Euclidean distance, significantly beating alternative explanation methods like CSIM or gradient-based attributions.
  • Exemplar Retrieval Success: When retrieving pairs based on similarity reasons, the framework successfully matched semantic concepts (e.g., retrieving dark-colored shirts or specific necklines) where standard cosine similarity baselines failed by only matching overall coarse appearance.
UMAP projection of explanation vectors relative to a query image, demonstrating how semantic similarity and dissimilarity concepts naturally cluster.

Limitations and Future Work

  • The Linearity Assumption: The method implicitly assumes that a model's embedding space can be linearly reconstructed using CAVs. While a solid first-order approximation, it might miss highly abstract or complex relational similarities.
  • Background Noise: In foundation models that haven't been fine-tuned on a specific domain, ubiquitous "background" concepts (like image-to-background contrast) can sometimes rank highly in importance, slightly cluttering the explanation.
  • Visualizing Latent Shifts: Because the perturbations happen entirely in the embedding space, you cannot directly "see" what the image looks like after a concept is removed. The authors suggest integrating diffusion models in future work to translate these latent interventions back into the pixel space for even better human interpretability.

Summary updated

BibTeX
@misc{roberts2026explaining,
  author = {Isaac Roberts and Petra Bevandic and Alexander Schulz and Barbara Hammer},
  title = {{Explaining Image Similarity with Automatically Extracted Concept Activation Vectors}},
  year = {2026},
  eprint = {2607.28386},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.28386},
}
Figure