Abstract
Electronic Health Records (EHR) are essential for advancing precision medicine, yet their sensitive nature often restricts access. While Generative Adversarial Networks (GANs) have been the standard for synthetic data generation, they frequently suffer from training instability and "mode collapse." We introduce EHRDiff, a novel generative framework that leverages diffusion models to synthesize high-fidelity EHR data. EHRDiff demonstrates superior performance across binary, continuous, and time-series medical data, achieving state-of-the-art diversity and utility while maintaining robust privacy safeguards.
Introduction
The development of diagnostic AI and personalized treatment plans depends on access to large-scale Electronic Health Records (EHR). However, the bureaucratic and ethical challenges of accessing real patient data often hinder research. Synthetic data generation offers a viable path forward, but existing GAN-based methods often fail to capture the full complexity and diversity of human health data, frequently ignoring rare medical codes. EHRDiff addresses these challenges by applying the principles of diffusion models—recently popularized in image generation—to the structured and heterogeneous domain of medical records.
Methods
EHRDiff adapts the diffusion model formulation (Karras et al., 2022) to the unique constraints of EHR data through three key innovations:
- Continuous Mapping: Discrete medical codes are treated as continuous values in the range [0, 1], enabling the diffusion process to operate in a continuous space.
- Pre-conditioning: To handle the inconsistent variance across features (e.g., common vs. rare diseases), EHRDiff uses a pre-conditioning design to normalize inputs and outputs, facilitating more effective denoising.
- Heun’s 2nd Order Sampling: By employing a 2nd-order sampling method with a correction step, EHRDiff reduces truncation errors during data generation, resulting in higher-quality synthetic records.
Datasets
The model was evaluated on three benchmark datasets:
- MIMIC-III: Focused on 1,782 ICD-9 diagnosis and procedure codes.
- CinC2012: A mixed-type dataset for ICU mortality prediction.
- PTB-ECG: A collection of temporal electrocardiogram signals.
Key Results
EHRDiff consistently outperformed five major GAN baselines, including medGAN and EMR-WGAN, across several critical metrics:
Feature Diversity and Fidelity
A major advantage of EHRDiff is its ability to avoid mode collapse. On the MIMIC-III dataset, EHRDiff generated 1,770 non-zero code columns out of 1,782, whereas the best-performing GAN (EMR-WGAN) only captured 1,060. This indicates that EHRDiff preserves the "long tail" of rare medical conditions.
As shown in Figure 3, the feature prevalence of synthetic data generated by EHRDiff is highly correlated with real data (Corr = 0.9988). In contrast, older GAN-based models like CorGAN (Figure 4) exhibit significantly more noise and lower correlation.
Downstream Utility
Synthetic data from EHRDiff proved highly effective for training downstream models. In mortality prediction tasks using the CinC2012 dataset, a classifier trained on EHRDiff data achieved an AUC of 0.8405, nearly matching the 0.8479 achieved with real data. For ECG signals, the utility reached a near-perfect 0.9898 AUC.
Discussion and Future Work
EHRDiff represents a significant leap in synthetic EHR generation, providing high-utility data that is statistically indistinguishable from real records. However, challenges remain. Future research will focus on conditional generation to allow for the creation of specific patient cohorts. Additionally, while EHRDiff shows low privacy risk, further integration of techniques like Differential Privacy will be explored to ensure absolute protection against sophisticated privacy attacks and to mitigate potential algorithmic biases.
Summary updated