Perturbations in the Orthogonal Complement Subspace for Efficient Out-of-Distribution Detection
Zhexiao Huang, Weihao He, Shutao Deng, Junzhe Chen, Chao Yuan, Hongxin Wang, Changsheng Zhou
TL;DR
Out-of-distribution detection remains challenging when OOD samples resemble in-distribution data. The paper introduces P-OCS, which performs a single perturbation confined to the orthogonal complement of the ID principal subspace in penultimate features, with the OOD score $s(x)=\sum_{t=0}^{T-1} \| z_{t+1}-z_t\|_2$ capturing accumulated drift. Theoretical justification shows one-step suffices in the small-perturbation regime, and empirical results on dermatology and ImageNet benchmarks demonstrate state-of-the-art performance with negligible computational overhead and no retraining. This orthogonal-complement perspective provides a clear geometric interpretation of OOD behavior, offering robust near-OOD and far-OOD detection across architectures and datasets. The approach is practical for real-time and safety-critical applications, and it opens avenues for extending to nonlinear subspaces and multi-modal settings.
Abstract
Out-of-distribution (OOD) detection is essential for deploying deep learning models in open-world environments. Existing approaches, such as energy-based scoring and gradient-projection methods, typically rely on high-dimensional representations to separate in-distribution (ID) and OOD samples. We introduce P-OCS (Perturbations in the Orthogonal Complement Subspace), a lightweight and theoretically grounded method that operates in the orthogonal complement of the principal subspace defined by ID features. P-OCS applies a single projected perturbation restricted to this complementary subspace, enhancing subtle ID-OOD distinctions while preserving the geometry of ID representations. We show that a one-step update is sufficient in the small-perturbation regime and provide convergence guarantees for the resulting detection score. Experiments across multiple architectures and datasets demonstrate that P-OCS achieves state-of-the-art OOD detection with negligible computational cost and without requiring model retraining, access to OOD data, or changes to model architecture.
