Source-linked AI summary

SynEHR: Joint Modeling Inter-visit Temporal Evolution and Intra-visit Clinical Structure for Longitudinal EHR Synthesis

Ximiao Li, Lin Jiang, Rongchao Xu, Dahai Yu, Zhe He, Guang Wang

arXiv:2608.21673v1cs.LGcs.AI

TL;DR

Longitudinal EHR synthesis must preserve irregular inter-visit evolution and intra-visit clinical structure while addressing the privacy constraints of real records. SynEHR jointly models these factors with adaptive modules and an LLM-based generator, achieving stronger fidelity across evaluated datasets and metrics.

  • Problem

    Existing longitudinal EHR synthesis methods do not explicitly integrate irregular inter-visit temporal evolution with patient-specific intra-visit clinical structure.

  • Method

    SynEHR combines a Temporal State Conditioning Module and Temporal-Relational Adaptation Module with a parameter-efficient LLM-based next-visit generator.

  • Results

    SynEHR improves overall next-visit fidelity and performs strongly across fidelity, privacy, and downstream utility evaluations on two public EHR datasets.

  • Takeaways & Limitations

    Explicit temporal conditioning and patient-specific relational adaptation support more temporally faithful and clinically coherent longitudinal EHR generation.

Abstract

from arXiv · show

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.

1 Introduction

SynEHR addresses the challenge of synthesizing longitudinal EHR trajectories by jointly modeling irregular inter-visit temporal evolution and patient-specific intra-visit clinical structure. It uses adaptive temporal and relational modules with an LLM-based generator to improve temporal and clinical coherence.

  • Motivation: Longitudinal EHRs support temporal views of disease progression and care delivery but pose substantial privacy, governance, and re-identification challenges.Their fine-grained, temporally linked patient-level information limits broad sharing.
  • Research gap: Existing approaches often fail to explicitly preserve both clinical context and temporally coherent transitions across multiple visits.Predictive models target task-specific prediction, while generative and LLM-based methods lack explicit dynamic structural modeling for patient-specific synthesis.
  • Research gap: Irregular visit intervals and context-dependent relations among clinical data types make joint temporal and intra-visit structure modeling difficult.Static or globally shared event patterns are insufficient because relations vary with patient history and evolving temporal state.
  • Approach: SynEHR combines a Temporal State Conditioning Module with a Temporal-Relational Adaptation Module for longitudinal EHR synthesis.TSCM captures irregular temporal evolution, while TRAM adapts intra-visit clinical structure using patient history and temporal information.
  • Evaluation: On MIMIC-III, SynEHR improves diagnosis, medication, and procedure longitudinal fidelity by 2.5%, 3.0%, and 0.9%, respectively, while reducing inter-visit time discrepancy by 10.9%.The paper evaluates fidelity, privacy preservation, and downstream clinical utility on two real-world EHR datasets.

2 Data Analysis and Motivation

Inter-visit timing and intra-visit clinical structure are coupled: historical clinical context relates to when visits occur, while interval regimes correspond to different next-visit contexts. Analyses illustrate why both factors matter for longitudinal EHR synthesis.

  • Inter-visit Temporal Evolution: Historical clinical contexts can influence when the next visit occurs, while inter-visit intervals provide context for the next visit.Different intervals often correspond to different visit-level clinical contexts.
  • Inter-visit Temporal Evolution: Patients may follow either stable follow-up schedules or substantially changing visit intervals under different clinical scenarios.Figure 1 contrasts regular and irregular temporal patterns.
  • Inter-visit Temporal Evolution: Accurately modeling irregular temporal evolution is important for generating trajectories that are temporally faithful and clinically coherent.Visit timing is described as clinically informative and associated with historical clinical contexts.
  • Intra-visit Clinical Structure: For Malignant Neoplasm visits, medication patterns differ across short-, medium-, and long-interval temporal regimes.The regimes are defined as ≤7 days, 8–90 days, and >90 days, respectively.

3 Preliminaries

The paper formulates longitudinal EHR synthesis as sequential next-visit generation from historical visits. It also introduces prefix tuning as a lightweight conditioning strategy and extends it with patient-history-aware prefixes.

  • Problem Definition: A longitudinal EHR record is represented as a sequence of visits containing clinical content and timestamps.Each visit includes data-type-specific code sets such as diagnoses, procedures, medications, and laboratory items.
  • Problem Definition: The synthesis task generates the clinical content and timestamp of the next visit and repeats this process to form a longitudinal trajectory.The next-visit step conditions on historical visits and outputs the subsequent visit.
  • Prefix Tuning: Prefix tuning augments a pretrained model with learnable continuous vectors that provide conditioning without changing the discrete input sequence or fully fine-tuning the model.This makes prefix tuning a parameter-efficient adaptation strategy.
  • Prefix Tuning: Standard prefix tuning shares a task-level prefix across samples, whereas SynEHR maps each observed trajectory to a context-aware soft prefix.The extension addresses the need for conditioning that varies across patient histories.

4 Methodology

