InterGenEHR · Duke University × Emory University

Ask for the patient you need.

InterGenEHR lets a clinician pin down the part of a patient they care about, either by setting values or by describing the case in plain language. A generative model then fills in the rest of the electronic health record around it, from a single bedside snapshot to a four-day VV-ECMO course.

874
VV-ECMO patients from Duke and Emory
35
clinical variables per hour of care
6
interchangeable generative backbones
4
clinicians who rated the generated trajectories, blinded to the model

01 · The problem

The case you want to test is rarely in the dataset

Suppose a model predicts outcomes for patients on venovenous extracorporeal membrane oxygenation (VV-ECMO), which supports patients in severe respiratory failure. It scores well on a held-out test set. A clinician then asks a narrower question. What does the model do for a patient whose PaCO₂ climbs from 50 to 80 mmHg over a day while pH falls to 7.20? Or for a patient being weaned off ECMO oxygen over two days?

Those are the cases that matter at the bedside. They are also the ones a retrospective cohort holds too few of. Building such a patient by hand is not realistic, because a VV-ECMO record has dozens of interacting blood-gas, ventilator, hemodynamic and laboratory values that move together over time. Change one number on its own and the result is usually a patient who could not exist.

We want to state only the part of the patient that defines the question, and have every other value filled in consistently, at a single time point or across the whole course.

02 · The idea

Hold fixed what the clinician specifies. Generate the rest.

InterGenEHR rests on one operation, arbitrary conditioning. Lay a patient's record out as a grid, with clinical variables as rows and hours as columns. The clinician marks the cells they care about and gives their values. A binary mask records which cells were specified. A conditional generative model samples every unmarked cell given the marked ones, and the marked cells are copied into the output unchanged.

A snapshotone time point · mask b ∈ {0,1}35

x̂ = xo + (1 − b) ⊙ x̂u

A trajectory24 hours · mask B ∈ {0,1}35×24

X̂ = Xo + (1 − B) ⊙ X̂u

The same equation covers both cases: a snapshot is a single column of a trajectory. Which cells are specified can change from one request to the next, so a single trained model can answer many different clinical questions.

Everything else in the project follows from this. There are two ways to fill in the mask, a form for exact values or a sentence in plain language. There are two shapes of record, a snapshot or a trajectory. And the generator is a component you can swap out. Each request runs through the same loop:

  1. DescribeSet values directly or write the scenario in plain language.
  2. ConfirmConstraints are checked against a schema and plausible ranges, then confirmed by the clinician.
  3. GenerateThe selected backbone keeps the confirmed cells fixed and samples the rest of the record.
  4. Review & refineInspect several samples, tighten or relax constraints, and generate again.

03 · Demonstration

From one sentence to a patient course

Each tab below is a request from the clinician study. It shows the conditions that were held fixed, the mask they produce, and three trajectories generated by IGE-FGTI trained on the pooled Duke–Emory cohort. In each panel, a single straight line shared by all three samples is a specified condition. Lines that separate were generated.

1Request

“VV-ECMO patient with worsening respiratory acidosis, increasing PaCO₂, and declining pH over the next 24 hours.”

2Held fixed
  • PaCO₂ 50 → 80 mmHg · h 0–24
  • pH 7.35 → 7.20 · h 0–24
3Mask

4What to look at

Bicarbonate was never specified. The Henderson–Hasselbalch equation gives HCO₃⁻ ≈ 30 mEq/L at pH 7.20 and PaCO₂ 80 mmHg. The generated samples drift upward toward roughly 28–32 mEq/L by hour 23. So the model fills in a related variable in a direction consistent with acid–base physiology, while the three patients still differ from one another.

Three generated 24-hour trajectories. PaCO2 rises linearly from 50 to 80 mmHg and pH falls from 7.35 to 7.20, identical across samples. End-tidal CO2 varies between about 12 and 27 mmHg, and bicarbonate rises from about 26 toward 28 to 32 mEq/L.
PaCO₂ and pH are held fixed. End-tidal CO₂ and HCO₃⁻ are generated.
1Request

“VV-ECMO patient demonstrating gradual recovery with improving oxygenation, decreasing FiO₂ requirements, and readiness for ECMO weaning over 72 hours.”

