Don't Replace, Complement: A Detector-Agnostic Subspace Signal for Near-OOD Detection

Wonseok Shin, Songkuk KimarXiv 2026 · arXiv

TL;DR

The paper introduces PLUS (Per-class Low-dimensional sUbspace Signal), a "plug-and-play" complement designed to boost near-out-of-distribution (near-OOD) detection. By using a sparse autoencoder to build compact, class-specific subspaces, PLUS provides a targeted signal that consistently improves the performance of 18 different existing OOD detectors across 7 diverse model architectures without requiring any retraining or exposure to OOD data.

What Problem Does This Paper Address?

Machine learning models often struggle when they encounter inputs that don't belong to any of their training classes—a problem known as Out-of-Distribution (OOD) detection. Researchers typically categorize OOD inputs into two types:

  1. Far-OOD: Samples that are semantically very different from the training data (e.g., showing a picture of a car to a model trained only on flowers).
  2. Near-OOD: Samples that are visually and semantically similar to the training classes (e.g., showing a rare breed of dog to a model trained on common dog breeds).

While current "post-hoc" detectors (which work on pre-trained models) are excellent at catching far-OOD samples, they often fail at near-OOD detection. This is because far-OOD inputs fail to activate the model's class-specific features, making them easy to spot using global summaries like "energy" or "confidence." Near-OOD inputs, however, look almost identical to in-distribution (ID) data on these global axes.

The authors argue that we shouldn't try to replace existing detectors. Instead, we need a complementary signal that specifically captures the fine-grained internal structure of individual classes where global scores are blind.

Methods

The authors propose PLUS, which follows a simple but effective pipeline:

  1. Sparse Autoencoder (SAE) Training: They train a TopK-SAE on the features of the pre-trained classifier using only in-distribution training data.
  2. Subspace Construction: For every class, they identify the $m=16$ neurons in the SAE that are most frequently and strongly active. They take the corresponding decoder directions and orthonormalize them to create a fixed, low-dimensional per-class subspace.
  3. The Signal $z$: At inference time, an input is projected into the subspace of its predicted class. PLUS calculates the whitened squared Mahalanobis distance ($z$) within this subspace. This measures how "atypical" the input is relative to that specific class’s internal distribution.
  4. Additive Fusion: This signal $z$ is standardized and then simply added to any existing "base" detector score (like Energy or MSP) using a fixed weight ($\beta = 0.5$).
Figure 1. Overview of PLUS. (a) Training: Using only ID training data, a TopK-SAE is trained on backbone features. For each class c, a fixed support Sc of its m most active neurons is identified, orthonormalized into a basis Qc, and characterized by subspace statistics (µc, Σc). (b) Inference: Given an input image, the classifier produces the ℓ2-normalized feature x and the predicted class ˆc. PLUS then computes the whitened deviation z(x) within the predicted class’s subspace. Both the base detector score and z(x) are standardized using correctly classified ID validation negatives and additively fused with a single fixed weight β = 0.5.

Crucially, PLUS is detector-agnostic. It doesn't care which base detector you use; it just makes it better at seeing near-OOD samples.

Datasets

The authors evaluated their method using ImageNet-1K as the in-distribution dataset. For OOD evaluation, they used:

  • Near-OOD: SSB-hard and NINCO.
  • Far-OOD: iNaturalist, Textures, and OpenImage-O.

They tested this across seven different backbones, including standard CNNs (ResNet-50, ResNet-18), Transformers (ViT-B/16, Swin-T), and hybrids (MaxViT-T).

