NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Multiple Hypothesis Testing for Out of Distribution Detection

27 concepts22 papers2 proposals

When deploying machine learning models in safety-critical domains like autonomous driving, medical diagnosis, or financial auditing, knowing when to trust a model is paramount. If a model encounters an input that looks completely different from its training data—an out-of-distribution (OOD) or anomalous sample—it should ideally flag it rather than making a confident, incorrect prediction.

To solve this, a massive body of literature focuses on creating "scoring functions" that output a higher value for anomalous inputs than for normal ones. You might compute reconstruction errors from an autoencoder, look at the softmax confidence of a classifier, or measure distances in a latent embedding space.

However, a scoring function is only half the battle. The real challenge is the decision rule: where do you draw the line?

If you set the threshold too high, you miss dangerous anomalies. If you set it too low, you trigger a flood of false alarms, leading to alarm fatigue where human operators begin to ignore the system entirely. As noted by Harit Vishwakarma et al. and Shuai Zhang et al., standard heuristic scores do not inherently translate into a predictable error probability, making them highly unreliable for real-world production environments.

To bridge this gap, a powerful research direction has emerged: framing out-of-distribution and anomaly detection as a formal statistical hypothesis testing problem. By moving from heuristic thresholds to collective decision rules, this framework allows practitioners to mathematically guarantee a strict upper bound on false alarms.


The Core Mechanism: From Heuristic Scores to P-Values

To understand why this framework works, we must first look at how it transforms arbitrary model outputs into statistically rigorous metrics.

In classical hypothesis testing, you evaluate a null hypothesis ($H_0$). In the context of OOD detection, the null hypothesis states that an incoming test sample is in-distribution (orderly, normal data). The alternative hypothesis ($H_1$) is that the sample is an anomaly.

Instead of thresholding a raw score directly, this framework uses a calibration set—a holdout set of known in-distribution data—to convert any arbitrary scoring function into an empirical p-value.

$$\text{p-value}(x) = \frac{1}{|D_{\text{cal}}| + 1} \sum_{x_c \in D_{\text{cal}}} \mathbb{I}(S(x_c) \ge S(x))$$

Where $S(x)$ is the anomaly score of the new sample, and $D_{\text{cal}}$ is the calibration set.

The Intuition of Uniformity

Why do we do this? The fundamental property of a valid p-value is that under the null hypothesis, its distribution is uniform between 0 and 1.

If a new sample is genuinely in-distribution, its score should look like a random draw from the calibration set, meaning its p-value is equally likely to be any number between 0 and 1. However, if the sample is an anomaly, its score will be exceptionally high, pushing its p-value very close to 0.

As demonstrated by Matan Haroush et al. and Alec Farid et al., this transformation changes the game. We are no longer guessing what a score of 4.2 means. A p-value of 0.01 means exactly one thing: there is only a 1% chance that an in-distribution sample would produce a score this extreme. This allows for a calibrated rejection mechanism based on principles like the Neyman-Pearson lemma, as leveraged by the authors of Calibrated Out-of-Distribution Detection with a Generic Representation.


The Problem with Per-Sample Thresholds

If we have p-values, why not just flag any sample where $p \le 0.05$?

If you evaluate samples completely independently, your error rates compound. If you process a batch of 1,000 perfectly normal, in-distribution samples with a threshold of $\alpha = 0.05$, you expect to falsely flag roughly 50 of them as anomalies. In a continuous stream of data—such as network traffic, social media edges, or autonomous driving frames—this independent thresholding causes the absolute number of false positives to explode (Sooyong Jang et al.).

To fix this, Xinsong Ma et al. (2024) argue that we must treat OOD detection as a multiple hypothesis testing problem. Instead of making isolated decisions, the system evaluates a collection or a stream of inputs together, controlling the False Discovery Rate (FDR).

$$\text{FDR} = \mathbb{E}\left[ \frac{\text{False Positives}}{\text{Total Declared Anomalies}} \right]$$

Controlling the FDR means guaranteeing that out of all the alarms your system sounds, no more than a user-defined fraction (e.g., $q = 5\%$) are false alarms. This directly optimizes the precision of your detector, which is the exact metric needed to prevent alarm fatigue in high-stakes environments (Xinsong Ma et al., 2025).


How it Works: The Benjamini-Hochberg Procedure

The most prominent way to achieve this collective control is by adapting the classical Benjamini-Hochberg (BH) procedure to machine learning workflows, as explored by Tsai Hor Chan et al. and Xinsong Ma et al. (2024).