2Held fixed
  • SaO₂ 70 → 95 % · h 0–72
  • O₂ flow 15 → 0 L/min · h 24–72
3Mask

4What to look at

The conditions cover only part of the timeline. Before hour 24 and after hour 72 the model generates O₂ flow and SaO₂ itself, and those generated segments join the fixed taper without a jump. Over the same course, PaO₂ and the P/F ratio rise in all three samples although neither was specified.

Three generated 96-hour trajectories. SaO2 is fixed rising from 70 to 95 percent over 72 hours, then generated near 92 to 95 percent. O2 flow is generated near 12 to 14 L/min for the first day, fixed declining from 15 to 0 between hours 24 and 72, then generated rising slightly to about 4. PaO2 and P/F ratio rise over the course.
Fixed segments can cover only part of the timeline. The model fills in the hours before and after them.
1Request

“Severe ARDS patient on VV-ECMO with gradually improving oxygenation over 48 hours.”

2Held fixed
  • SaO₂ 60 → 95 % · h 0–48
3Mask

4What to look at

Only one variable is fixed, yet PaO₂, SpO₂ and the PaO₂-based P/F ratio all improve with it, most clearly over the final hours. ECMO O₂ flow differs between the three patients but stays steady within each one.

Three generated 48-hour trajectories. SaO2 rises linearly from 60 to 95 percent in all samples. PaO2 rises from about 60 to 90 mmHg toward 115 to 170 mmHg near the end; SpO2 rises from the low 90s to about 97 percent; P/F ratio based on PaO2 rises from about 120 to 300; O2 flow stays nearly constant per patient between 14.4 and 15.6.
One fixed variable (SaO₂). The other oxygenation measures follow it.
1Request

“VV-ECMO patient with persistent refractory hypoxemia despite high ECMO support and stable ventilator settings.”

2Held fixed
  • SaO₂ 85 → 70 % · h 0–96
3Mask

4What to look at

This is the mirror image of the previous case. With SaO₂ falling, the generated PaO₂ drifts down over four days and the P/F ratios stay low, at roughly 150–250. The three samples reach that state along different paths.

Three generated 96-hour trajectories. SaO2 falls linearly from 85 to 70 percent. PaO2 drifts down from about 90 to 97 mmHg toward 75 to 85 mmHg, with one sample dipping near 57; SpO2 fluctuates between 92 and 100 percent; P/F ratios stay roughly between 150 and 250.
The same conditioning mechanism, specified in the opposite direction.
1Request

“VV-ECMO patient with suspected hemolysis, showing progressively increasing lactate dehydrogenase, decreasing hemoglobin, and stable respiratory function.”

2Held fixed
  • LDH 100 → 500 U/L · h 0–96
  • Hemoglobin 12 → 8 g/dL · h 0–96
3Mask

4What to look at

“Stable respiratory function” was not turned into a constraint, and the generated SpO₂ stays stable anyway. Total bilirubin, which a clinician might expect to rise with hemolysis, mostly stays flat apart from a transient spike in one sample. A reviewer could add a rising bilirubin condition and generate again.

Three generated 96-hour trajectories. LDH rises linearly from 100 to 500 U/L and hemoglobin falls from 12 to 8 g/dL in all samples. Total bilirubin stays between about 0.5 and 2.5 mg/dL with one transient spike near 3.5; SpO2 stays between about 92 and 100 percent.
Two laboratory trends held fixed. Bilirubin and SpO₂ are generated.
1Request

“VV-ECMO patient with improving carbon dioxide clearance, gradually decreasing sweep gas requirements, and normalization of acid–base status over 48 hours.”

2Held fixed
  • End-tidal CO₂ 50 → 40 mmHg · h 0–48
3Mask

4What to look at

The request asks for acid–base status to normalize. The generated pH stays near 7.33–7.42 and HCO₃⁻ near 23–30 mEq/L, both close to normal. PaCO₂ fluctuates around 40–50 mmHg and does not clearly follow the falling end-tidal CO₂. A reviewer judging how well the samples express “improving clearance” would have this to weigh.

