Causal Disentanglement for Robust Long-tail Medical Image Generation

Weizhi Nie, Zichun Zhang, Weijie Wang, Bruno Lepri, Anan Liu, Nicu SebearXiv 2025

Abstract

Counterfactual medical image generation effectively addresses data scarcity and enhances the interpretability of medical images. However, due to the complex and diverse pathological features of medical images and the imbalanced class distribution in medical data, generating high-quality and diverse medical images from limited data is significantly challenging. We propose a novel medical image generation framework that generates independent pathological and structural features based on causal disentanglement and utilizes text-guided modeling of pathological features to regulate the generation of counterfactual images. By introducing group supervision and initial noise optimization, our approach improves performance on long-tailed categories and ensures anatomical stability.

Introduction

Deep learning applications in medical imaging are frequently hindered by three primary challenges: data scarcity, privacy constraints, and class imbalance. While common pathologies are well-represented in datasets, rare but clinically significant conditions—the "long-tail"—are often underrepresented, leading to biased diagnostic models.

Conceptual overview of counterfactual medical image generation.

Counterfactual generation aims to answer the question: "What would this specific patient's X-ray look like if they had a different condition?" Existing models often struggle with this, either producing blurry outputs or "hallucinating" changes to the patient's underlying anatomy (e.g., bone structure or heart shape) when adding a lesion. This paper introduces a framework that causally disentangles identity from pathology to produce structurally stable and clinically accurate counterfactual images.

Methodology

The proposed framework consists of three integrated modules designed to ensure anatomical consistency and robust generation of rare pathologies.

The three-part framework: (a) Causal Disentanglement and Counterfactual Module, (b) Feature Generation Module, and (c) Long-tail Optimization Module.

1. Causal Disentanglement Module

Traditional disentanglement methods often assume independence between features. However, in medical imaging, pathology often physically interacts with anatomy (e.g., a pleural effusion shifting the lung boundary). We utilize a Variational Autoencoder (VAE) and a Multi-layer Transformer to model this causal relationship. To enforce the separation of identity and pathology, we employ "group supervision," where features are swapped between image pairs during training to ensure the model can reconstruct a patient's unique anatomy regardless of the pathological state.

2. Feature Generation Module

Pathological features are modeled using a Latent Diffusion Model (LDM) guided by text prompts. To mitigate the noise inherent in raw radiology reports, we leverage a Large Language Model (GPT-4o) to extract precise information regarding lesion severity and location. This refined text guidance ensures that the generated pathological features are clinically relevant and accurately placed within the anatomical context.

3. Long-tail Optimization Module

To address the "long-tail" problem of rare diseases, we introduce a training-free optimization step. During inference, the model utilizes a small set of reference images for a rare condition. It iteratively optimizes the initial noise seed ($z_T$) of the diffusion process to minimize the semantic distance from these reference images. This "nudges" the generation toward the rare category's distribution without requiring extensive retraining on imbalanced data.

Experimental Results

The framework was validated on three benchmark chest X-ray (CXR) datasets: CheXpert, MIMIC-CXR, and IU-Xray.

Image Quality and Diversity

The model achieved a state-of-the-art Fréchet Inception Distance (FID) of 7.24 on the MIMIC-CXR dataset, significantly outperforming specialized models such as RoentGen (13.19) and LLM-CXR (10.84). A lower FID score indicates superior image quality and a distribution closer to real medical data.

Clinical Validation

An evaluation by ten experienced radiologists confirmed the model's clinical utility. The generated images achieved an average pathological classification accuracy of 86% and a score of 4.21/5 for anatomical structure preservation.

Downstream Impact

Augmenting a standard ResNet18 classifier with synthetic counterfactual images led to performance gains across all categories. Notably, F1-scores for rare conditions like Consolidation and Pneumothorax improved significantly, demonstrating the framework's ability to mitigate the effects of class imbalance.

Conclusion

This research presents a robust framework for counterfactual medical image generation through causal disentanglement and targeted long-tail optimization. While the current optimization process adds 2–3 minutes per sample during inference, the resulting anatomical stability and pathological accuracy represent a significant step forward. Future work will focus on accelerating inference and extending the framework to 3D modalities such as CT and MRI.

Summary updated

BibTeX
@misc{nie2025causal,
  author = {Weizhi Nie and Zichun Zhang and Weijie Wang and Bruno Lepri and Anan Liu and Nicu Sebe},
  title = {{Causal Disentanglement for Robust Long-tail Medical Image Generation}},
  year = {2025},
  eprint = {2504.14450},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.14450},
}
Figure