Abstract
Accessing longitudinal multimodal Electronic Healthcare Records (EHRs) is challenging due to privacy concerns, which hinders the use of ML for healthcare applications. Synthetic EHRs generation bypasses the need to share sensitive real patient records. However, existing methods generate single-modal EHRs by unconditional generation or by longitudinal inference, which falls short of low flexibility and makes unrealistic EHRs. In this work, we propose to formulate EHRs generation as a text-to-text translation task by language models (LMs), which suffices to highly flexible event imputation during generation. We also design prompt learning to control the generation conditioned by numerical and categorical demographic features. We evaluate synthetic EHRs quality by two perplexity measures accounting for their longitudinal pattern (longitudinal imputation perplexity, lpl) and the connections cross modalities (cross-modality imputation perplexity, mpl). Moreover, we utilize two adversaries: membership and attribute inference attacks for privacy-preserving evaluation. Experiments on MIMIC-III data demonstrate the superiority of our methods on realistic EHRs generation (53.1% decrease of lpl and 45.3% decrease of mpl on average compared to the best baselines) with low privacy risks.
Introduction
Machine learning in healthcare is often bottlenecked by data scarcity. While Electronic Healthcare Records (EHRs) are rich with information, they are notoriously difficult to share due to stringent privacy regulations like HIPAA and the inherent risk of re-identification even after de-identification. Synthetic data generation is a promising workaround, but existing methods—primarily based on Generative Adversarial Networks (GANs) or Variational Autoencoders (VAEs)—face significant hurdles.
EHRs are inherently complex: they are multimodal (containing diagnoses, medications, lab tests, etc.) and longitudinal (sequences of visits over time). Clinical codes are discrete and sparse, which often causes GANs to suffer from "mode collapse" or instability. Furthermore, most current generators are "unconditional," meaning they cannot easily generate a specific type of patient (e.g., "a 65-year-old female with diabetes").
Methods: EHR Generation as Language Modeling
PromptEHR shifts the paradigm from traditional deep generative modeling to Natural Language Processing (NLP). By formulating EHR generation as a text-to-text translation task, clinical events are converted into sequences of tokens that a language model can process.
Architecture
The framework utilizes BART, a sequence-to-sequence model consisting of a bidirectional encoder and an autoregressive decoder. This architecture allows the model to "understand" the context of previous visits through the encoder before "writing" the next visit's events with the decoder.
Prompt Learning and Conditioning
The core innovation lies in the use of prompt learning to control the generation process:
- Prefix Prompts: Facilitate longitudinal imputation by predicting the next visit based on history.
- Cloze Prompts: Enable cross-modality imputation, such as predicting medications given a diagnosis.
- Conditional Prompt Featurizer: This specialized module encodes numerical (age) and categorical (gender, ethnicity) demographics into continuous embeddings. These are prepended to the input, "steering" the model to generate data for specific patient profiles.
The model is trained using a causal language modeling loss. To ensure the model learns robust clinical patterns rather than just memorizing sequences, the researchers added perturbations like token masking and span shuffling during training.
Experiments and Results
The study utilized the MIMIC-III dataset, focusing on four event types: Diagnoses, Drugs, Procedures, and Lab Tests. PromptEHR was compared against several baselines, including MedGAN, SynTEG, and a standard GPT-2 model.
Quality and Realism
PromptEHR achieved a 53.1% decrease in longitudinal imputation perplexity (lpl) and a 45.3% decrease in cross-modality perplexity (mpl) compared to the best-performing baselines. Lower perplexity indicates that the generated data follows real-world clinical logic more closely. The inclusion of demographic features was shown to significantly improve the clinical realism of the generated sequences.
Privacy and Utility
In adversarial tests, a "Membership Inference Attack" (attempting to determine if a real patient was in the training set) performed no better than a random guess, with an AUC of approximately 0.505. This demonstrates that PromptEHR maintains high privacy standards.
Furthermore, the synthetic data showed high downstream utility. Models trained on a mix of synthetic PromptEHR data and limited real data outperformed models trained on real data alone, highlighting PromptEHR's potential for data augmentation in low-resource settings.
Conclusion
PromptEHR demonstrates that generative language models are fundamentally well-suited for EHR generation due to the discrete, sequential nature of clinical codes. While the current model focuses on discrete codes, future work could incorporate unstructured clinical notes. Additionally, integrating formal privacy guarantees like Differential Privacy remains an important future direction.
Summary updated