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

Unsupervised 3D Out-of-Distribution Detection with Latent Diffusion Models

Mark S. Graham, Walter Hugo Lopez Pinaya, Paul Wright, Petru-Daniel Tudosiu, Yee H. Mah, James T. Teo, Hans Rolf Jäger, David Werring, Parashkev Nachev, Sébastien Ourselin, M. Jorge Cardoso · DOI · OpenReview

Introduction

In clinical environments, the deployment of deep learning models is often hindered by their inherent brittleness. While these models perform exceptionally well on data that mirrors their training distribution, they frequently fail when encountering "Out-of-Distribution" (OOD) data. In medical imaging, OOD scenarios range from "far-OOD" cases—such as presenting a liver scan to a model trained exclusively on brain imaging—to "near-OOD" cases, which involve subtle anomalies like motion artifacts, improper intensity scaling, or anatomical variations. Detecting these anomalies in 3D volumes is a significant challenge due to the high dimensionality and memory requirements of medical data.

The Limitations of Current Approaches

Previous state-of-the-art methods for 3D OOD detection typically relied on Latent Transformer Models (LTMs). These models compress 3D volumes into discrete codes and use Transformers to predict sequences. However, LTMs suffer from three primary drawbacks:

  1. Likelihood Bias: They often assign high likelihood scores to complex but normal images, leading to false negatives in anomaly detection.
  2. Memory Constraints: The quadratic scaling of Transformers with respect to sequence length limits their ability to process high-resolution 3D data.
  3. Low Resolution: They often produce "blocky" anomaly maps that lack the spatial precision required for clinical interpretation.

Methodology: Latent Diffusion Models (LDMs)

To address these limitations, this research introduces a two-stage unsupervised framework utilizing Latent Diffusion Models (LDMs). The approach consists of the following components:

1. Compression via 3D VQ-GAN

A 3D Vector Quantized Generative Adversarial Network (VQ-GAN) is employed to compress high-resolution 3D volumes into a lower-dimensional latent space. This step reduces the computational burden while preserving the essential structural features of the medical images.

2. Latent Denoising Diffusion

Instead of a Transformer, a Denoising Diffusion Probabilistic Model (DDPM) is trained on the latent representations. The model learns the underlying distribution of "In-Distribution" (ID) data by iteratively adding noise and learning to reverse the process.

3. OOD Detection Logic

Detection is performed by adding noise to a new image's latent representation and attempting to reconstruct it. If the image is ID, the model’s learned prior allows for near-perfect reconstruction. If the image is OOD, the model lacks the necessary prior knowledge to accurately denoise the latent, resulting in a high reconstruction error. The original and reconstructed images are compared using Mean Squared Error (MSE) and perceptual similarity to generate an OOD score.

Experimental Setup

The model was trained and validated using the CROMIS dataset, consisting of 683 head CT scans. To test its detection capabilities, the researchers utilized:

  • Near-OOD: The KCH dataset (47 head CTs) with synthetic corruptions such as Gaussian noise, axis flipping, and "skull-stripping."
  • Far-OOD: The Medical Segmentation Decathlon dataset, which includes diverse body parts (Liver, Lung, Pancreas, Colon) and different modalities (MR vs. CT).

Key Results and Insights

Superior Detection Performance

The LDM framework consistently outperformed LTMs across nearly all benchmarks. In Far-OOD tasks, such as identifying Heart MR scans when trained on Head CTs, the LDM achieved a near-perfect AUC of 100. In Near-OOD tasks, the LDM demonstrated significantly higher sensitivity; for instance, when detecting scans with missing anatomical sections, the LDM achieved an AUC of 94.6, whereas the LTM managed only 28.6 at the same compression level.

Memory and Computational Efficiency

The UNet-based architecture of the LDM scales more gracefully than Transformers. At a 3-level compression, the LDM required only 1.8 GB of VRAM for inference, compared to 3.4 GB for the LTM. This efficiency allows the LDM to operate on higher-resolution latents where Transformers typically encounter memory-related failures.

Spatial Precision

By decoding the latent representation back into the original image space for comparison, the LDM generates high-resolution spatial anomaly maps. This provides clinicians with voxel-level precision, pinpointing the exact location of artifacts or anomalies within the 3D volume.

Conclusion and Future Directions

This research demonstrates that Latent Diffusion Models offer a more robust, efficient, and precise solution for unsupervised OOD detection in 3D medical imaging than traditional Transformer-based methods. While the model showed a slight performance dip at extremely high resolutions—likely due to shifting Signal-to-Noise Ratios (SNR)—future work will focus on developing adaptive noise schedules to maintain performance across all scales. The team also intends to validate the model on larger, whole-body CT datasets to further prove its clinical utility.

Summary updated

BibTeX
@inproceedings{graham2023unsupervised,
  author = {Mark S. Graham and Walter Hugo Lopez Pinaya and Paul Wright and Petru-Daniel Tudosiu and Yee H. Mah and James T. Teo and Hans Rolf Jäger and David Werring and Parashkev Nachev and Sébastien Ourselin and M. Jorge Cardoso},
  title = {{Unsupervised 3D Out-of-Distribution Detection with Latent Diffusion Models}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2023},
  doi = {10.1007/978-3-031-43907-0\_43},
}
Figure