Introduction
Deep neural networks are often criticized as "black boxes." While their final predictions are visible, the intermediate transformations within hidden layers remain opaque, represented only as high-dimensional vectors. Existing interpretability tools like saliency maps identify where a model focuses but fail to reveal what the model actually perceives. Furthermore, previous attempts to decode these layers suffered from "decoder bias," where it was unclear if a poor reconstruction stemmed from information loss in the classifier or limitations of the decoder itself.
To address this, we introduce ClaDec (CLAssifier-DECoder), a framework designed to translate internal neural activations into human-interpretable images. By comparing these reconstructions against a standard reference auto-encoder, we can visualize the specific information a model retains or discards as it progresses toward a decision.
Methods
The ClaDec architecture employs a two-pronged approach to isolate the classifier's internal logic:
- ClaDec (The Explainer): A pre-trained classifier's weights are frozen. A trainable decoder is then attached to a specific layer and trained to reconstruct the original input based solely on that layer's activations.
- RefAE (The Reference): To control for decoder artifacts, a standard Auto-Encoder (RefAE) with an identical architecture is trained. Crucially, the RefAE's encoder is trained specifically for reconstruction, providing a baseline of what a "perfect" decoder could achieve with that architecture.
By analyzing the discrepancy between ClaDec and RefAE, any missing details in the ClaDec output can be attributed to the classifier's feature selection process. Additionally, a Fidelity-Interpretability Trade-off is managed via a hyperparameter ($\alpha$), which incorporates a classification loss into the decoder training. This forces reconstructions to align more closely with the model's internal "prototypes."
Key Insights
The framework was evaluated on Fashion-MNIST, MNIST, and TinyImageNet, yielding several critical observations:
- Task-Relevant Filtering: As data traverses deeper layers, ClaDec reconstructions become increasingly abstract. The network actively filters out task-irrelevant details (e.g., specific textures) to focus on prototypical shapes.
- Visualizing Misclassification: For incorrectly classified images, ClaDec reveals a "morphing" effect. In deeper layers, the reconstruction of the input object gradually transforms into a prototype of the incorrect class, providing a visual explanation for the error.
- The Utility of Abstraction: Although ClaDec reconstructions often have higher reconstruction loss (appearing blurrier) than RefAE, they are superior for training secondary classifiers. This suggests ClaDec successfully captures the "essence" of features required for the task.
Key Results
Quantitative analysis confirms that ClaDec reconstructions are more representative of the model's internal state than standard auto-encoders. In experiments where an independent "evaluation classifier" was trained on reconstructed images, ClaDec versions consistently outperformed RefAE. At the final layer, evaluation accuracy for ClaDec reached 0.89, compared to 0.83 for RefAE.
Furthermore, increasing the classification loss ($\alpha > 0$) during decoder training boosted evaluation accuracy to over 90%, demonstrating that the decoder more faithfully captured the model's decision logic. The gap between RefAE and ClaDec widened in deeper layers, reflecting the increasing abstraction of the feature hierarchy.
Conclusion and Future Work
While ClaDec provides a powerful window into the "black box," it remains somewhat dependent on the decoder's architecture. Future work will explore defining reference baselines for non-image domains, such as natural language or tabular data. Additionally, this method holds promise for investigating how fine-tuning or model personalization alters internal representations.
Summary updated