Prototypical Self-Explainable Models Without Re-training

Srishti Gautam, Ahcene Boubekki, Marina M.-c. Höhne, Michael Kampffmeyer

Abstract

Explainable AI (XAI) often faces a trade-off between the high performance of "black-box" models and the inherent interpretability of Self-Explainable Models (SEMs). This paper introduces KMEx (K-Means Explainer), a universal method to transform any pre-trained deep learning encoder into a Prototypical SEM (PSEM) without costly retraining. KMEx identifies representative "prototypes" in the latent space using k-means clustering and replaces the final classification layer with a transparent 1-nearest neighbor decision rule. Our evaluation across seven datasets demonstrates that KMEx maintains the accuracy of the original black-box models while eliminating "concept ghosting"—a common flaw in existing SEMs where visualized prototypes are not actually used for prediction.

Introduction

The demand for transparency in machine learning has led to two primary approaches: post-hoc explanations and Self-Explainable Models (SEMs). While SEMs are theoretically superior for safety-critical applications, they often require complex architectures and specialized training. A significant issue identified in current prototypical SEMs is "concept ghosting," where the model presents prototypes to the user that do not contribute to the final classification decision. This paper addresses these challenges by proposing a method that leverages the existing feature space of optimized black-box models.

Methodology: The KMEx Framework

The core of the proposed approach is KMEx, which converts a pre-trained black-box encoder $f$ into an interpretable classifier in two distinct steps:

  1. Prototype Discovery: The embeddings of the training data are extracted from the pre-trained encoder. K-means clustering is then performed independently for each class to identify $L$ representative prototypes within the latent space.
  2. Transparent Classification: The original black-box classifier (e.g., a Softmax layer) is discarded. In its place, a 1-nearest neighbor (1-NN) classifier is implemented. For any new input, the model identifies the closest prototype in the embedding space and assigns the corresponding class label.
The KMEx pipeline transforms a black-box encoder into a prototypical self-explainable model by clustering the latent space and using a 1-nearest neighbor classifier.

This architecture ensures that the explanation—"this input looks like this prototype"—is exactly how the model reached its decision, thereby achieving 0% concept ghosting by design.

Experimental Setup

The authors evaluated KMEx against state-of-the-art baselines, including ProtoPNet, FLINT, and ProtoVAE. The evaluation spanned seven diverse image datasets:

  • Standard Benchmarks: MNIST, FashionMNIST, SVHN, CIFAR-10, and STL-10.
  • QuickDraw: A subset of 10 sketch classes.
  • CelebA: Binary classification for human attributes.
  • CUB200: A fine-grained bird species dataset for patch-based analysis.

A new quantitative framework was introduced to measure SEM performance across three dimensions: Transparency (faithfulness of the explanation to the decision), Trustworthiness (alignment with the original black-box model), and Diversity (uniqueness of the learned prototypes).

Key Results and Insights

KMEx demonstrates that interpretability can be achieved without sacrificing performance or incurring high training costs.

Performance and Efficiency

KMEx matched the predictive accuracy of original ResNet34 models within 0.3 percentage points across most datasets (e.g., 91.9% on STL-10). Furthermore, KMEx is significantly more efficient; for the MNIST dataset, it achieved results in ~346 seconds compared to ~3600 seconds for training a standard SEM from scratch.

Eliminating Concept Ghosting

Unlike popular models like ProtoPNet, which can "ghost" over 60% of their prototypes, KMEx ensures every prototype shown is a potential decision point. This alignment makes the local explanations highly faithful to the model's internal logic.

Examples of test images and their closest prototypes for the 'dog' class. The 1-nearest neighbor rule ensures the classification depends directly on the most similar prototype.

Subclass Representation

On the CelebA dataset, KMEx proved more capable of capturing minority attributes (e.g., baldness) than baselines, which often collapsed onto a few dominant features. This suggests that the latent space of well-trained black-box models already contains rich, diverse information that KMEx successfully extracts.

Limitations and Future Work

While KMEx provides a robust path to interpretability, it requires the user to pre-define the number of prototypes ($k$). Additionally, while prototypes are mathematically distinct, they may occasionally appear visually similar to human observers. Future work will focus on refining patch-based localizations for complex datasets like CUB200, where a slight drop in accuracy was observed when moving from image-level to part-level explanations.

Summary updated

BibTeX
@article{gautam2024prototypical,
  author = {Srishti Gautam and Ahcene Boubekki and Marina M.-C. Höhne and Michael Kampffmeyer},
  title = {{Prototypical Self-Explainable Models Without Re-training}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2024},
  url = {https://openreview.net/forum?id=CMvbzKIkFY},
}
Figure