Using generative AI to investigate medical imagery models and datasets

Oran Lang, Doron Yaya-Stupp, Ilana Traynis, Heather Cole-Lewis, Chloe R. Bennett, Courtney Lyles, Charles Lau, Michal Irani, Christopher Semturs, Dale R. Webster, Greg S. Corrado, Avinatan Hassidim, Yossi Matias, Yun Liu, Naama Hammel, Boris Babenko · DOI

TL;DR

Researchers have developed a workflow called StylEx that uses generative AI (StyleGAN2) to visualize exactly what medical imaging models are "seeing." By creating counterfactual images—showing how a patient's scan would change to make a model more or less certain of a diagnosis—they’ve created a powerful tool for discovering new biological signals and, crucially, unmasking hidden biases like makeup or X-ray exposure levels.

What Problem Does This Paper Address?

Deep learning models are increasingly outperforming doctors in medical imaging tasks, from detecting cataracts to predicting systemic health markers like blood pressure from a simple eye photo. However, these models are notoriously "black boxes."

Existing explainability tools, like saliency maps, usually only show where a model is looking (the "where"). They don't explain what specific visual features—like texture, vessel width, or shape—are driving the prediction. Without knowing the "what" and the "why," doctors struggle to trust these models, and researchers can't tell if a model has discovered a new medical breakthrough or is simply cheating by picking up on "confounders" (spurious correlations like the type of camera used or patient demographics).

Methods

The authors propose a four-stage workflow centered around a generative model called StylEx:

  1. Train a Classifier: First, they train a standard deep learning model to perform a specific medical task (e.g., "Does this chest X-ray show an abnormality?").
  2. Train StylEx: They then train a StyleGAN2-based image generator. Unlike a standard GAN that creates images from random noise, StylEx is "guided" by the classifier. It uses an encoder to reconstruct real patient images and a special loss function that ensures the generated images retain the features the classifier cares about.
  3. Automatic Attribute Selection: The system searches the model’s "style space" to find the top visual attributes that most significantly shift the classifier’s prediction. It then generates "counterfactual" visualizations—essentially "what-if" animations showing an attribute increasing or decreasing.
  4. Interdisciplinary Expert Review: This is the most novel part of the workflow. Instead of just letting engineers look at the results, they convene a panel of clinicians, social scientists, and socio-technical experts to interpret the visual changes. This helps distinguish between true biological signals, known medical features, and socio-cultural biases.

Datasets

The study tested the workflow across three imaging modalities and eight different tasks using several large-scale datasets:

  • External Eye Photographs: Used the EyePACS/LACDHS dataset (49k patients) to predict cataracts, low hemoglobin (anemia), and glycemic control (HbA1c).
  • Retinal Fundus Photographs: Used the UK Biobank dataset (62k patients) to predict smoking status, systolic blood pressure, and self-reported sex.
  • Chest Radiographs (CXR): Used the Apollo, CXR-14, and MIMIC-III datasets (totaling over 270k patients) to predict general abnormalities and race.

Key Insights and Ideas

  • The "Eyeliner" Confounder: In one striking example, the model was highly accurate at predicting low hemoglobin from eye photos. StylEx revealed the model was looking at eyeliner thickness. Because low hemoglobin is more common in women of reproductive age in that dataset, and those women were more likely to wear eyeliner, the model learned a cultural proxy rather than a biological one.
  • Rediscovering Known Medicine: As a "positive control," the model correctly identified that an enlarged heart (cardiomegaly) is a key sign of an abnormal chest X-ray, and that retinal vein dilation is correlated with smoking. This builds trust that the generative approach is capturing real clinical signals.
  • Novel Biological Discoveries: The model found that greater visibility of choroidal vasculature in the eye was associated with male sex—a finding that actually runs counter to some previous literature, suggesting new avenues for physiological research.
  • Technical Bias: For chest X-rays, the model associated "abnormality" with darker, over-exposed images. The expert panel hypothesized this was because sicker, in-patient residents often receive portable X-rays, which are harder to expose correctly than standard machines.

Key Results

The classifiers used in the study all achieved high performance, typically with an Area Under the Curve (AUC) above 0.80. For example:

  • Sex prediction from fundus photos: 93.9% AUC.
  • Abnormality detection in CXR: 96.9% AUC.
  • Race prediction from CXR: 96.1% AUC.

The qualitative success was measured by the expert panel's ability to categorize the StylEx-generated attributes into "Known Clinical Features," "Likely Confounders/Bias," or "Novel Features Needing Investigation."

Limitations and Future Work

The authors are careful to note that their method identifies correlations, not causes. Just because a visual change shifts a model's prediction doesn't mean that feature causes the condition.

Additionally, training StyleGAN2 models is computationally expensive and requires highly standardized imagery (like the fixed-angle shots used in ophthalmology or radiology). The authors suggest that future work should focus on applying this to more "open-ended" images, like dermatology photos, and developing better ways to mitigate the biases their tool uncovers—such as re-training models with "makeup-invariant" or "exposure-invariant" datasets.

The team plans to release the code for StylEx to help the broader research community audit their own medical AI models.

Summary updated

Abstract

AI models have shown promise in many medical imaging tasks. However, our ability to explain what signals these models have learned is severely lacking. Explanations are needed in order to increase the trust in AI-based models, and could enable novel scientific discovery by uncovering signals in the data that are not yet known to experts. In this paper, we present a method for automatic visual explanations leveraging team-based expertise by generating hypotheses of what visual signals in the images are correlated with the task. We propose the following 4 steps: (i) Train a classifier to perform a given task (ii) Train a classifier guided StyleGAN-based image generator (StylEx) (iii) Automatically detect and visualize the top visual attributes that the classifier is sensitive towards (iv) Formulate hypotheses for the underlying mechanisms, to stimulate future research. Specifically, we present the discovered attributes to an interdisciplinary panel of experts so that hypotheses can account for social and structural determinants of health. We demonstrate results on eight prediction tasks across three medical imaging modalities: retinal fundus photographs, external eye photographs, and chest radiographs. We showcase examples of attributes that capture clinically known features, confounders that arise from factors beyond physiological mechanisms, and reveal a number of physiologically plausible novel attributes. Our approach has the potential to enable researchers to better understand, improve their assessment, and extract new knowledge from AI-based models. Importantly, we highlight that attributes generated by our framework can capture phenomena beyond physiology or pathophysiology, reflecting the real world nature of healthcare delivery and socio-cultural factors. Finally, we intend to release code to enable researchers to train their own StylEx models and analyze their predictive tasks.
BibTeX
@misc{lang2023using,
  author = {Oran Lang and Doron Yaya-Stupp and Ilana Traynis and Heather Cole-Lewis and Chloe R. Bennett and Courtney Lyles and Charles Lau and Michal Irani and Christopher Semturs and Dale R. Webster and Greg S. Corrado and Avinatan Hassidim and Yossi Matias and Yun Liu and Naama Hammel and Boris Babenko},
  title = {{Using generative AI to investigate medical imagery models and datasets}},
  year = {2023},
  eprint = {2306.00985},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.00985},
}
Figure