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:
- 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).
- 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:
- Sparse Autoencoder (SAE) Training: They train a TopK-SAE on the features of the pre-trained classifier using only in-distribution training data.
- 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.
- 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.
- 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$).
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.
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.
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