A common way to flag inputs a classifier was never trained on is to attach a small autoencoder to its internal features. An autoencoder is a network that squeezes its input through a narrow middle layer, the bottleneck, and then tries to rebuild it. If it rebuilds familiar inputs well and unfamiliar ones badly, the rebuilding error becomes an out-of-distribution (OOD) detector. Whether this works depends almost entirely on hand-made design choices: how narrow the bottleneck is, which classifier layer gets rebuilt, how deep the decoder is, and how the error is normalized. Bad choices produce an autoencoder that rebuilds outliers just as well as normal data. Designers usually tune these choices against the very OOD test sets they report on, which quietly leaks the test into the design.
This note proposes a selection rule that uses only in-distribution data. We hold out some training classes, which places part of the data where the model has no training support. That is exactly the situation epistemic uncertainty describes: the model is ignorant because it has seen no examples, not because the data is noisy. We then score each candidate autoencoder by how well its rebuilding error separates the held-out classes from the retained ones. The claim is that this held-out-class gap ranks candidate designs in roughly the same order as their true OOD performance. If so, a cheap search over designs, run on cached classifier features, can replace manual tuning without ever touching OOD data. The proposal stands or falls on that ranking agreement, and we test it directly.
Core Claim
Two things would be new. The first is an ID-only search objective for autoencoder OOD detectors, built from held-out-class folds. This objective is the empirical counterpart of epistemic sensitivity: error on classes the model never saw. The second is evidence about whether this objective, rather than the search algorithm, carries the benefit. We expect the obvious alternative objective, rebuilding fidelity, to rank designs in the wrong direction. Our prediction is that the held-out-class gap reaches a Spearman rank correlation of at least 0.6 with true near-OOD AUROC across a few hundred random designs. If it falls below 0.3, the claim fails.
Relation to Prior Work
Two lines of work motivate the gap by showing how fragile hand-made bottlenecks are. Rethinking Reconstruction Autoencoder-Based Out-of-Distribution Detection rebuilds a frozen classifier's penultimate features through a single linear-plus-softmax bottleneck with layerwise decoders, and it scores errors after projecting features onto the unit sphere. That projection fixes a "norm bias": OOD features tend to be smaller, so raw distances make outliers look well rebuilt. Every component of that detector is hand-designed. We reuse its feature-rebuilding setup as our search space and as our strongest baseline. Improving Reconstruction Autoencoder Out-of-distribution Detection with Mahalanobis Distance adds a latent Mahalanobis term to the rebuilding error. Its own numbers show the brittleness of a fixed design. With a 16-dimensional bottleneck on one-class MNIST, FPR at 95% TPR is 1.4% for digit 0 but 62.5% for digit 8 under the hybrid score. A fixed design is therefore far from right for every task. We include its hybrid score as a searchable option.
Automated design of autoencoders exists but optimizes the wrong target for detection. Exploiting the Potential of Standard Convolutional Autoencoders for Image Restoration by Evolutionary Search uses a (1+λ) evolutionary strategy to find symmetric autoencoders that beat much larger restoration models on PSNR. We borrow the search procedure. We drop the objective, because a better rebuilder of everything is a worse detector. The Rethinking paper's finding that extra capacity hurts detection makes the same point, and it constrains our design.
Uncertainty-aware architecture search is the closest prior work. μDARTS searches classifier cells while penalizing variance across dropout samples. It evaluates only calibration and Gaussian noise, never semantic OOD detection. Its push toward agreement may also work against detection: Trust Me, I Know the Way shows that ensemble disagreement vanishes on OOD inputs when members collapse onto shared shortcuts. NADS searches a distribution over Glow flow architectures using WAIC. It is limited to invertible models and needs an architecture ensemble at test time. Our proposal searches single, non-invertible feature autoencoders that score in one pass, using a held-out-class objective instead of a likelihood or variance criterion. FNAS uses uncertainty only to speed up search, and its resulting architectures do not themselves estimate uncertainty.
Research Program
We first train a classifier on each of $K=3$ folds of the training classes. Each fold holds out a random 20% of CIFAR-100 classes, with a ResNet-18 backbone. We then cache intermediate and penultimate features for all ID training images, ID validation images and held-out-class images. Because candidate autoencoders train on cached feature vectors rather than images, each candidate takes minutes. This removes the rollout cost that dominates architecture search.
The search space keeps the ingredients the prior papers found important and makes them variable. It includes which classifier layers are rebuilt and the bottleneck type: linear, softmax as in the Rethinking paper, or sparse. It also covers bottleneck width from 4 to 256, encoder and decoder depth set independently so that asymmetric shapes are allowed, decoder width, and whether errors are taken on the unit sphere. The final option is whether the score adds a latent Mahalanobis term with a learned weight. For candidate design $a$, let $s_a(x)$ be its OOD score. Let $R_k$ be the retained-class validation images and $H_k$ the held-out-class images in fold $k$. The search objective is
$$J(a) = \frac{1}{K}\sum_{k=1}^{K} \mathrm{AUROC}\big(s_a;\ R_k \text{ vs. } H_k\big),$$
which is the average ability to separate classes the model had no data for from classes it did. The search runs evolutionary updates in the style of E-CAE for a fixed budget of 1,000 candidate evaluations. After selection, we retrain the classifier on all 100 classes, train the chosen autoencoder once, and evaluate. The classifier is retrained per fold because a classifier trained on all classes would already encode the held-out classes, making them look in-distribution and corrupting the proxy.
Baselines
The naive reference point is the frozen classifier with maximum softmax probability, with no autoencoder at all. Any proposal that cannot beat it on near-OOD is pointless.
The strongest direct competitor is the hand-designed Layerwise Semantic Reconstruction detector from Rethinking Reconstruction Autoencoder-Based Out-of-Distribution Detection. Its authors report FPR@95%TPR of 0.2% for CIFAR-100 versus TinyImageNet-crop with a Wide-ResNet. That pair is saturated, so beating this detector must happen on near-OOD splits. We run it on the same classifier and features with its published configuration. It also gets the same 1,000-evaluation budget for tuning its few free settings, but on our ID-only proxy, so neither method sees OOD data.
The strongest post-hoc competitor is nearest-neighbor scoring on normalized features, plus the trained hyperspherical method from How to Exploit Hyperspherical Embeddings for Out-of-Distribution Detection?. That paper reports average FPR95 of 46.89% on CIFAR-100, against 60.22% for KNN+. We run it with its released code, deeplearning-wisc/cider, on the same backbone. For CIFAR-10 near-OOD we also report against PixMix, which OpenOOD lists at 93.1% AUROC.
Four ablations isolate the key ingredient. The first, a fidelity-objective search, uses the same search but maximizes ID rebuilding quality. The second, random search, uses the same proxy and budget. The third, width-only grid search, sweeps bottleneck width with the proxy and keeps everything else at Rethinking defaults. The fourth is an oracle search that tunes directly on a real OOD validation set and serves as an upper bound. Beating the hand-designed detector means a statistically reliable gain, across three seeds, in near-OOD AUROC and FPR95 on the OpenOOD CIFAR-100 near-OOD split, without losing ground on far-OOD.
Why not just…?
Why not just use post-hoc nearest-neighbor or Mahalanobis scores on classifier features? OpenOOD finds that post-hoc methods are hard to beat, so this is a serious alternative. The Rethinking paper's norm-bias analysis suggests raw feature distances are systematically fooled. Our search space already includes the latent Mahalanobis option, so if a plain post-hoc score wins, the search should select an effectively trivial autoencoder. We will report that outcome as such rather than hide it.
Why not just sweep the bottleneck width? This is the main threat. The Mahalanobis paper's per-digit swings suggest width matters most. If width-only grid search with our proxy matches the full search, we will conclude that the held-out-class proxy, not the search, carries the value, and we will report the simpler recipe. The width-only ablation is designed to settle this.
Why not just ensemble autoencoders or use dropout sampling for epistemic uncertainty? Multi-pass methods multiply inference cost. Improving Out-of-Distribution Detection via Epistemic Uncertainty Adversarial Training reports that ordinary ensembles reach only 0.53 AUC below 1% FPR on MNIST with Gaussian noise. We will include a five-member ensemble of the hand-designed autoencoder at matched training compute and report its latency alongside its accuracy.
Proposed Experiments
The decisive check comes before any headline result. We sample 300 random designs from the search space and compute three quantities for each: the held-out-class proxy $J(a)$, ID rebuilding error, and true AUROC on OpenOOD CIFAR-100 near-OOD and far-OOD sets. We then report Spearman correlations. The prediction is above 0.6 for the proxy on near-OOD. We expect the fidelity criterion to be near zero or negative, which would confirm the tension between fidelity and detection.
Held-out classes are themselves near-OOD, so we expect weaker transfer to far-OOD and to covariate shift. We report these separately rather than average them. We also evaluate on the harder generated near-OOD protocol from Raising the Bar on the Evaluation of Out-of-Distribution Detection, which shows standard detectors dropping from about 91% to about 84% AUROC. That protocol is where hand-made designs should be most exposed.
A small-scale test reuses the one-class MNIST setting of the Mahalanobis paper. There we run the search separately for each digit, holding out pixel-level variations of other digits as the proxy. We ask whether searched per-digit designs close the gap between digit 0 and digit 8, whose hybrid-score FPR95 values are 1.4% and 62.5%. Finally, we report search cost in GPU hours, including the three fold classifiers, against the 9.6 GPU hours μDARTS reports for its CIFAR-10 search.
References
- Rethinking Reconstruction Autoencoder-Based Out-of-Distribution Detection
- Improving Reconstruction Autoencoder Out-of-distribution Detection with Mahalanobis Distance
- Exploiting the Potential of Standard Convolutional Autoencoders for Image Restoration by Evolutionary Search
- $μ$DARTS: Model Uncertainty-Aware Differentiable Architecture Search
- Trust Me, I Know the Way: Predictive Uncertainty in the Presence of Shortcut Learning
- NADS: Neural Architecture Distribution Search for Uncertainty Awareness
- FNAS: Uncertainty-Aware Fast Neural Architecture Search
- How to Exploit Hyperspherical Embeddings for Out-of-Distribution Detection?
- OpenOOD: Benchmarking Generalized Out-of-Distribution Detection
- Improving Out-of-Distribution Detection via Epistemic Uncertainty Adversarial Training
- Raising the Bar on the Evaluation of Out-of-Distribution Detection