Out-of-Distribution Detection and Data Drift Monitoring using Statistical Process Control

Ghada Zamzmi, Kesavan Venkatesh, Brandon Nelson, Smriti Prathapan, Paul H. Yi, Berkman Sahiner, Jana G. DelfinoarXiv 2024

TL;DR

This paper introduces a framework that combines deep learning feature extraction with Statistical Process Control (SPC) to detect out-of-distribution (OOD) data and monitor data drift in medical imaging. By applying classical industrial quality control techniques to modern AI, the authors provide a robust, modality-agnostic way to ensure clinical machine learning models remain safe and effective after deployment.

What Problem Does This Paper Address?

Machine learning (ML) models are notoriously brittle when faced with data that differs from their training set—a phenomenon known as being "out-of-distribution." In healthcare, this is a critical safety issue. A model trained on adult chest X-rays might produce erroneous results if fed a pediatric scan or an image from a new type of scanner it hasn't seen before.

This "data drift" often happens silently; the model provides a prediction, but that prediction is no longer reliable. While many OOD detection methods exist for the pre-deployment phase, there is a lack of practical, temporal monitoring solutions that can flag when a deployed system's input stream has fundamentally shifted.

Methods

The authors propose a three-step pipeline for monitoring (illustrated in Figure 1):

  1. Feature Representation: They use deep learning to extract high-level features from images. They compared three approaches: unsupervised autoencoders, supervised CNNs (using Binary Cross-Entropy), and supervised contrastive learning.
  2. OOD Metrics: To quantify how "far" a new image is from the training distribution, they calculated geometric distances in the feature space, specifically Mahalanobis Distance and Cosine Similarity.
  3. SPC Monitoring: These distance metrics are then fed into Statistical Process Control charts.
  4. $3\sigma$ Control Charts: Used to flag individual images that are extreme outliers.
  5. Cumulative Sum (CUSUM) Charts: Used to detect small, persistent shifts in the data stream over time by accumulating deviations from the mean.
Figure 1: Overview of the proposed SPC-based framework for drift monitoring. Dashed box indicates that this work focuses on monitoring inputs; however, the same framework can be applied to oversee the model’s outputs.

The framework is designed to be "model-agnostic," meaning it can be wrapped around existing AI systems without requiring internal changes to the primary classifier.

Datasets

The study evaluated the framework across several diverse medical imaging datasets:

  • OrganMNIST: Used for a Computed Tomography (CT) task, specifically distinguishing axial slices (in-distribution) from coronal or sagittal slices (OOD).
  • NIH CXR Dataset: Used as the in-distribution baseline for adult Chest X-rays (CXR).
  • Pediatric Pneumonia Chest X-ray Dataset: Used to simulate demographic drift (adult vs. pediatric).
  • PadChest: A large-scale Spanish CXR dataset used to test the framework's performance across different institutions.
  • Multi-modal OOD set: Included MRI, ultrasound, and bone X-rays to test "out-of-modality" detection.

Key Insights and Ideas

  • The Power of Contrastive Learning: For CT tasks, features derived from supervised contrastive learning significantly outperformed standard autoencoders. Contrastive learning forces the model to learn representations that clearly separate different classes, making OOD samples much easier to spot in the feature space.
  • $3\sigma$ vs. CUSUM: The authors found a clear functional split between these two SPC tools. While the $3\sigma$ rule is excellent for catching a single "wrong" image (like a knee X-ray sent to a chest model), CUSUM is far superior at detecting subtle "drifts," such as a slight increase in the percentage of pediatric cases over a month.
  • Simplicity Wins: Interestingly, for Chest X-rays, simple Cosine Similarity often yielded better mean performance than the more complex Mahalanobis distance.
  • Visual Intuition: One of the primary benefits of using SPC is that it provides a visual dashboard for clinicians. Instead of a black-box "OOD score," they see a control chart where a line crossing a threshold provides an immediate, statistically grounded alert.

Key Results

The framework demonstrated high sensitivity and accuracy across all tested scenarios:

  • CT Task: Achieved an OOD detection accuracy of 0.913 and a sensitivity of 0.980 using contrastive features.
  • CXR Task: Achieved a near-perfect accuracy of 0.995 and sensitivity of 0.984 for detecting non-CXR modalities.
  • Drift Detection: In a simulation of 100 daily cases, the CUSUM chart detected a shift in OOD input percentage (from <1% to 3-5%) within just two days.
  • Demographic Drift: The system successfully flagged pediatric X-rays as OOD relative to an adult-trained model with an accuracy of 0.892.
SPC-based detection of OOD non-axial CT slices and monitoring for data-drift.

Limitations and Future Work

The authors acknowledge that the $k$ parameter in CUSUM (the allowance for variation) requires careful calibration; setting it too low leads to false alarms, while setting it too high causes detection delays.

Furthermore, the pediatric drift task was challenging because older children's X-rays look very similar to adults', leading to some false negatives. Future work aims to stratify demographic monitoring (e.g., by specific age groups) and explore more complex SPC rules, such as flagging when multiple consecutive points fall near the control limits even if they don't cross them.

Summary updated

BibTeX
@misc{zamzmi2024out,
  author = {Ghada Zamzmi and Kesavan Venkatesh and Brandon Nelson and Smriti Prathapan and Paul H. Yi and Berkman Sahiner and Jana G. Delfino},
  title = {{Out-of-Distribution Detection and Data Drift Monitoring using Statistical Process Control}},
  year = {2024},
  eprint = {2402.08088},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.08088},
}
Figure