SynEHR combines temporal-state modeling of irregular inter-visit evolution with patient-specific relational modeling of intra-visit clinical structure. These representations condition a LoRA-adapted generator for autoregressive next-visit synthesis.

  • Framework overview: SynEHR serializes each patient’s longitudinal history and processes it with TSCM, TRAM, and a LoRA-adapted LLM generator.TSCM models temporal evolution, TRAM captures intra-visit structure, and the generator produces future visits.
  • Temporal State Conditioning Module: TSCM converts irregular historical visit intervals and clinical content into a patient-specific latent temporal state.Temporal feature encoding combines visit-level clinical, visit-type, and interval features before trajectory encoding and auxiliary-context fusion.
  • Temporal State Conditioning Module: TSCM produces a temporal embedding, hazard distribution, temporal-regime distribution, and confidence score for uncertainty-aware temporal guidance.Its outputs support next-visit timing estimation and subsequent clinical-relation construction.
  • Temporal State Conditioning Module: The temporal confidence score reflects both temporal-regime sharpness and uncertainty in the continuous interval estimate.Higher confidence indicates sharper regime prediction and a more certain interval estimate; lower confidence indicates greater temporal ambiguity.
  • Temporal-Relational Adaptation Module: TRAM combines a dynamic branch for temporally varying relations with a static branch for stable cross-data-type structure.The branches are fused through confidence-aware residual fusion and projected into patient-specific soft prefix tokens.
  • Temporal-Relational Adaptation Module: The static branch summarizes patient history through attention pooling, data-type-specific anchors, and explicit pairwise relations among data types.These summaries are combined into a static relational embedding for patient-specific adaptation.

5 Evaluation

SynEHR is evaluated on two real-world critical-care EHR datasets using fidelity, privacy, and downstream utility perspectives, with comparisons spanning recurrent, GAN, VAE, diffusion, and language-model baselines.

  • Datasets: SynEHR is evaluated on MIMIC-III and MIMIC-IV, retaining patients with at least three visits and four clinical data types per visit.The datasets include diagnoses, procedures, medications, laboratory items, visit-level attributes, and demographic static features.
  • Evaluation perspectives: Evaluation covers fidelity, privacy, and downstream utility.
  • Metrics: Fidelity uses LPL for temporal consistency within data types and MPL for dependencies across data types within a visit.LPL conditions on preceding visit history, whereas MPL additionally conditions on other data types in the same visit.
  • Metrics: Brier score evaluates probability accuracy and confidence quality, while ECE measures calibration across confidence bins.ECE partitions predictions into M confidence bins; experiments use M=10 equal-width bins.
  • Baselines: Baseline comparisons include recurrent predictors, GANs, VAEs, diffusion models, and language-model-based approaches.Named baselines include MLP, BEHRT, medGAN, SynTEG, EVA, TWIN, TabDDPM, MedDiff, ScoEHR, EHRPD, PromptEHR, HALO, HiSGT, and EHR2Path.
  • Implementation: All models are implemented in PyTorch and trained with LoRA-adapted instruction-tuned language-model backbones using bfloat16 precision.The evaluated backbones are LLaMA-3.1-8B-Instruct, Qwen2.5-7B-Instruct, and Qwen3-4B-Instruct-2507.

5.2 Fidelity Performance

SynEHR improves code-level and distribution-level fidelity across MIMIC-III and MIMIC-IV, with especially large gains in visit length and inter-visit time statistics.

  • Code-level fidelity: SynEHR improves code-level fidelity on both MIMIC-III and MIMIC-IV.
  • Code-level fidelity: On MIMIC-III, SynEHR-Q3 reduces diagnosis, medication, and procedure LPL by 2.5%, 3.0%, and 0.9%, respectively, versus the strongest non-SynEHR baseline.
  • Code-level fidelity: On MIMIC-IV, SynEHR-Q3 reduces diagnosis, medication, and procedure LPL by 2.4%, 1.9%, and 1.9%, respectively.It also lowers diagnosis and medication MPL by 2.7% and 1.7%, while SynEHR-Q2.5 slightly outperforms the strongest non-SynEHR baseline for lab-item LPL and MPL.
  • Distribution-level fidelity: On MIMIC-III, SynEHR-L3.1 reduces JSD for lab-item frequency, procedure frequency, visit length, and inter-visit time by 7.1%, 4.5%, 57.5%, and 10.9%, respectively.
  • Distribution-level fidelity: On MIMIC-IV, SynEHR-L3.1 reduces JSD versus EHR2Path by 33.3% for diagnosis frequency and 72.2% for procedure frequency.It also reduces JSD for medication frequency, lab-item frequency, visit length, and inter-visit time by 8.7%, 10.0%, 54.3%, and 44.6%, respectively.
  • Distribution-level fidelity: The largest distribution-level gains occur for visit length and inter-visit time.The paper states these gains suggest explicit temporal conditioning helps preserve global clinical structure and next-visit code predictability.

5.3 Privacy Assessment

