Introduction
Deep neural networks are notoriously overconfident, often assigning high-confidence labels to out-of-distribution (OOD) data they were never trained to recognize. While "far-OOD" detection (e.g., distinguishing cars from cats) is largely considered a solved problem, "near-OOD" detection remains a significant hurdle. In these scenarios, OOD samples are semantically similar to in-distribution (ID) data, leading to significant overlap in high-dimensional feature representations and making traditional scoring methods unreliable.
The Near-OOD Challenge
In near-OOD cases, such as distinguishing between similar skin diseases, the representations of ID and OOD samples often occupy the same regions of the feature space. This overlap causes standard metrics like Softmax probability or Energy scores to fail, as they cannot effectively separate the two distributions.
Methodology: P-OCS
The authors propose P-OCS (Perturbations in the Orthogonal Complement Subspace), a lightweight post-hoc method that exploits the geometric structure of feature distributions. The core insight is that ID data typically concentrates its variance within a low-dimensional "principal subspace," while OOD data tends to leak into the orthogonal complement—directions in the feature space that the ID data rarely utilizes.
The P-OCS algorithm follows a four-step process:
- Subspace Decomposition: PCA is performed on the penultimate layer features of the training data to identify the principal subspace and its orthogonal complement.
- Targeted Perturbation: For a test sample, a stochastic perturbation is applied specifically within the orthogonal complement subspace.
- One-Step Update: A single perturbation step is used to measure how much the feature representation "drifts."
- Instability Scoring: An OOD score is calculated based on this drift. Because OOD samples naturally reside more in the complement space, they exhibit much higher instability under these targeted perturbations than ID samples.
Experimental Results
P-OCS was evaluated across challenging benchmarks, including a specialized dermatology dataset and ImageNet-1K, using both ResNet-50 and ConvNeXt backbones. The method demonstrates remarkable efficiency, with a computational complexity of only $O(d^2)$ at the penultimate layer, adding negligible latency to the model's forward pass.
On the dermatology dataset, P-OCS achieved a near-perfect AUROC of 100.00 and an FPR@95 of 0.00, significantly outperforming established baselines. These results were consistent across different model architectures, proving the method's robustness and generalizability.
Conclusion
P-OCS offers a powerful and efficient solution for OOD detection by focusing on the "forbidden" directions of the feature space. By leveraging the geometric properties of the orthogonal complement, it successfully identifies near-OOD samples that traditional methods miss, all without requiring model retraining or expensive iterative optimization.
Summary updated