Technical Summary: Explaining Image Similarity with Automatically Extracted Concept Activation Vectors
Problem Statement
Image similarity is a foundational component of numerous computer vision applications, including image retrieval, face recognition, and fashion compatibility. While similarity is typically measured in the latent embedding spaces of pretrained deep networks, the rationale behind specific similarity scores remains opaque. Existing explainability (xAI) methods, primarily designed for single-input classification tasks, struggle to provide global insights into similarity functions, which inherently require two inputs. Current approaches often rely on gradient-based attribution maps or manually defined attributes (e.g., "stripes" or "color") to generate saliency maps. These methods face two primary limitations:
- Lack of Global Insight: They often fail to explain what specifically drives similarity across regions of an embedding space (e.g., texture vs. shape).
- Dependency on Manual Definitions: They frequently require predefined concept databases or purposefully labeled datasets, limiting their applicability to new domains or models.
- Distributional Faithfulness: Perturbations in the raw pixel space (e.g., masking) often push inputs off the data manifold, leading to unreliable explanations.
Methodology
The authors propose a model- and metric-agnostic framework that explains image similarity using Concept Activation Vectors (CAVs) extracted automatically via Sparse Autoencoders (SAEs). The methodology consists of three primary steps:
1. Sparse Dictionary Learning (Concept Extraction)
Given a dataset X and an embedding function g:X→Rd, the authors decompose the matrix of activations A into a weight matrix U and a concept dictionary V. This is achieved by minimizing the Frobenius norm:
(U,V)=argU,Vmin∥A−UV⊤∥F2
This process utilizes various SAE formulations (Top-K, JumpReLU, and Vanilla SAE) to learn a dictionary of concepts without human labeling. Each activation is approximated as a linear combination of these learned concepts.
2. Latent Space Perturbation for Pairwise Explanation
To explain the similarity between two images with embeddings ai and aj, the method perturbs the embeddings along the directions of the learned concepts. The importance of a specific concept ck is determined by measuring the change in the similarity function f when the concept's contribution is removed:
elk(ai,aj)=(f(ai,aj)−f(ai/ck,aj))+(f(ai,aj)−f(ai,aj/ck))
where ai/ck=ai−ui,kvk⊤. This symmetric approach ensures the explanation accounts for contributions from both inputs. The result is a local explanation vector characterizing shared and distinct attributes.
3. Group-Level Explanation and Exemplar Retrieval
The framework extends to group settings by averaging local explanations over a group G:
eG=(2∣G∣)1i,j∈G,i<j∑el(ai,aj)
This allows for the analysis of clusters in embedding space. Furthermore, the authors introduce Exemplar Retrieval, a task where, given a query-reference pair, the system retrieves other image pairs that share the same underlying reasons for similarity (i.e., similar explanation vectors) rather than just similar overall appearance scores.
Key Contributions
- Novel Framework: A model- and metric-agnostic explainability framework for image similarity based on automatically extracted CAVs, enabling pairwise and group-level analysis without predefined concept databases.
- Similarity-Based Attribution: A method to derive concept importance scores directly from the similarity function, providing both localization (via heatmaps) and quantification of concept impact.
- Faithful Perturbations: Experimental evidence demonstrating that latent-space perturbations are more faithful to the underlying data distribution than pixel-space baselines, resulting in fewer Out-of-Distribution (OOD) embeddings.
- Actionable Insights: The introduction of Exemplar Retrieval and group analysis, allowing users to understand and manipulate similarity judgments based on semantic concepts.
Experimental Results
The authors evaluated their approach on the VITON-HD (fashion) dataset and a synthetic Multi-CIFAR-10 Collage dataset using six vision backbones (DINOv2, DINOv3, ResNet50, ConvNeXt, ViT, SigLIP).
- Concept Verification: On the synthetic dataset, the method successfully preserved the symmetry of the similarity function. Trained dictionaries achieved approximately 90% recovery of the original similarity scores after concept swaps, with Top-K SAEs showing the lowest deviation.
- Distributional Faithfulness: Latent perturbations consistently achieved lower Wasserstein (W1) and OOD scores compared to input-space masking strategies (e.g., blurring, random masking) across all tested models. This confirms that latent perturbations remain closer to the data manifold.
- Linear Recoverability: A linear regression model trained on the explanation vectors could predict the original similarity scores with high accuracy (R2>0.87 for both Cosine and Euclidean metrics), outperforming baselines like CSIM, blur-based vectors, and gradient-based attribution.
- Qualitative Utility: In case studies, the method successfully identified semantic drivers of similarity (e.g., "stripes," "neckline") and enabled Exemplar Retrieval that retrieved images based on shared concepts (e.g., retrieving striped shirts for a striped shirt query) rather than just visual similarity.
Significance and Claims
The paper claims that its approach provides a more faithful and interpretable understanding of image similarity than existing methods. By operating in the latent space, the method avoids the pitfalls of pixel-space perturbations that often generate unrealistic images. The authors emphasize that their framework is automated, requiring no manual concept definition, and is flexible, applicable to any pretrained model and similarity metric.
The significance lies in the ability to move beyond "where" a model focuses (saliency) to "what" semantic features drive similarity. The authors position their work as a step toward actionable insights, allowing model designers to identify and potentially mitigate unwanted similarity drivers (e.g., background artifacts) and enabling advanced retrieval tasks conditioned on specific semantic reasons. However, the authors modestly note that their approach assumes a linear reconstruction of the embedding space via CAVs, which is a first-order approximation, and that SAE stability remains a consideration.