InterGenEHR+: An Interactive Framework for Natural Language-Conditioned Generation of Longitudinal Patient Trajectories
Authors: Yu Yang, Jiafeng Song, Baraa F Abed, Christina Creel, Sagar B Dave, Henry Foote, Lisa Lima, Victor Moas, Craig S Jabaley, Rishikesan Kamaleswaran, Pan Xu
Organizations: Department of Electrical and Computer Engineering, Duke University, Durham, NC · Department of Biomedical Engineering, Duke University, Durham, NC · Department of Emergency Medicine, Emory University, Atlanta, GA · Department of Pediatrics, Duke University, Durham, NC · Department of Surgery, Duke University, Durham, NC · Department of Anesthesiology, Emory University, Atlanta, GA · Department of Biostatistics and Bioinformatics, Duke University, Durham, NC
Objective: To develop and validate InterGenEHR+, an interactive framework for natural language-conditioned generation of synthetic tabular electronic health records (EHRs) and longitudinal trajectories for scenario-based evaluation of machine learning models. Methods: An optional large language model (LLM) parser converts clinical requests into structured constraints. Conditional variational autoencoders and diffusion models generate single-time-point records, while diffusion models generate longitudinal trajectories. We evaluate parsing, distributional fidelity, imputation, clinical-constraint adherence, mortality prediction, and clinical plausibility using a multi-institutional cohort of 874 patients receiving venovenous extracorporeal membrane oxygenation (VV-ECMO). Results: Gemma 3 4B with few-shot prompting achieves the highest parsing performance with a low spurious slot rate. IGE-TabDDPM and IGE-PMVAE perform well in single-time-point generation; IGE-CSDI, IGE-FGTI, and IGE-MTSCI lead on different longitudinal fidelity metrics. Across five random seeds and three classifiers, synthetic cohorts retain predictive utility for mortality prediction on real test data. Clinician ratings support trajectory plausibility and alignment with requested scenarios. Conclusion: InterGenEHR+ supports clinician-specified generation of EHR trajectories with statistical fidelity and downstream predictive utility in the evaluated VV-ECMO cohort. Extension to other clinical settings requires further validation. Significance: The framework supports scenario-based evaluation of machine learning models in data-sparse critical care settings.
Figures & tables
Fig. 1: Overview of InterGenEHR + . The LLM parser converts a clinician’s natural-language request into structured JSON; a clinician may instead enter constraints directly. After validation and clinician confirmation, an adapter converts the constraints into observed values and observation masks b or B . The selected conditional backbone keeps the observed entries fixed and generates a patient record at a single time point or a longitudinal trajectory.
Overall
Duke
Emory
n
874
691
183
Age, mean (SD)
47.8 (14.6)
48.4 (14.8)
45.4 (13.7)
Gender, n (%)
Female, n (%)
381 (43.6)
304 (44.0)
77 (42.1)
Male, n (%)
493 (56.4)
387 (56.0)
106 (57.9)
Race, n (%)
TABLE I: Study Cohort Demographics
Method
MAMD ↓
RMSPE ↓
MAPE ↓
VAE
34.6941±7.8506
10.9585±1.3814
5.4688±0.4161
CTGAN
26.2801±8.5311
15.6072±1.6838
6.3271±0.4877
EHRDiff
33.5905±14.0951
11.2569±1.6008
5.3466±0.6437
TabDiff
22.5158±11.2001
11.9823±1.9523
5.4722±0.8013
IGE-PMVAE
23.2106±4.1469
13.6258±1.7125
5.9493±0.5539
IGE-VAEAC
136.2840±1.1137
42.6889±0.2145
26.9601±0.0763
TABLE II: Fidelity of synthetic data for single-time-point generation.
Metric
IGE-CSDI
IGE-FGTI
IGE-MTSCI
KS Statistic ↓
0.2374±0.0075
0.2393±0.0139
0.3430±0.0069
TV Distance ↓
0.3108±0.0233
0.3157±0.0171
0.4097±0.0323
Detection Score ↓
0.1338±0.1180
0.1901±0.1862
0.3732±0.0807
Detection Accuracy ↓
0.6338±0.1180
0.6901±0.1862
0.8732±0.0807
DPCM ↓
5.8983±0.1464
3.9664±0.1690
6.3826±0.1130
DCSM ↓
7.8984±0.0842
7.8830±0.0284
7.4248±0.1881
TABLE III: Fidelity of synthetic data for longitudinal generation.
Method
MAMD ↓
RMSPE ↓
MAPE ↓
VAE
6.2785±1.7785
3.7036±0.2654
1.8300±0.1245
EHRDiff
5.0932±1.1774
3.5755±0.1821
1.7857±0.0776
TabDiff
25.1226±1.2632
5.4982±0.1949
3.0258±0.0700
IGE-PMVAE
21.9434±0.9525
2.3474±0.1822
1.5500±0.1215
IGE-VAEAC
50.7934±1.2577
10.2023±0.2256
4.6343±0.0734
IGE-TabDDPM
32.1774±2.6698
8.5927±0.2980
4.4500±0.1011
TABLE IV: Performance comparison under single-time-point perturbation.
Method
MSE ↓
NLL ↓
VAE
1.4482 ± 0.0072
4.6786 ± 0.0023
EHRDiff
1.4143 ± 0.0064
0.7072 ± 0.0032
TabDiff
1.2859 ± 0.0063
0.6429 ± 0.0032
IGE-PMVAE
0.4227 ± 0.0054
0.8118 ± 0.0051
IGE-VAEAC
0.2918 ± 0.0050
1.2065 ± 0.0045
IGE-TabDDPM
0.8960 ± 0.0075
0.9223 ± 0.0042
TABLE V: Performance Comparison on Single-Time-Point Imputation.
Method
MSE ↓
NLL ↓
IGE-CSDI
0.0478±0.0120
2.6806±0.0615
IGE-FGTI
0.0322±0.0119
−2.1719±0.0592
IGE-MTSCI
0.0570±0.0107
7.2098±0.0783
TABLE VI: Performance comparison on longitudinal imputation.
Method
pH MAE ↓
Base Excess MAE ↓
SpO 2 MAE ↓
VAE
0.0934
1.2532
2.1890
CTGAN
0.1125
4.0484
3.1240
EHRDiff
0.0949
1.5325
2.6732
TabDiff
0.0928
1.4892
2.3519
IGE -PMVAE
0.1069
1.6659
2.4445
IGE -VAEAC
0.1026
1.6991
3.1950
TABLE VII: MAE for Clinical Constraints Across Generative Models.
Conditioned Variable
pH MAE ↓
Base Excess MAE ↓
SpO 2 MAE ↓
IGE -PMVAE (pH)
0
1.6423
2.2905
IGE -PMVAE (Base Excess)
0.1002
0
2.3124
IGE -PMVAE (SpO 2 )
0.0946
1.5431
0
IGE -VAEAC (pH)
0
0.9386
3.6624
IGE -VAEAC (Base Excess)
0.0989
0
3.7803
IGE -VAEAC (SpO 2 )
0.0967
0.9563
0
TABLE VIII: MAE for Clinical Constraints Under Single-Variable Conditioning.
Evaluation item
Score
Exact pairwise agreement
Pairwise difference ≤1
Q1 Clinical plausibility
4.10±0.59
51.7%
91.7%
Q2 Internal physiological consistency
3.90±0.63
43.3%
86.7%
Q3 Requested-scenario representation
3.80±0.61
53.3%
93.3%
Q4 Physiological possibility
4.20±0.65
38.3%
93.3%
Q5 Agreement with the requested scenario
3.68±0.62
46.7%
91.7%
TABLE IX: Clinician Evaluation Results with Four Independent Raters
Fig. 2: MLP-based in-hospital mortality classification results under unconditional generation without clinician-provided observed features.
TABLE XXI: Clinical Variables in the Pooled Duke–Emory Representation
Prompt
Model
Parse
Schema
Slot
Spurious
Ambig.
(%)
(%)
F1
(%)
(%)
Direct Zero-Shot
Gemma3 4B
100
100
0.74
5.2
0.0
MedGemma 4B
100
96.7
0.60
10.3
0.0
MedAlpaca 7B
85.0
47.5
0.23
17.3
0.0
Mistral 7B
91.7
0.0
0.00
0.0
0.0
Qwen3 4B
100
100
0.77
13.5
5.0
Appendix
TABLE XXII: LLM Module Performance
Method
MSE ↓
NLL ↓
VAE
1.4482
4.6786
EHRDiff
1.5661
0.7830
TabDiff
1.4331
0.7166
IGE -PMVAE
0.4566
0.7651
IGE -VAEAC
0.3058
1.2141
IGE -TabDDPM
0.8091
0.8330
Appendix
TABLE XXIII: Imputation with a Clinically Salient Conditioning Subset. IGE denotes generative backbones integrated into the InterGenEHR + framework.
Classifier
Training data
AUROC ↑
AUPRC ↑
Accuracy ↑
Precision ↑
Recall ↑
F1 ↑
LR
Real
0.850±0.025
0.823±0.025
0.839±0.018
0.805±0.034
0.654±0.046
0.714±0.038
LR
IGE -PMVAE
0.891±0.068
0.885±0.066
0.847±0.060
0.830±0.114
0.829±0.140
0.814±0.075
LR
IGE -VAEAC
0.849±0.051
0.801±0.089
0.812±0.044
0.774±0.060
0.771±0.070
0.771±0.054
LR
IGE -TabDDPM
0.849±0.064
0.832±0.063
0.776±0.069
0.748±0.063
0.686±0.167
0.706±0.115
LR
EHRDiff
0.877±0.055
0.873±0.045
0.835±0.044
0.826±0.110
0.800±0.146
0.796±0.063
LR
TabDiff
0.820±0.041
0.788±0.062
0.765±0.074
0.719±0.112
0.743±0.057
0.726±0.068
Appendix
TABLE XXIV: Additional Downstream Utility Results for In-Hospital Mortality Classification Using Logistic Regression, Gradient-Boosted Decision Trees, and a Multilayer Perceptron (Mean ± Standard Deviation Across Five Independent Seeds)
Item
Evaluation question
Response
Q1
Does this trajectory represent a clinically plausible VV-ECMO patient?
1 (completely implausible) to 5 (completely plausible)
Q2
Are the physiological trends internally consistent?
1 (completely inconsistent) to 5 (completely consistent)
Q3
Would you consider this trajectory representative of the requested scenario?
1 (completely unrepresentative) to 5 (completely representative)
Q4
All values appear physiologically possible?
1 (completely impossible) to 5 (completely possible)
Q5
How well does the generated trajectory match this requested scenario?
1 (does not match at all) to 5 (perfectly matches)
Appendix
TABLE XXV: Exact Questions and Response Scales Used in the Clinician Evaluation
ID
Scenario
Clinician request
1
Severe ARDS
Generate a 48-hour synthetic ICU trajectory for an adult with severe ARDS on VV-ECMO. Include ventilation, ECMO support, oxygenation, hemodynamics, blood gases, and routine labs. Maintain physiologic consistency; use realistic intermittent lab timing and compatible arterial-line and cuff-pressure measurements.
2
Refractory hypoxemic respiratory failure
Generate a 72-hour synthetic ICU trajectory for an adult on VV-ECMO with refractory hypoxemic respiratory failure. Include ECMO, ventilation, hemodynamics, blood gases, and routine labs. Model a clinically coherent course without forcing simple linear trends or incompatible measurements.
3
Respiratory acidosis
Generate a 24-hour synthetic ICU trajectory for an adult on VV-ECMO with respiratory acidosis. Include ECMO and ventilator management, blood gases, hemodynamics, and relevant labs. Ensure plausible relationships among variables, intermittent lab collection, and physiologically possible values.
4
Metabolic acidosis
Generate a 72-hour synthetic ICU trajectory for an adult on VV-ECMO with metabolic acidosis during critical illness. Include hemodynamics, blood gases, ECMO and ventilator support, and relevant labs. Avoid impossible values and unexplained shifts between severe dysfunction and normal results.
5
Recovery and possible ECMO removal
Generate a 72-hour synthetic ICU trajectory for an adult on VV-ECMO being evaluated for recovery and possible liberation from ECMO. Include ventilation, ECMO settings, oxygenation, hemodynamics, and routine labs. Model a nuanced, physiologically plausible course without assuming uniform improvement.
6
Suspected hemolysis
Generate a 72-hour synthetic ICU trajectory for an adult on VV-ECMO with suspected hemolysis. Include ECMO and ventilator support, respiratory and hemodynamic monitoring, blood gases, and relevant hematologic and chemistry labs. Create a plausible pattern without forcing linear laboratory trends.
Appendix
TABLE XXVI: Clinical Scenario Requests Used in the Clinician Evaluation
ID
Parsed scenario name
Parsed conditioning description
1
Gradual ECMO-assisted oxygenation
SaO 2 : 60%→95% over 0–48 h.
2
Refractory hypoxemia with ECMO
SaO 2 : 85%→70% over 0–96 h; arterial-line MAP 50–80 mmHg and cuff MAP 40–70 mmHg over 0–24 h; pulse 120 bpm; end-tidal CO 2 40–60 mmHg.
3
Worsening respiratory acidosis
PaCO 2 : 50→80 mmHg and pH: 7.35→7.20 over 0–24 h.
4
Progressive metabolic acidosis with stable oxygenation
Base excess: −30→−80 mmol/L and lactic acid: 1→8 mmol/L over 0–96 h. Both are labeled as increasing in the saved JSON.
5
ECMO recovery and weaning
SaO 2 : 70%→95% over 0–72 h; arterial-line MAP 25–40 mmHg over 0–24 h; cuff MAP 25–40 mmHg over 24–48 h; O 2 flow: 15→0 L/min over 24–72 h; arterial-line MAP: 40→20 mmHg over 72–96 h.
Appendix
TABLE XXVII: LLM-Parsed Longitudinal Specifications Before Clinician Review: Scenarios 1–5
ID
Parsed scenario name
Parsed conditioning description
6
Hemolysis with increasing lactate dehydrogenase and decreasing hemoglobin
Lactate dehydrogenase: 100→500 U/L and hemoglobin: 12→8 g/dL over 0–96 h.
7
ECMO deterioration
O 2 flow: 20→40 L/min, arterial-line MAP 40–80 mmHg, and unassisted respiratory rate 10–30 breaths/min over 0–12 h.
8
ECMO improvement over 48 hours
End-tidal CO 2 : 50→40 mmHg over 0–48 h, labeled as increasing in the saved JSON; arterial-line MAP 40–60 mmHg over 0–48 h; O 2 flow: 15→10 L/min over 0–48 h.
9
ECMO support for acute kidney injury
Creatinine: 2→150 mg/dL over 0–96 h; base excess −30 to −20 mmol/L; HCO 3− 10–25 mmol/L; SaO 2 fixed at 98% over 0–24 h.
10
ECMO-related complications
Platelet count: 50→20×103/μ L over 0–96 h.
Appendix
TABLE XXVIII: LLM-Parsed Longitudinal Specifications Before Clinician Review: Scenarios 6–10
Longitudinal electronic health records (EHRs) document patients' sequences of clinical visits over time, preserving the temporal evolution of disease progression and care delivery. However, real longitudinal EHRs are difficult to access because they contain large amounts of fine-grained, patient-specific information. Synthetic EHR generation therefore provides a valuable approach for preserving the statistical patterns and clinical structure of patient visit trajectories, enabling broader modeling and analysis when real records are limited. Although recent generative models have made progress in producing future visit sequences, they remain limited in explicitly integrating inter-visit irregular temporal evolution and intra-visit clinical event structures in EHRs, leading to clinically inconsistent and temporally unrealistic visit sequences. In this work, we propose SynEHR, a lightweight adaptive LLM-based framework for longitudinal EHR synthesis. There are two novel designs in SynEHR, i.e., a Temporal State Conditioning Module captures irregular temporal states across visits and a Temporal-Relational Adaptation Module combines these states with patient history to dynamically construct patient-specific relational representations. SynEHR then builds on a parameter-efficient LoRA-adapted language-model generator with next-visit generation capability to train the two modules for temporally and clinically informed generation. Extensive experiments on real-world EHR datasets across fidelity, privacy, and downstream utility evaluations demonstrate that SynEHR outperforms state-of-the-art models by generating more clinically coherent and temporally faithful longitudinal EHR data.
Ximiao Li, Lin Jiang, Rongchao Xu +3
Florida State University Tallahassee, Florida, United States
Access to electronic health records (EHRs) for digital health research is often limited by privacy regulations and institutional barriers. Synthetic EHRs have been proposed as a way to enable safe and sovereign data sharing; however, existing methods may produce records that capture overall statistical properties of real data but present inconsistencies across clinical processes and observations. We developed an integrated pipeline to make synthetic patient trajectories clinically consistent through two synergistic steps: high-fidelity generation and scalable auditing. Using the MIMIC-IV database, we trained a knowledge-grounded generative model that represents nearly 32,000 distinct clinical events, including demographics, laboratory measurements, medications, procedures, and diagnoses, while enforcing structural integrity. To support clinical consistency at scale, we incorporated an automated auditing module leveraging large language models to filter out clinical inconsistencies (e.g., contraindicated medications) that escape probabilistic generation. We generated 18,071 synthetic patient records derived from a source cohort of 180,712 real patients. While synthetic clinical event probabilities demonstrated robust agreement (mean bias effectively 0.00) and high correlation (R2=0.99) with the real counterparts, review of a random sample of synthetic records (N=20) by three clinicians identified inconsistencies in 45-60% of them. Automated auditing reduced the difference between real and synthetic data (Cohen's effect size d between 0.59 and 1.60 before auditing, and between 0.18 and 0.67 after auditing). Downstream models trained on audited data matched or even exceeded real-data performance. We found no evidence of privacy risks, with membership inference performance indistinguishable from random guessing (F1-score=0.51).
The University of Queensland, Brisbane, QLD, Australia · The University of New South Wales, Sydney, NSW, Australia · Shahid Sadoughi University of Medical Sciences and Health Services, Yazd, Iran +1
The generation of high-fidelity synthetic Electronic Health Records (EHR) is crucial for advancing medical research while preserving patient privacy. However, head-to-head comparison of existing generative models is hindered by disjointed codebases, incompatible data loaders, conflicting library dependencies, and inconsistent evaluation protocols. To address these gaps, we introduce a lightweight, end-to-end benchmarking framework for reproducible synthetic EHR evaluation, organized as a unified pipeline spanning data ingestion, standardized model training, and architecture-agnostic evaluation. Our current implementation targets the generation of longitudinal ICD diagnosis codes -- the most commonly studied modality in this literature -- and is built on the community-maintained PyHealth library. We reimplement and unify strong baselines (MedGAN, CorGAN, PromptEHR, HALO) under full ICD-9 vocabulary granularity, and add a lightweight GPT-2 baseline from the general-purpose sequence-modeling literature. We contribute a rigorous, architecture-agnostic privacy-utility evaluation suite that applies identically to GAN- and transformer-based generators, and report bootstrapped confidence intervals across all metrics. We further analyze the poor long-tailed performance of existing models and discuss the extensibility of our framework beyond diagnosis codes. By lowering the engineering barrier to running, extending, and evaluating under a single pipeline, we introduce a starting point for community-driven reproducibility and benchmarking synthetic EHR models.