Manuscript Offprint

arXiv:2609.06785

Unified Multi-Layer Subspace Modeling for Cross-Domain OOD Detection

Gerhard Krumpl, Henning Avenhaus, Horst Possegger

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Gerhard Krumpl1,2^{1,2}, Henning Avenhaus2^{2}, and Horst Possegger1^{1}

1^{1} Institute of Visual Computing, Graz University of Technology, Austria gerhard.krumpl@icg.tugraz.at, possegger@tugraz.at

2^{2} KESTRELEYE GmbH, Austria

Abstract. Out-of-Distribution (OOD) detection remains a fundamental challenge for neural networks, whose predictions can be overconfident on inputs that deviate from the training distribution. Most post-hoc OOD detection methods derive scores from a single representation level (e.g., logits or penultimate features) or combine multiple layers via depth selection or OOD-calibrated weighting. However, because OOD shifts are diverse, the most informative representation level can vary strongly across OOD types and domains, making fixed-layer choices and OOD-calibrated aggregation brittle. In this paper, we propose PRISM (Projected Representation with Intermediate-layer Subspace Modeling), a model-agnostic post-hoc OOD detection method that models a unified multi-layer feature representation rather than aggregating independently scored layers. PRISM fuses intermediate and deep features into a single hierarchical embedding, estimates an in-distribution (ID) principal subspace, and then combines two complementary signals: (i) a class-conditional Mahalanobis distance in the projected subspace and (ii) the residual energy orthogonal to the learned manifold. This simple design avoids OOD-tuned layer weighting while capturing both in-subspace semantic deviations and off-subspace anomalies. Across diverse benchmarks spanning natural images, medical imaging, and industrial visual inspection, PRISM achieves consistent state-of-the-art cross-domain OOD detection performance with a single default configuration across all evaluated domains and architectures. We further show that PRISM incurs minimal inference overhead, making it practical for real-world deployment.

Keywords: Out-of-Distribution Detection · Intermediate Layer Feature Fusion

1 Introduction

Machine learning models have demonstrated strong performance across diverse domains [31, 57, 63] and are now widely deployed in real-world systems. Despite their strong in-distribution (ID) accuracy, such models can produce highly confident yet incorrect predictions for inputs that deviate substantially from the training distribution, creating a mismatch between confidence and correctness that may lead to silent and potentially safety-critical failures [24, 51, 54]. This is

Figure

(a) Aggregate performance across all benchmarks (top: AUROC↑, bottom: FPR95↓).

Figure

(b) Cross-domain AUROC correlation across methods.

Fig. 1: Comprehensive evaluation of post-hoc OOD detection across natural, medical, and industrial benchmarks. (a) Mean AUROC ( ↑\uparrow) and FPR95 ( ↓\downarrow) averaged over all datasets, OOD splits, and architectures. (b) Cross-domain correlation between ImageNet-1k [14] (OpenOOD [83]) and OpenMIBOOD [19] performance (AUROC). Our PRISM (orange) consistently exhibits strong performance across domains.

particularly concerning in high-consequence applications, where erroneous predictions may directly affect safety or operational reliability [26, 28, 50]. For example, in medical imaging [19], models may fail to deliver accurate diagnoses due to scanner variability or unfamiliar instruments, while in industrial inspection [10,35] systems may misclassify foreign materials as food products or fail to detect damage to machinery or infrastructure during quality control. These limitations motivate out-of-distribution (OOD) detection: identifying inputs outside the training distribution to improve deployment reliability.

Post-hoc OOD detection is particularly attractive in practice because it can be applied to pretrained models without retraining, thereby preserving ID accuracy and avoiding costly re-optimization. Accordingly, a wide range of post-hoc approaches have been proposed, leveraging predicted probabilities [27, 46], output logits [25, 45], or feature embeddings from the penultimate layer [40, 58, 66].

Our motivation arises from the observation that post-hoc OOD performance varies substantially across OOD type and application domains (see Fig. 1) [19, 35]. Recent benchmarks such as OpenMIBOOD [19] and ICONIC-444 [35] provide large-scale OOD evaluations in medical and industrial domains, respectively, and show that methods performing strongly on natural image benchmarks [83] often degrade markedly in these specialized settings.

A key driver of this variability is that post-hoc OOD detection methods typically rely on a single network layer for discrimination, yet the most informative layer depends strongly on the ID dataset and OOD type [19,37]. Consequently, most existing methods largely neglect information in intermediate layers of deep neural networks, implicitly assuming that the final representation alone is sufficient for OOD detection. While deep layers emphasize representations highly specialized for the ID task, intermediate and shallow layers capture complement tary information that can be critical for distinguishing diverse OOD characteristics, which may manifest differently as network depth increases. Other methods exist, but prior multi-layer methods either select a single layer [80], aggregate layer-wise scores [20,37,61], or calibrate aggregation/hyperparameters using synthetic or held-out OOD data [16, 40, 67], introducing additional complexity and OOD dependence. This raises a key question: how can intermediate representations be effectively integrated into a unified OOD detection framework that remains reliable across domains and OOD types without OOD-specific calibration or tuning?

To address this question, we propose PRISM, an architecture-agnostic post-hoc OOD detection method designed for cross-domain robustness. PRISM follows a simple fuse-then-model principle: instead of computing and aggregating layer-wise OOD scores, it first integrates intermediate representations from shallow to deep layers into a unified feature space and then performs statistical modeling once in that fused representation. The fused features are projected into a compact subspace learned solely from ID training data, and PRISM combines complementary distance- and residual-based signals into a single OOD score. This design avoids layer selection, layer-wise aggregation heuristics, and OOD-dependent calibration while retaining the robustness benefits of statistical feature modeling. Our main contributions are as follows:

– We show that layer-wise aggregation and OOD-based calibration is highly sensitive to the chosen validation OOD set, leading to unstable cross-domain behavior.

– We introduce a unified multi-layer subspace modeling principle that eliminates layer selection, score aggregation, and OOD-dependent calibration, while retaining the robustness benefits of statistical feature modeling.

– We evaluate PRISM across natural, medical, and industrial benchmarks under a shared configuration, achieving the best overall mean AUROC and the best average rank across datasets without OOD-based calibration.

References (79)