Abstract
Out-of-Distribution (OOD) detection is a critical safety requirement for deploying Deep Neural Networks (DNNs) in real-world applications. Existing methods typically rely on either discriminative latent space distances or generative reconstruction errors, both of which face unique challenges such as model overconfidence or failure on simple OOD samples. We introduce the READ (Reconstruction Error Aggregated Detector) framework, which unifies these approaches by mapping reconstruction errors into a classifier's latent space. By adjusting for image complexity, READ significantly improves detection performance, reducing false positive rates by up to 9.8% over previous state-of-the-art methods.
The Challenge of OOD Detection
DNNs are notoriously overconfident, often assigning high-certainty labels to data that differs significantly from their training distribution. Current solutions generally fall into two categories:
- Discriminative methods: These measure the distance of an input to known class clusters in a model's latent space. However, classifiers often overfit their output space.
- Generative methods: These use autoencoders (AE) to reconstruct images, assuming that OOD data will yield higher reconstruction errors. Unfortunately, AEs can be overconfident on simple OOD images (e.g., house numbers), reconstructing them more accurately than complex in-distribution images (e.g., animals).
The READ Framework
READ bridges the gap between discriminative and generative approaches through three key technical innovations:
Latent Space Transformation
Instead of calculating reconstruction error in raw pixel space, which lacks semantic depth, READ passes both the original image $x$ and its AE-reconstructed version $\hat{x}$ through the classifier's feature extractor ($f_{fe}$). It then measures the distance between these two representations in the latent space $Z$. This ensures that the "reconstruction error" reflects semantic consistency rather than just pixel-level similarity.
Aggregation Score
The final OOD score is an aggregation of the distance to the nearest class center and the transformed reconstruction error. READ offers two variants:
- READ-MD: Utilizes Mahalanobis distance with standard pre-trained classifiers.
- READ-ED: Utilizes Euclidean distance and involves a specific retraining strategy for the classifier head.
Complexity-Based Adjustment
To address the issue of autoencoders reconstructing simple OOD images too well, READ incorporates a complexity-based adjustment. The authors use a lossless compression algorithm to estimate the complexity of an input image. If an image's complexity deviates significantly from the training distribution (Reference), the weight ($\lambda$) of the reconstruction error is adjusted. This ensures that "easy" OOD samples with low pixel-wise error are still correctly identified as OOD due to their anomalous complexity.
Key Results and Insights
READ demonstrates superior performance across standard benchmarks using CIFAR-10 and CIFAR-100 as in-distribution (ID) sets:
- FPR Reduction: On CIFAR-10, READ-MD reduced the average False Positive Rate at a 95% True Positive Rate (FPR@95TPR) to 28.5%, compared to 38.3% for the previous best energy-based method.
- CIFAR-100 Performance: READ-MD achieved an average AUROC of 84.9%, outperforming the Mahalanobis baseline.
- Hard OOD Detection: The framework proved particularly effective at identifying "hard" OOD samples—those semantically similar to training data but belonging to different categories.
Conclusion
By unifying latent space distances with complexity-adjusted reconstruction errors, READ provides a more robust signal for OOD detection without requiring exposure to OOD data during training. While the method increases computational overhead by requiring dual passes through the feature extractor, its significant gains in safety and reliability make it a compelling choice for high-stakes DNN deployments. Future work will focus on optimizing inference speed and exploring architectural diversity to further refine the discrepancy signal.
Summary updated