Three generated 48-hour trajectories. End-tidal CO2 falls linearly from 50 to 40 mmHg. PaCO2 fluctuates between about 40 and 51 mmHg, pH between about 7.32 and 7.42, and bicarbonate between about 23 and 30 mEq/L.
End-tidal CO₂ is held fixed. The blood gases are generated.
1Request

“VV-ECMO patient with stable respiratory mechanics and oxygenation but progressive thrombocytopenia and laboratory abnormalities suggestive of ECMO-related complications.”

2Held fixed
  • Platelet count 50 → 20 ×10³/µL · h 0–96
3Mask

4What to look at

Only the platelet count is held fixed. Hemoglobin, INR and fibrinogen are generated for all 96 hours, and each of the three patients has its own coagulation picture. SpO₂ stays stable, as the request asked.

Three generated 96-hour trajectories. Platelet count falls linearly from 50 to 20 thousand per microliter. Hemoglobin varies between about 7.5 and 10.5 g/dL, INR between 1.2 and 1.9, fibrinogen between about 300 and 520 mg/dL, and SpO2 between about 92 and 100 percent.
One hematologic trend held fixed. The coagulation panel is generated.
1Request

“VV-ECMO patient with progressive metabolic acidosis characterized by rising lactate and increasingly negative base excess while oxygenation remains stable.”

2Held fixed
  • Lactic acid 1 → 8 mmol/L · h 0–96
  • Base excess −12 → −30 mEq/L · h 0–96
3Mask

4Why it needs a second look

The generated HCO₃⁻ (≈25–32 mEq/L) and pH (≈7.35–7.43) look normal, and they do not fit the fixed base excess. Using the base-excess relation from our consistency checks (BE = 0.9287·HCO₃⁻ + 13.77·pH − 124.58), those values imply a base excess of about +2, not −30. Each curve looks possible on its own, but the patient as a whole is internally inconsistent. The fix is to refine the request, for example by also constraining pH or HCO₃⁻, which is what the review step is for.

Three generated 96-hour trajectories. Lactic acid rises linearly from 1 to 8 mmol/L and base excess falls from about minus 12 to minus 30 mEq/L. Generated bicarbonate stays between about 24 and 32.5 mEq/L and pH between about 7.34 and 7.44.
Each variable looks plausible on its own, but they do not agree with each other. This is the kind of error the review step needs to catch.
1Request

“VV-ECMO patient who develops sudden oxygenation deterioration requiring increased ECMO flow and ventilator support over the next 12 hours.”

2Held fixed
  • O₂ flow 20 → 40 L/min · h 0–12
3Mask

4Why it needs a second look

The conditions encode the clinical response (more ECMO O₂ flow), not the deterioration itself. Nothing about oxygenation was fixed. In the result, SaO₂ stays at 95–97.5 %, and PaO₂ rises in one sample and falls in another. The trajectories are physiologically possible but do not clearly show the requested event. This gap between “possible” and “what was asked for” also appears in the clinician ratings below. Adding a falling SaO₂ or PaO₂ condition makes the request explicit.

Three generated 12-hour trajectories. O2 flow rises linearly from 20 to 40. PaO2 varies: one sample rises from 96 to 109 mmHg, one falls from 119 to 90, one fluctuates between 86 and 101. SaO2 stays between 95 and 97.5 percent; SpO2 between 91 and 99 percent.
Possible, but not a clear deterioration. Conditioning on the treatment does not force the event it is a response to.

The panels come from the project's scenario figures. Each request was parsed into conditions and three samples were drawn. The conditions listed are those visible as fixed lines in the plots. The “what to look at” notes are our own reading of the figures and are not clinician ratings. The two cases under “Needs a second look” were chosen because they show how the output can fail.

04 · Two ways in

A form for exact values, a sentence for everything else

Both entry points produce the same thing, a validated list of conditions that becomes the mask. They are two front ends to one generator.