Imagine you receive a batch of $m$ test samples. Instead of judging them one by one, the procedure follows three steps:

  1. Calculate and Sort: Compute the empirical p-value for each sample using your calibration set, and sort them from smallest to largest: $P_{(1)} \le P_{(2)} \le \dots \le P_{(m)}$.
  2. Find the Adaptive Threshold: Find the largest index $k$ such that: $$P_{(k)} \le \frac{k}{m} q$$
  3. Reject Collectively: Reject the null hypothesis (declare as OOD) for all samples up to index $k$. If no such index exists, declare nothing as an anomaly.

Why the Adaptive Threshold Works

The magic of the BH procedure lies in the term $\frac{k}{m} q$.

If you have a batch where no true anomalies are present, the p-values will be uniformly distributed. The condition $P_{(k)} \le \frac{k}{m} q$ becomes incredibly difficult to satisfy, meaning the procedure will likely reject nothing, preserving a low false positive rate.

Conversely, if your batch contains a massive spike of true anomalies (e.g., a sudden cyberattack or sensor failure), you will have a large cluster of very small p-values near zero. This increases the index $k$, adaptively raising the acceptable p-value threshold for the entire batch.

By looking at the distribution of the p-values across the batch, the decision rule dynamically adjusts its strictness based on how much anomalous activity is currently occurring. This collective decision rule provides a provable guarantee that the expected FDR will remain below $q$, regardless of the true proportion of anomalies in the data (Xinsong Ma et al., 2024).


Broad Applications and Modern Extensions

Because this framework decouples the scoring function from the decision rule, it can be applied to virtually any data modality or model architecture.

1. Conformal Prediction and Distribution-Free Guarantees

A closely related branch of this framework utilizes Conformal Prediction to achieve finite-sample, distribution-free guarantees on error rates. For instance, Ayush Gupta shows that by measuring how many internal neurons can be dropped before an answer changes (Polysemantic Dropout), one can use conformal frameworks to flag out-of-domain queries in specialized LLMs without rejecting valid in-domain requests. Similarly, Ramneet Kaur et al. apply conformal OOD detection to transformation equivariance in image and audio models, while Rui Luo et al. combine edge exchangeability with conformal prediction to bound false positives in dynamic social networks.

2. Streaming and Online Detection

In many real-world applications, data does not arrive in neat batches; it arrives as a continuous stream. To handle this, Xinsong Ma et al. (2025) extended the batch framework into online multiple hypothesis testing by introducing algorithms like g-LOND. This approach dynamically updates error-control thresholds over time, guaranteeing FDR bounds even when sequential test samples are statistically dependent on one another. This is highly analogous to streaming graph anomaly tools like MIDAS (Bryan Hooi et al.) and continuous-time event sequence models (Siqi Liu et al.), which rely on rigorous statistical bounds to prevent sequential false alarms.

3. Overcoming Finite-Data Limitations

While the theoretical guarantees of these testing frameworks are beautiful asymptotically, they can encounter friction in data-scarce environments. Xinsong Ma et al. (2025, "A Closer Look") demonstrated that the performance of generalized BH algorithms is highly sensitive to the size of the calibration set. When calibration data is limited, empirical p-values become coarse, causing high variance in the actual detection rate. To resolve this, the authors proposed eg-BH, an ensemble method that partitions calibration data to stabilize error control even when data is scarce.

Other refinements focus on optimizing the trade-offs inherent to these boundaries. For example, Xinsong Ma et al. (2025, "On the SAC-BL Algorithm") introduced stochastic randomization strategies to prevent the decision boundaries from becoming overly conservative, ensuring that minimizing false alarms does not inadvertently cause the system to miss actual anomalies.


Summary

The power of the multiple hypothesis testing framework for OOD detection lies in its mathematical sobriety. Rather than attempting the impossible task of perfectly modeling every weird anomaly the open world might present (Thibaud Ehret et al.), it focuses entirely on modeling the normal distribution. By converting heuristic scores to p-values and evaluating them collectively, it replaces arbitrary threshold guesswork with rigorous, user-defined mathematical guarantees.

Key Foundational Work

How to Reduce Anomaly Detection in Images to Anomaly Detection in Noise (2019) — contributed 1 concept elements to this direction.
A Multi-band Wavelet Watermarking Scheme (2008) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_false_positive_rate_control_6fecdd4d,
  title = {false positive rate control},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/false-positive-rate-control/rdr_6fecdd4d13ef4c31aa15653db1ee6d9c},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-28},
}

This exact version (version 1, frozen text):

@misc{lacuna_false_positive_rate_control_6fecdd4d_v1,
  title = {false positive rate control},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/false-positive-rate-control/rdr_6fecdd4d13ef4c31aa15653db1ee6d9c/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-28},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake