Foundation Models for Clinical Records at Health System Scale

Haresh Rengaraj Rajamohan, Xiang Gao, Weicheng Zhu, Shih-Lun Huang, Long Chen, Kyunghyun Cho, Cem M Deniz, Narges Razavian

TL;DR

This paper introduces a 1.6-billion-parameter generative foundation model for longitudinal electronic health records (EHRs) that pretrains on next-visit, multi-label clinical event prediction. By explicitly encoding inter-visit time intervals and applying a novel decay-based loss regularization to penalize recurring tokens, the model discourages trivial historical repetition and excels at zero-shot forecasting of new disease onsets—matching or outperforming fine-tuned masked transformer baselines.

What Problem Does This Paper Address?

Electronic Health Records (EHRs) contain rich longitudinal data—diagnoses, lab tests, and medications—spanning years of patient care. However, turning these records into predictive models typically requires task-specific datasets and supervised fine-tuning.

Applying generative foundation models (like GPT) to structured EHRs introduces two major hurdles:

  1. Intra-visit order ambiguity: Events recorded during a single visit lack fine-grained timestamps, making traditional single-token-at-a-time autoregression unnatural.
  2. The "echo chamber" of chronic disease: Unlike natural language, chronic disease codes frequently repeat throughout a patient's chart. Standard models often achieve artificially high precision and recall simply by echoing past diagnoses rather than learning the subtle clinical precursors of a new onset.

Methods

The authors propose a decoder-only Transformer (~1.6B parameters) pre-trained on next-visit multi-label prediction:

  • Event Representation & Tokenization: Demographics, age, diagnoses (ICD-10), medications (RxNorm), and lab results (LOINC, quantile-binned) are mapped into a unified vocabulary of 42,337 tokens.
  • Modified Causal Attention: Within a single visit, tokens can attend to each other bidirectionally, but temporal causality is strictly enforced across visits.
  • Timeline Conditioning via RoPE: Rotary Positional Embeddings encode the elapsed time since the initial visit. Crucially, the separator token (<sep>) ending visit $i$ receives the timestamp embedding of visit $i+1$, explicitly conditioning the multi-label prediction on the inter-visit time gap.
  • Repetition-Decay Regularization: To prevent the model from coasting on known chronic conditions, the authors weight the binary cross-entropy loss for each positive token by a decay factor: $$\max\left(\delta^{c(k, H_{t_i})}, w_{\min}\right)$$ where $c(k, H_{t_i})$ is the historical frequency of token $k$, and $\delta \in (0, 1]$ penalizes repeated tokens.

  • Zero-Shot Evaluation: Target condition risk is computed by aggregating logits of associated diagnosis and medication codes without modifying or fine-tuning model weights.

[Visit i Tokens (bidirectional)] -> [<sep> w/ PosEmb(t_{i+1})] ---> Sigmoid Logits for Visit i+1
                                      |
                     Conditioned on future visit time

Datasets

  • NYU Langone Health Cohort: A large, diverse 10-year dataset (January 2013 – January 2023) encompassing both inpatient and outpatient encounters.
  • Size: ~1.29 million unique patients ($N = 1,288,242$) with a median of 21 visits per patient (mean: 37.76; trajectory length: 474.21 tokens on average).
  • Split: 70% train, 15% validation, 15% test.
  • Zero-Shot Benchmarks: Curated subsets evaluating medium-to-long-term onset (2-year and 5-year windows) for Dementia and Knee Osteoarthritis (OA). Patients with prior history of the target disease or onset within the first year post-index were excluded to eliminate label leakage.

Key Insights and Ideas

  • Standard Metrics Can Be Misleading: Evaluating EHR models with conventional precision and recall heavily favors models that simply parrot known chronic diagnoses.
  • The "On-Time Rate" Metric: The authors define $r = \text{TP}_{\le t_1} / \text{TP}_{\text{total}}$, tracking true positive alerts that occur at or before the first recorded disease onset.
  • The Regularization Trade-off: Lowering the decay parameter $\delta$ (increasing penalty on repeats) markedly boosted the on-time detection rate for conditions like dementia and pancreatic cancer, even though naive trajectory-wide precision/recall dipped.
  • Generic LLMs Struggle on Structured EHRs: Evaluating LLaMA-3.3-70B-Instruct (using recursive JSON-based EHR summarization) yielded poor predictive accuracy, demonstrating that prompting off-the-shelf text LLMs does not substitute for domain-specific structured foundation models.

Key Results

The zero-shot GPT-EHR model achieved performance comparable to—and in some tasks exceeding—a fully fine-tuned, task-specific BERT baseline:

Condition Horizon Approach AUROC (95% CI) AUPRC (95% CI)
Dementia 2 years GPT Zero-shot<br>Fine-tuned BERT 0.814 (0.804, 0.823)<br>0.731 (0.730, 0.733) 0.039 (0.036, 0.044)<br>0.050 (0.050, 0.051)
5 years GPT Zero-shot<br>Fine-tuned BERT 0.781 (0.770, 0.790)<br>0.721 (0.720, 0.722) 0.106 (0.096, 0.116)<br>0.146 (0.145, 0.147)
Knee OA 2 years GPT Zero-shot<br>Fine-tuned BERT 0.724 (0.719, 0.730)<br>0.743 (0.743, 0.744) 0.056 (0.053, 0.059)<br>0.064 (0.064, 0.064)
5 years GPT Zero-shot<br>Fine-tuned BERT 0.693 (0.686, 0.699)<br>0.717 (0.716, 0.718) 0.193 (0.185, 0.203)<br>0.220 (0.219, 0.220)
  • Zero-Shot Competitiveness: Without any task-specific parameter updates, zero-shot GPT-EHR surpassed fine-tuned BERT in AUROC on dementia by +0.083 (2-year) and +0.060 (5-year).
  • LLM Baseline Comparison: LLaMA-3.3-70B-Instruct achieved a precision and recall of only 0.018 on 5-year dementia onset.

Limitations and Future Work

  • Single-Step Predictions: The current evaluation only tests one-step forward predictions; multi-step rollouts simulating full future health trajectories remain an open challenge.
  • EHR Blind Spots: Structured EHR data lacks broader context such as environmental exposures, socioeconomic status, and lifestyle habits.
  • Pretraining Scale: While trained on 1.29 million patients, training volume remains small compared to web-scale natural language or vision models.
  • Future Horizons: Adapting reinforcement learning, test-time compute/reasoning algorithms, and synthetic patient generation could further improve tabular clinical models.

Summary updated

BibTeX
@inproceedings{rajamohan2025foundation,
  author = {Haresh Rengaraj Rajamohan and Xiang Gao and Weicheng Zhu and Shih-Lun Huang and Long Chen and Kyunghyun Cho and Cem M Deniz and Narges Razavian},
  title = {{Foundation Models for Clinical Records at Health System Scale}},
  booktitle = {FMSD @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=bnX1KRerWl},
}

Loading related content...

Figure