Edit values directlyExact control over one time point
The InterGenEHR web editor. A bicarbonate value of 24.02 is set with a slider; bar charts compare the original input with the reconstructed value for temperature, arterial-line MAP, cuff MAP, pulse, unassisted respiratory rate and end-tidal CO2.
The web editor. Choose a patient and time point, change a variable such as bicarbonate, and the model reconstructs the rest of the state. Bars compare each variable's original value (blue) with the reconstruction (orange).
Describe the scenarioFor conditions that span many hours
// “Patient stable for the first day, then SpO₂ drops
//  from 96 to 80 over hours 24–48 with rising PaCO₂…”
{
  "mode": "time_series",
  "time_grid": { "n_timesteps": 96, "hours_per_step": 1 },
  "conditioning": [
    { "feature": "spo2", "type": "trajectory",
      "pattern": "stable", "from": 96,
      "window": { "start_step": 0, "end_step": 24 } },
    { "feature": "spo2", "type": "trajectory",
      "pattern": "decreasing", "from": 96, "to": 80,
      "window": { "start_hour": 24, "duration_hours": 24 } },
    { "feature": "paco2", "type": "trajectory",
      "pattern": "increasing", "from": 45, "to": 70, … }
  ],
  "unsupported_facts": [ … ],
  "ambiguity_flags": [ … ]
}
A worked example from the prompt template. A language model translates the sentence into a structured specification. It never produces the numbers in the patient record itself.

The language model only translates

The parser has one narrow job: map clinical language onto the 35 supported variables, their units and their ranges, and record each condition as a value, a range or a trend over a time window. Concepts the system cannot model are not dropped silently. Requests for PEEP, plateau pressure or urine output, for example, are listed under unsupported_facts. Values outside the feature dictionary are flagged. In one example, the parser produced a creatinine of 150 mg/dL against a dictionary limit of 20. Nothing is generated until a clinician confirms or edits the parsed conditions, and the parser can be skipped entirely.

Slot-level F1 for parsing clinician requests, by language model (direct few-shot prompting; higher is better)
Two findings stand out. First, worked examples matter more than formatting: zero-shot Gemma 3 4B produced 100 % valid, schema-compliant JSON but reached a slot F1 of only 0.74, against 0.97 with examples. Valid JSON does not mean the request was understood. Second, biomedical tuning did not help: MedAlpaca 7B often failed to produce parseable output. Adding an expert role or step-by-step instructions did not beat plain few-shot prompting.

The generator is a plug-in

Any model that can sample missing entries given observed ones and a mask can serve as the generator. We connect six established backbones to the same interface, and they do not share one winner:

Record shapeBackboneWhere it led in our evaluation
SnapshotVAEAC VAE · arbitrary conditioningMost accurate at reconstructing hidden values (imputation MSE 0.29)
PMVAE VAE · posterior matchingMost accurate when clinicians perturb inputs; best mortality AUROC with LR and GBDT
TabDDPM diffusionClosest per-feature values in free generation (lowest RMSPE and MAPE)
TrajectoryCSDI diffusion · 2-D attentionBest marginal distributions; hardest to tell apart from real sequences
FGTI diffusion · frequency-awareBest preservation of correlations between variables; best trajectory imputation
MTSCI diffusion · consistencyBest preservation of correlations across time

The choice depends on what the scenario has to get right. If a test hinges on how variables relate at one moment, choose differently than if it hinges on how a patient evolves over time.

05 · Evidence

Four questions to ask of a generated patient

We evaluate on 874 adult VV-ECMO patients, 691 from Duke (2016–2024) and 183 from Emory (2015–2021). Records are summarized into hourly steps using 4-hour windows. Each test below answers a different question, and none of them is enough alone.

Q1

Does it keep what was asked, and obey known physiology?

Specified values come back exactly, by construction. The harder test is the values that were not specified. We check three standard equations: Henderson–Hasselbalch, the base-excess relation and the Severinghaus oxygen-dissociation curve. When only pH is fixed, IGE-PMVAE generates base excess and SpO₂ that deviate from those equations by MAE 1.64 and 2.29. Real records show 1.61 and 2.72 because of measurement noise.

Q2

Does it look like real data?

A two-layer LSTM trained to separate real from synthetic trajectories reaches 63 % accuracy on IGE-CSDI output, where 50 % would be chance. CSDI also has the lowest Kolmogorov–Smirnov distance (0.237). FGTI keeps the correlations between variables best, and MTSCI keeps the correlations across time best. No single model wins every measure.

Q3

Does it carry real predictive signal?

Train a mortality classifier only on synthetic patients, then test it on real ones. With an MLP, IGE-PMVAE and EHRDiff come within 0.003 AUROC of a model trained on real data, and their confidence intervals include zero.

