Bayesian generative models can flag performance loss, bias, and out-of-distribution image content

Miguel López-Pérez, Marco Miani, Valery Naranjo, Søren Hauberg, Aasa FeragenarXiv 2025 · DOI

Introduction

Variational Autoencoders (VAEs) are fundamental tools in medical imaging, utilized for tasks ranging from anomaly detection to data visualization. However, these models suffer from a critical "silent failure" mode: when encountering data outside their training distribution—such as rare diseases or underrepresented skin tones—they often produce unreliable outputs without any internal warning. This is particularly problematic in dermatology, where AI models frequently underperform on darker skin tones. To address this, researchers have developed SLUG (Sketched Lanczos Uncertainty Global), a scalable uncertainty quantification (UQ) method that provides a reliable "warning light" for clinical AI.

The Failure of Standard Metrics

While VAEs possess an internal measure of uncertainty—the encoder's variance—previous research has demonstrated that this metric is a poor indicator of actual model performance or bias. In biased training scenarios, the internal variance often fails to correlate with reconstruction error, essentially acting as a "broken compass."

Standard VAE encoder variance (right) fails to track reconstruction error (left) across different skin tones, particularly in biased training scenarios.

Methodology: The SLUG Approach

SLUG builds upon the Sketched Lanczos Uncertainty (SLU) algorithm to provide a mathematically grounded UQ measure. The method utilizes a Laplace approximation, treating the neural network's posterior distribution as a Gaussian centered at the trained weights. This requires the Generalized Gauss-Newton (GGN) matrix, which captures the sensitivity of model outputs to parameter changes.

To handle the high-dimensional nature of medical images, SLUG employs two key computational strategies:

  1. Sketching (Lanczos): A rank-$k$ approximation captures the most significant components of the gargantuan GGN matrix.
  2. Stochastic Trace Estimators: A randomized mathematical shortcut estimates the sum of variances across the entire image, moving from slow pixel-wise computation to a global uncertainty score per image.

Experimental Results and Insights

The study evaluated SLUG using the Fitzpatrick17k dataset (labeled by skin type), the PASSION dataset (Sub-Saharan African images), and the ISIC dataset (for out-of-distribution artifacts).

Performance and Bias Tracking

Unlike standard VAE variance, SLUG scores clearly track with performance drops across different skin tone groups. The researchers found a strong correlation (up to 0.92) between the SLUG score and the Mean Squared Error (MSE). This allows SLUG to predict when a model's output is likely to be erroneous before human review.

SLUG uncertainty scores (right) show a strong correlation with Mean Squared Error (left), providing a reliable indicator of model performance loss across skin tones (FST 3-6).

Detecting "Shortcut" Artifacts

In clinical settings, models often rely on "shortcuts," such as rulers or surgical ink placed near lesions. SLUG successfully produces uncertainty maps that highlight these artifacts as high-uncertainty regions. This is a vital safety feature, as VAEs may reconstruct these artifacts perfectly (resulting in low MSE) while the model is actually focusing on non-diagnostic information.

Conclusion and Future Work

SLUG represents a significant step toward safer medical AI by providing a scalable way to flag bias and performance loss. While the method is significantly faster than previous Bayesian approaches, computational scaling remains a challenge for very high-resolution 3D volumes like MRI or CT scans. Future research will focus on optimizing these stochastic estimators to ensure these safety flags can be deployed across all domains of medical imaging.

Summary updated

BibTeX
@misc{lopezperez2025bayesian,
  author = {Miguel López-Pérez and Marco Miani and Valery Naranjo and Søren Hauberg and Aasa Feragen},
  title = {{Bayesian generative models can flag performance loss, bias, and out-of-distribution image content}},
  year = {2025},
  eprint = {2503.17477},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.17477},
}
Figure