Iterative Deployment Exposure for Unsupervised Out-of-Distribution Detection

Lars Doorenbos, Raphael Sznitman, Pablo Márquez-NeilaarXiv 2024

TL;DR

Machine learning models deployed in the real world encounter specific out-of-distribution (OOD) data over time, yet standard OOD detection assumes these anomalies are static and generic. This paper introduces Iterative Deployment Exposure (IDE), a realistic framework where a model continuously adapts to scarce, unlabeled OOD samples during deployment. To solve this, the authors propose CSO, a method that combines a novel Mahalanobis-based nearest-neighbor scoring function with a confidence-scaled few-shot learner that gracefully transitions into a robust binary classifier as more data accumulates.

What Problem Does This Paper Address?

When deep learning models transition from the lab to real-world deployment—especially in high-stakes fields like medical imaging—they inevitably face out-of-distribution (OOD) data. Traditional Unsupervised OOD (U-OOD) detection assumes that OOD samples are scattered uniformly across an abstract data space or relies on synthetic anomalies generated before deployment.

In reality, a deployed model passively accumulates specific, concentrated types of OOD data over time (e.g., a chest X-ray model encountering a specific new pathology or scanner artifact). While test-time adaptation methods exist, they typically require large batches of hundreds of OOD samples to update a model. In clinical settings, OOD samples are often scarce initially.

To bridge this gap, the authors introduce Iterative Deployment Exposure (IDE). In this setup, a model must detect OOD samples, update its own detector using the newly observed unlabeled data, and repeat this process iteratively over time.

Fig. 1. Iterative deployment exposure. The initial detector, trained on unlabeled ID data, is iteratively refined with unlabeled deployment samples.

Methods

The authors propose CSO (Confidence-Scaled U-OOD detector), which adapts dynamically to the volume of OOD data seen during deployment. CSO models the overall detector ($s_t$) as a convex combination of two distinct learners:

$$s_t(x) = (1 - \alpha_t)s^-_t(x) + \alpha_t s^+_t(x)$$

  1. The Few-Shot Learner ($s^-$): Active early in deployment when OOD data is scarce. It uses a high-bias, low-variance approach that builds on a novel base U-OOD scoring function called MkNN (Mahalanobis k-Nearest Neighbor). MkNN extracts layer-wise features from a pre-trained network and computes the average Mahalanobis distance to the 2-nearest neighbors in the training set. To incorporate discovered OOD samples, $s^-$ subtracts a twin OOD detector score, scaled by a bootstrap-derived confidence factor ($\lambda$) that measures the uncertainty of the data distributions.
  2. The Strong Learner ($s^+$): A standard, low-bias binary classifier (like a ResNet-18) that takes over as more data becomes available.
  3. The Mixing Factor ($\alpha_t$): Dynamically shifts the weight from the few-shot learner to the strong binary classifier as the number of pseudo-labeled OOD samples increases.

Datasets

The authors introduced three dedicated medical imaging benchmarks for the IDE setting, ensuring that evaluation data and deployment data do not overlap:

  • NIH: 4,261 healthy chest X-rays for training. The deployment phase introduces 250 healthy (ID) and 250 pathological (OOD) scans with a 20% contamination ratio ($\pi = 0.2$).
  • MURA: 5,106 musculoskeletal radiographs of fingers (ID). The deployment phase introduces scans of other joints (elbows, hands, wrists, etc.) as OOD samples ($\pi = 0.1$).
  • DRD: 25,809 healthy retinal fundus photographs (ID). Deployed models face scans showing severe diabetic retinopathy as OOD samples ($\pi = 0.1$).

Additionally, the standard CIFAR10 one-class benchmark was used for ablation studies on natural images.

Key Insights and Ideas

  • Real-world OOD data is concentrated: Treating OOD data as a generic, uniform complement to the training set is suboptimal. Deployed models encounter specific contexts that must be inferred from the deployment environment itself.
  • The Scarcity-to-Abundance Transition: You cannot reliably train a deep binary classifier on day one of deployment due to data scarcity. By blending a robust distance-based few-shot learner with a deep classifier, CSO maintains high performance early on and scales up as data accumulates.
  • Uncertainty via Bootstrapping: By measuring the variability of bootstrapped covariance matrices, the method dynamically scales how much it trusts its learned OOD distribution versus its initial in-distribution knowledge.

Key Results

CSO significantly outperformed seven strong baselines from related fields (including test-time adaptation and unsupervised OOD methods) across two new time-aware metrics: Area Under the FPR@95 curve (AUF) and Area Under the AUC curve (AUA).

Table 1. Comparative evaluation. We report the mean of the AUF (↓) and AUA (↑) over five trials. Bold and underlined indicate best and second best, respectively. Our method obtains the best performance overall.
  • Overall Performance: CSO achieved the best overall performance, outperforming the next-best method by 5.6 points in AUF and 2.2 points in AUA on average.
  • Fast Adaptation: As shown in the ablation curves, CSO improves the fastest, achieving top-tier results after just a single deployment iteration. It also consistently maintains its performance advantage across varying contamination ratios ($\pi$ ranging from 0.05 to 0.5).
Fig. 2. Ablation curves. In (a), we show how the FPR@95 evolves over time for the best methods on NIH. Our method achieves the best results, already after one iteration. In (b), we compare methods by AUF under varying contamination ratios on NIH. Our method consistently outperforms the baselines at different contamination levels.

Limitations and Future Work

The paper does not extensively discuss failure modes or computational overhead, but a few limitations are apparent:

  • Threshold Dependency: The pseudo-labeling mechanism relies on a fixed threshold set at the 95th percentile of the training data distribution. If the initial training data is highly noisy, this thresholding strategy might introduce false positives into the deployment pipeline.
  • Backbone Reliance: The performance of the MkNN scoring function is tied to the quality of the frozen, pre-trained feature extractor.

Future work could explore how to dynamically adjust the pseudo-labeling threshold during deployment or extend the framework to multi-class downstream tasks.

Summary updated

BibTeX
@misc{doorenbos2024iterative,
  author = {Lars Doorenbos and Raphael Sznitman and Pablo Márquez-Neila},
  title = {{Iterative Deployment Exposure for Unsupervised Out-of-Distribution Detection}},
  year = {2024},
  eprint = {2406.02327},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.02327},
}
Figure