Q4

Do clinicians find it credible?

Four clinicians rated IGE-FGTI trajectories for ten requested scenarios, in random order and without knowing the generating model. Mean scores ranged from 3.68 to 4.20 out of 5. Raters' scores fell within one point of each other in 87–93 % of pairs.

Train on synthetic, test on real: in-hospital mortality AUROC relative to training on real data (MLP · mean ± 95 % CI · 0 = same as real)
Intervals that include zero mean the classifier could not be distinguished from one trained on real data. This is not a formal equivalence test. With logistic regression and boosted trees, IGE-PMVAE has the highest mean AUROC among the synthetic sources.
Clinician ratings of generated trajectories (1–5, higher is better · mean ± reported spread)
Clinicians rated whether a trajectory could happen more highly than whether it matches the scenario that was requested. The oxygenation-deterioration example in the demo above shows how that can happen. Closing this gap is a large part of the remaining work.
All numbers: tables from the papers
Longitudinal fidelity (lower is better; ± 95 % bootstrap CI half-widths).
MetricIGE-CSDIIGE-FGTIIGE-MTSCI
KS statistic0.2374 ± 0.00750.2393 ± 0.01390.3430 ± 0.0069
TV distance0.3108 ± 0.02330.3157 ± 0.01710.4097 ± 0.0323
Detection accuracy0.6338 ± 0.11800.6901 ± 0.18620.8732 ± 0.0807
Inter-feature corr. diff. (DPCM)5.8983 ± 0.14643.9664 ± 0.16906.3826 ± 0.1130
Temporal corr. diff. (DCSM)7.8984 ± 0.08427.8830 ± 0.02847.4248 ± 0.1881
Imputation MSE (50 % masked)0.0478 ± 0.01200.0322 ± 0.01190.0570 ± 0.0107
Single-time-point generation (lower is better). Fidelity is free generation; perturbation fixes clinician-modified inputs; imputation hides 50 % of features.
MethodFidelity RMSPEFidelity MMDPerturbation RMSPEImputation MSE
VAE10.9634.693.701.448
CTGAN15.6126.28——
EHRDiff11.2633.593.581.414
TabDiff11.9822.525.501.286
IGE-PMVAE13.6323.212.350.423
IGE-VAEAC42.69136.2810.200.292
IGE-TabDDPM8.4433.018.590.896
Clinician evaluation, four raters, ten scenarios. Agreement columns compare all six rater pairs.
QuestionScoreExact agreementWithin 1 point
Clinical plausibility4.10 ± 0.5951.7 %91.7 %
Internal physiological consistency3.90 ± 0.6343.3 %86.7 %
Representative of requested scenario3.80 ± 0.6153.3 %93.3 %
Physiological possibility4.20 ± 0.6538.3 %93.3 %
Agreement with requested scenario3.68 ± 0.6246.7 %91.7 %

06 · Limits

What a generated patient is not

The open question is concrete: when does a clinician-guided generator produce test scenarios that are useful and coherent, and how can its failures be made visible before anyone relies on them?

07 · How the project grew

Publications

  1. 2025 · IEEE BHI also at the NeurIPS 2025 Workshop on GenAI for Health

    An Interactive Framework for Generating Clinical Data with Human Feedback

    Yu Yang*, Jiafeng Song*, Zhishuai Liu, Henry P. Foote, Rishikesan Kamaleswaran, Pan Xu

    Introduced the conditioning interface and the interactive web editor for single time points, with VAE-based backbones, on 184 Emory VV-ECMO patients and 41 variables.

  2. 2026 · IEEE Transactions on Biomedical Engineering accepted

    InterGenEHR+: An Interactive Framework for Natural Language-Conditioned Generation of Longitudinal Patient Trajectories

    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

    Extended the interface to plain-language requests and to masks over both variables and time, added diffusion backbones, and evaluated on 874 Duke and Emory patients, including the clinician study.

* Equal contribution. A collaboration between Duke University (Biostatistics & Bioinformatics, Electrical & Computer Engineering, Biomedical Engineering, Surgery, Pediatrics) and Emory University School of Medicine (Emergency Medicine, Anesthesiology).