Key Insights and Ideas

  • SAEs as Geometric Tools: While much of the hype around Sparse Autoencoders focuses on "interpretability" (finding human-understandable features), this paper treats them as a robust geometric tool for isolating class-specific coordinate systems.
  • The "Near-OOD Gain" requires both Subspace and Metric: Through ablation studies, the authors found that neither a random subspace nor a simple isotropic metric (like Euclidean distance) works. You need the specific SAE-derived subspace and a per-class Mahalanobis metric to capture the unique anisotropy (shape) of each class.
  • Global Constants Work: One of the most surprising findings is that a single set of hyperparameters ($m=16, \beta=0.5$) works across vastly different architectures. This suggests that the structural gap between ID and near-OOD data is a fundamental property of deep feature spaces.
  • Feature Participation Ratio (PR): The demand for subspace size ($m$) is linked to how "spread out" a model's features are. Models with high PR (like Transformers) are more robust to smaller subspaces, while CNNs with low PR require the full $m=16$ to avoid performance collapse.
Figure 3. Support-size demand tracks the feature participation ratio. The small-m Near-AUROC loss (fused near-gain at m=16 minus m=2, in points) against the ID-train participation ratio PR, over seven backbones.

Key Results

  • Universal Improvement: When added to 18 different OOD detectors across 7 backbones (126 combinations total), PLUS improved near-OOD AUROC in every single case.
  • Near-OOD Boost: Improvements were often massive. For example, adding PLUS to the "Energy" detector on a ViT-B/16 backbone boosted near-OOD AUROC by over 10 points.
  • Preserving Far-OOD: Unlike many methods that trade far-OOD performance for near-OOD gains, PLUS broadly maintains or even slightly improves far-OOD detection.
  • Sensitivity: The fusion weight $\beta=0.5$ proved to be a robust "sweet spot" across architectures, balancing the gains in near-OOD with the stability of far-OOD.
Figure 2. Sensitivity to the fusion weight β on an MDS++ base. Near-AUROC (solid) and far-AUROC (dashed) across backbones.

Limitations and Future Work

  • Dataset Scale: The current work focuses on ImageNet-scale classification. Future work is needed to see if these per-class subspaces generalize to "enterprise-scale" settings with tens of thousands of classes.
  • Task Generalization: The authors suggest extending this framework from image classification to dense prediction tasks like object detection or segmentation.
  • Adaptive Fusion: While the fixed weight $\beta=0.5$ works well, a sample-adaptive fusion mechanism (where the model decides how much to trust the subspace signal for each specific image) could potentially yield even higher sensitivity.

Summary updated

Abstract

Post-hoc out-of-distribution (OOD) detection is mature on far-OOD yet remains weak on near-OOD. These two settings differ in their use of class-characteristic feature directions: far-OOD inputs largely fail to activate those of their predicted class, whereas near-OOD inputs activate them much as in-distribution samples do. Because the axis separating far-OOD leaves near-OOD almost indistinguishable from ID, a score optimized for one setting is misaligned with the other; where a detector already saturates far-OOD, added near-OOD sensitivity is bought partly against it. This divergence motivates a targeted near-OOD signal designed to complement existing scores. We propose PLUS (Per-class Low-dimensional sUbspace Signal). For each class, PLUS selects the $m$ most class-active neurons from a sparse autoencoder, orthonormalizes the corresponding decoder directions to form a low-dimensional subspace, and scores an input by its per-class whitened squared Mahalanobis distance $z$ within the subspace of its predicted class. Designed as a dedicated complement rather than a standalone detector, the signal $z$ is fused additively with any calibrated base score at a single, fixed weight. This weight is a single global constant: no value is adjusted per backbone, per OOD dataset, or per deployment, and all calibration statistics are estimated from ID validation data alone. When applied to 18 existing detectors spanning diverse method families, $z$ consistently improves near-OOD AUROC in all 126 detector--backbone combinations. Far-OOD performance is broadly maintained or improved, with only marginal declines where the base score is near-optimal, making $z$ a robust, detector-agnostic complement across backbones.
BibTeX
@misc{shin2026don,
  author = {Wonseok Shin and Songkuk Kim},
  title = {{Don't Replace, Complement: A Detector-Agnostic Subspace Signal for Near-OOD Detection}},
  year = {2026},
  eprint = {2611.06688},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.06688},
}
Figure