SynEHR is evaluated for privacy and downstream utility across attacker-knowledge settings and clinical prediction tasks. It consistently reduces disclosure risk while preserving clinical signals, though gains vary by task and metric.

  • Privacy Assessment: 3.4%, 3.1%, 3.0%, and 1.6%: the best SynEHR variant reduces PD versus EHRPD as attacker knowledge increases across four settings.The settings assume adversaries know 10%, 20%, 35%, or 50% of real training patients; lower PD indicates lower disclosure risk.
  • Risk Prediction Using Multiple Data Types: SynEHR achieves the best average AUROC and AUPRC across ARF, shock, and mortality prediction tasks.The evaluation uses train-on-synthetic, test-on-real prediction with multiple aligned clinical data types.
  • Risk Prediction Using Multiple Data Types: 1.1% in average AUROC and 2.7% in average AUPRC: SynEHR-L3.1 improves over EHR2Path across the three clinical tasks.EHR2Path remains strongest on mortality, while SynEHR variants lead several ARF and shock metrics.
  • Time Interval Prediction: SynEHR-Q3 improves Macro-F1 from 0.386 to 0.391, NLL from 0.920 to 0.872, Brier score from 0.426 to 0.397, and ECE from 0.044 to 0.041.These results favor interval-regime discrimination and calibrated uncertainty; EHRPD retains the lowest MAE for point prediction in days.

5.5 Ablation Study

Ablation results indicate that TSCM and TRAM each contribute to SynEHR, with distinct effects on temporal progression, clinical relations, and downstream utility.

  • Component Contributions: Removing TSCM causes the largest degradation in Avg. LPL and inter-visit Time JSD, highlighting its role in temporal progression and irregular intervals.The ablations average results across SynEHR-L3.1, SynEHR-Q2.5, and SynEHR-Q3 on MIMIC-III.
  • Component Contributions: Removing TRAM most strongly hurts Avg. MPL, consistent with its role in preserving clinical relations across data types.The study also removes TRAM’s static and dynamic branches and confidence-aware fusion.
  • Component Contributions: The dynamic TRAM branch has a larger impact than the static branch, especially on Time JSD and acute risk prediction.This pattern suggests dynamic temporal signals matter more for downstream utility.

6 Related Work

Related work spans predictive EHR representation learning, synthetic EHR generation, diffusion models, and language-model-based generators. These approaches increasingly model longitudinal structure, but the paper positions SynEHR as integrating temporal evolution with patient-specific clinical relations.

  • Predictive EHR Representation Learning: Early predictive EHR models learn visit-sequence representations for future event prediction rather than generating longitudinal visit trajectories.Doctor AI uses recurrent networks, RETAIN adds reverse-time attention, and sequential models capture visit-level dependencies better than flattened MLP histories.
  • Predictive EHR Representation Learning: Later representation-learning studies incorporate multiple data types, hierarchical structure, and prototype-based designs for prediction and interpretability.Examples include MEDFuse, ProtoEHR, and LLM-based refinement of noisy clinical graph structures.
  • Synthetic EHR Generation: Synthetic EHR generators use adversarial, variational, and diffusion-based approaches to preserve realistic clinical records and longitudinal structure.medGAN and SynTEG represent adversarial methods; VAE-based methods and diffusion models provide probabilistic alternatives for discrete, temporal, and mixed-type data.
  • Diffusion-Based EHR Synthesis: Diffusion-based EHR work increasingly addresses next-visit generation, interval estimation, and irregular temporal patterns in privacy-sensitive longitudinal data.EHRPD targets predictive next-visit generation with interval estimation, while related diffusion methods emphasize irregular temporal modeling.
  • Language-Model-Based EHR Generation: Language-model-based generators formulate clinical trajectories as token sequences, using prompting, hierarchy, or semantic embeddings for autoregressive synthesis.PromptEHR, HALO, and HiSGT exemplify text-to-text, hierarchical, and clinically structured generation approaches.

7 Conclusion

SynEHR integrates irregular inter-visit timing with stable and dynamic intra-visit relations for patient-specific longitudinal EHR synthesis. Across two public datasets and 14 baselines, it improves fidelity and utility while reducing privacy disclosure risk.

  • Conclusion: SynEHR combines a Temporal State Conditioning Module with a Temporal-Relational Adaptation Module for patient-specific longitudinal EHR generation.The modules capture uncertainty-aware next-visit timing and stable or interval-dependent clinical relation shifts.
  • Conclusion: Across fidelity, privacy, and utility evaluations on two public EHR datasets against 14 baselines, SynEHR improves overall next-visit fidelity and downstream clinical utility while reducing disclosure risk.The paper reports up to 6.8% improvement in ARF AUPRC over the strongest competing baseline.
  • Conclusion: The findings support explicit temporal-relational conditioning as a basis for realistic and practical longitudinal EHR synthesis.This conclusion follows the reported improvements in fidelity, utility, and privacy disclosure risk.

GenAI Usage Disclosure

ChatGPT was used only for writing-related assistance, with all AI-assisted text reviewed and revised by the authors.

  • ChatGPT assisted with grammar polishing and wording refinement.
  • The authors reviewed and revised all AI-assisted text.
  • ChatGPT did not generate research ideas, experimental results, citations, or unsupported scientific claims.
Loading 2608.21673v1…