Introduction
Deep Neural Networks (DNNs) have achieved remarkable success in complex tasks like image classification, yet they remain largely "black boxes." While traditional Explainable AI (XAI) methods like SHAP or LIME focus on feature attribution—identifying specific pixels that influenced a decision—these can often be unintuitive for human users. This paper introduces EBE-DNN, a method for example-based explanations that justifies model predictions by retrieving similar training instances.
Methodology: The EBE-DNN Framework
The core idea behind EBE-DNN is to replace the standard softmax classification layer with a k-Nearest Neighbor (kNN) search within the network's internal embedding space.
The workflow consists of four primary steps:
- Feature Extraction: A pre-trained DNN (e.g., ResNet18) processes an input image.
- Embedding Extraction: Instead of the final output, the model captures the high-dimensional representation (embedding) from a specific convolutional layer.
- k-Nearest Neighbors: Using cosine similarity, the system identifies the $k$ most similar images from the training set.
- Prediction and Explanation: The final class is determined by a majority vote among the $k$ neighbors. These neighbors serve as a direct, visual explanation for the user.
Experimental Setup
The researchers evaluated EBE-DNN across three benchmark datasets:
- MNIST: Handwritten digits.
- Fashion-MNIST: Clothing items.
- CIFAR-10: Diverse color images of animals and vehicles.
Key Insights
The Layer Hierarchy
The study revealed that the choice of layer significantly impacts the nature of the explanation. Early layers tend to group images by color and texture, while middle layers capture structural components (like wheels on a car). Deep layers represent abstract semantic categories but may lose specific visual resemblance to the query.
Performance and Accuracy
Surprisingly, EBE-DNN often matches or exceeds the accuracy of the original "black box" model. On MNIST and Fashion-MNIST, using middle-layer embeddings actually improved predictive performance. On CIFAR-10, the model maintained high accuracy, though a notable performance dip was observed at layer 15, where embeddings became overly generalized.
Results and Interpretability
Qualitative analysis confirms that EBE-DNN provides semantically meaningful justifications. For instance, when classifying an automobile, the model retrieves training examples with similar orientations and structural features.
By using a small number of neighbors (e.g., $k=10$), the model provides a concentrated explanation that a human can quickly verify, offering a transparent view into the decision-making process without sacrificing computational accuracy.
Conclusion and Future Work
EBE-DNN demonstrates that example-based explanations are a viable and effective alternative to feature attribution. Future research will focus on automating the selection of the optimal embedding layer and scaling the kNN search for massive datasets. Additionally, combining example attribution with feature highlights (hybrid explanations) represents a promising frontier for making AI even more interpretable.
Summary updated