Care operations · Research feature

EHR Foundation Model Predicts Chronic Diseases Across U.S. and Taiwan Cohorts

A new electronic health record foundation model uses cross-site medical data to predict chronic diseases with high accuracy and generalization across different populations.

Adapted from research by Liwen Sun, Hao-Ren Yao, Ophir Frieder and colleagues.

arXiv preprint revision · 2026-08-24 · Attribution & reuse
In this article
Editorial illustration of stack of documents.

Editor’s introduction

The study evaluates a foundation model trained on billions of medical events from over 5 million patients in Taiwan and the U.S., using longitudinal EHR data to predict 11 chronic diseases. The model outperforms tree-based and language models, achieving over 40% sensitivity at 99% specificity in the U.S. cohort and 70% in Taiwan, with strong performance on cancer prediction—30%+ and 65%+ sensitivity at 99% specificity. Performance improves with model scale, as the 2.4B-parameter version surpasses the 160M-parameter version by 5 percentage points on key cohorts. The model demonstrates robustness across patient distributions and excels in few-shot generalization on the EHRShot benchmark, even under distribution shifts. Cross-system data alignment during pretraining proved more effective than duplicating single-site data, especially in data-limited settings. The research highlights the value of operating in the ICD code space for scalable, population-level risk prediction. A key boundary of the evidence is that the study stops at 2.4 billion parameters due to computational constraints, and it remains unclear whether scaling trends seen in general language models continue at much larger scales like 70B or 175B parameters. Future work will need to explore such larger architectures and their clinical generalization and efficiency.

Introduction

Population health management is a key strategy for improving health outcomes by enabling the systematic identification and monitoring of individuals at elevated risk for chronic diseases and adverse events. Proactive risk stratification and coordinated care have been shown to reduce morbidity and improve outcomes in conditions such as cardiovascular disease, stroke, and cancer. Early identification of high-risk populations allows for timely preventive interventions, improved disease control, and reduced healthcare utilization. Accordingly, longitudinal monitoring and integrated care delivery have become essential components of modern healthcare systems, shifting the focus from reactive treatment to prevention and early intervention.

Despite its importance, population health management remains inadequately implemented in many settings. Healthcare delivery is often fragmented, with limited coordination across providers and incomplete integration of patient data, leading to missed opportunities for early intervention. Preventive strategies frequently rely on resource-intensive or episodic care models, which are difficult to scale and may not effectively reach high-risk or underserved populations. As a result, many individuals with emerging or asymptomatic conditions are not identified until disease progression, leading to worse outcomes and higher healthcare costs. These limitations highlight the urgent need for more effective and scalable population health management approaches.

We present EHR-FM, Electronic Health Record Foundation Model, a scalable approach for population health management that leverages cross-site longitudinal electronic medical records to identify individuals at elevated risk for major chronic diseases, including cardiovascular disease and cancer. EHR-FM is pretrained on large-scale longitudinal EHR data and learns generalizable patterns of disease progression directly from structured medical codes (e.g., ICD) through next-code prediction, enabling it to capture clinically meaningful signals embedded in routine care.

A major challenge in leveraging EHR at scale is the heterogeneity of coding systems across countries and institutions, where differences in ICD versions, local code sets, and clinical practices hinder unified representation and cross-site generalization. In this work, we integrate data from over 3 million patients in Taiwan and 2 million patients from multiple U.S. states. To address this challenge, we utilize a unified code alignment framework that standardizes heterogeneous medical codes into a shared space, enabling generalized modeling across diverse healthcare systems while preserving clinically meaningful information.

Early detection is critical to chronic disease prevention in population health management, spanning cancer and cardiovascular disease. Cancer screening improves outcomes, and recent advances in AI-powered medical imaging (e.g., CT-based multimodal models) have further improved screening accuracy. However, imaging remains resource-intensive and inaccessible for under-served populations, limiting scalability. In parallel, clinical practice for cardiovascular diseases relies on guideline-driven risk calculators. Yet these tools use limited static measurements and show calibration issues and inconsistent performance across populations, limiting their effectiveness for dynamic risk prediction and large-scale population stratification.

Using electronic health records (EHR) to assess chronic disease risk is a promising path to improve detection effectiveness and efficiency by identifying patients with high risk for healthcare professionals to make informed decisions. Recent approaches have made attempts using feature-based machine learning models to detect chronic disease risks and have shown the possibility of capturing risk signals in EHR.

Inspired by the success of pretrained large language models on medical corpora, researchers has also pretrained foundation models on structured EHR data, and explored their utilities in various clinical tasks. A challenge for EHR foundation models is that many EHR datasets only cover a slice of patients’ healthcare records, e.g., MIMIC-IV mainly focuses on emergency departments and ICU encounters. Foundation models pretrained on EHR slices are more effective in prediction tasks such as emergency department triage and ICU readmission risk.

Many tasks, like cancer risk prediction, require longitudinal EHR data to capture full patient history. Foresight uses two decades of data to pretrain transformers for biomedical forecasting. MOTOR is pretrained on 2.7M records from 2014-2022 for time-to-event tasks to predict diagnosis time. CLMBR is pretrained on 2.6M records over three decades, with 6.7K records released in the EHRSHOT benchmark for 15 few-shot prediction tasks.

Medical Code Alignment

We standardize all datasets into a unified coding space using ICD-10 (diagnoses), CPT (procedures), LOINC (labs), and ATC (drugs). Alignment is performed once at data build time, producing a fixed mapping dictionary shared across training and evaluation. We first construct an inventory of unmapped local codes by aggregating raw descriptions, English glosses, and heuristic matches. This yields a candidate pool of thousands of region-specific codes requiring alignment.

We then use an LLM such as Claude to map each code to its closest standardized equivalent, returning a predicted code, confidence score, and short rationale. We retain only medium- and high-confidence mappings, and apply mappings in priority order: official mapping crosswalks, LLM-curated mappings, then TF-IDF fuzzy matching, with unmapped codes passed through unchanged. All aligned events are emitted as standardized tokens, ensuring consistent embeddings across datasets. More implementation details are in Appendix A.1.

To evaluate few-shot cross-system generalization, we further align external EHR data from the EHRShot benchmark to our curated unified coding space. EHRShot contains heterogeneous coding systems, including SNOMED, RxNorm, CPT, and ICD variants, which differ substantially across healthcare settings. Where available, we firstly leverage official mappings (e.g., CMS and NLM crosswalks) to map concepts into the unified space. For codes without explicit mappings, we formulate the mapping as a dense retrieval problem, a method widely used to align medical concepts across ontologies. We apply a textual semantic matching approach by embedding code descriptions and retrieving the most similar entries in the unified coding space with similarity threshold. This setting provides challenging benchmark for evaluating cross-system generalization of EHR foundation models. More implementation details provided in the Appendix A.1.

Pretraining, Finetuning, and Inference

Inference. The inference of EHR-FM is to take a patient’s medical history from their EHR record, run a forward pass of the pretrained and finetuned EHR-FM instances, and predict the disease risk of the patient. The inference is efficient as only one prediction token is needed per patient.

The reliance on patient history alone makes EHR-FM a natural fit for chronic disease prediction in population health management. Healthcare providers can deploy EHR-FM at scale on large EHR datasets to identify high-risk patients. These patients can then be further evaluated by clinicians to determine appropriate timing and need for intervention. Accurate risk prediction enables effective triage, improving the efficiency of care delivery and providing a larger window for timely treatment and better patient outcomes.

Experimental Methodologies

In addition, we evaluate few-shot generalization on the public EHRSHOT benchmark, which contains 6,739 Stanford Medicine patients (1990–2023) coded primarily in SNOMED, CPT, and RxNorm. After code alignment, we evaluate EHR-FM on six new diagnosis prediction tasks: acute myocardial infarction, lupus, hyperlipidemia, hypertension, celiac disease, and pancreatic cancer, following the standard few-shot setting (1–128 positive examples).

Evaluation metrics. Task performance is evaluated using AUROC, AUPRC, specificity, and sensitivity, with AUROC and AUPRC as the primary metrics. AUROC measures the model’s ability to discriminate between patients with and without disease across all thresholds, while AUPRC captures the precision–recall trade-off under class imbalance. Specificity (true negative rate) reflects reliability in identifying low-risk patients, and sensitivity (true positive rate) measures the model’s ability to detect high-risk patients. When applicable, we report sensitivity at 99% specificity, a clinically relevant operating point that reduces false positives and improves reliability.

Baselines. We include standard tree-based models with bag-of-words inputs, including XGBoost and LightGBM. We also compare against pretrained language models, BioMedLM and Qwen2.5, by converting medical codes into text and finetuning on the same data. For EHRSHOT, we benchmark EHR-FM against methods reported on the official leaderboard.

Implementation Details. We implement EHR-FM using a standard architecture, Pythia, a decoder-only transformer with rotary position embeddings and flash attention, and pretrain from scratch on unified data. Medical codes, demographics, and special tokens form a 225,568 token vocabulary, with sequences capped at 2,048 tokens. Longer histories are chunked without overlap during pretraining and truncated from left side for fine-tuning. More architecture, hyperparameters, and training details are provided in Appendix B.

Generalization Ability

Moreover, EHR-FM-160m consistently outperforms CLMBR (140M) in AUROC across nearly all K-shot. Scaling to EHR-FM-2.4b further improves few-shot performance. Notably, CLMBR is pretrained at a similar scale using on-site data (2.57M Stanford patients, same as EHRSHOT), whereas EHR-FM operates under significant distribution shift, with only partial code overlap prior to alignment. Overall, these results show EHR-FM’s robustness to distribution shifts and code mismatch, underscoring its potential for transfer across healthcare systems.

Data-limited Pretraining. To evaluate the effectiveness of unified cross-system pretraining, we consider three settings under the same token budget on US downstream cohorts with EHR-FM 160m: (1) 6B unique NHIRD-only tokens; (2) 100M unique US-only tokens repeated 60 times; and (3) a mixture of 100M unique US tokens (repeated 30 times) and 3B unique NHIRD tokens.

Conclusion

EHR-FM provides a scalable approach for chronic disease risk prediction by pretraining and adapting Transformer-based models on large-scale longitudinal medical code sequences. Its strong predictive performance (over 40% and 70% sensitivity at 99% specificity across U.S. and Taiwan cohorts), low false-positive rates, and applicability using routinely collected EHR data make it well-suited for population health management. By enabling early identification of high-risk individuals, EHR-FM can support clinicians in prioritizing screening and intervention, improving the efficiency and coverage of preventive care. Our experiments demonstrate the benefits of scaling EHR foundation models, their robustness to distribution shifts across heterogeneous healthcare systems, and the importance of unified code alignment for effective cross-system generalization. We further show that aligned cross-system data provides a stronger pretraining signal than duplicating single-site data, especially in data-limited medical settings. We hope our findings and open-source resources will facilitate future research and real-world deployment of EHR foundation models for large-scale, proactive healthcare.

Impact Statement

EHR-FM could help improve population health management for chronic diseases by enabling large-scale risk stratification from longitudinal EHR data. Using routinely collected diagnoses, procedures, medications, and laboratory records, the model can identify patients who may be at elevated risk for future disease onset or progression. Such approaches could support earlier monitoring and preventive interventions for chronic conditions including cardiovascular diseases and cancer, where timely care is associated with improved outcomes.

In addition, EHR-FM could help healthcare systems prioritize limited clinical resources by identifying patients who could benefit from additional follow-up screening or care management. Because the framework is trained on longitudinal data across multiple healthcare systems, it may also improve the robustness and generalizability of EHR-based prediction models across institutions. While further prospective validation is necessary before clinical deployment, these results suggest that scalable EHR foundation models could become useful tools for supporting preventive and population-level healthcare strategies.

When integrated into real-world clinical workflows, EHR-FM could support value-based healthcare by reducing preventable hospitalizations, complications, and late-stage disease diagnoses. Combined with downstream clinical decision support tools and multimodal diagnostics such as medical imaging, it has the potential to improve healthcare accessibility, optimize medical resource utilization, and enable earlier, more effective interventions for chronic disease management at scale.

Limitation

Due to computational constraints, our study focuses on models up to 2.4 billion parameters. Although these models already achieve strong performance, it remains unclear whether scaling trends observed in general-domain language models continue to hold for large-scale healthcare foundation models at substantially larger scales such as Chinchilla (70B) and GPT-3 (175B). Future work should explore larger architectures and investigate how scaling affects clinical generalization, robustness, and efficiency across diverse healthcare systems.

In addition, our current framework relies on a unified coding space constructed through a combination of official mappings and text-based semantic alignment methods. While this approach substantially improves cross-site generalization, medical code alignment remains an open challenge due to differences in coding standards, healthcare practices, and local billing systems across institutions and countries. Future work should investigate alternative alignment strategies, including ontology-aware methods, learned alignment approaches, and multimodal representations incorporating clinical text or laboratory measurements, to further improve cross-system generalization and representation quality. It is also worth investigating methods for combining structured codes with free-text notes and possibly other data types (e.g., lab results, imaging reports) within a unified pretraining framework.

Medical Code Alignment

If a source code exists in the mapping dictionary, the mapped international code is emitted; otherwise, the original local code is retained. This alignment enables the model to share unified tokens for equivalent drugs, procedures, laboratory tests, and diagnoses across all datasets.

This mapping process is executed once during dataset construction rather than during training or inference. The resulting mappings are stored as a frozen JSON dictionary used by the preprocessing pipeline. The LLM is only queried when refreshing or expanding the dictionary.

Training dataset

The Taiwanese National Health Insurance Research Database (NHIRD) is one of the largest and most comprehensive de-identified population-wide EHR datasets globally, covering over 99% of the Taiwanese population. Maintained by the National Health Insurance Administration in collaboration with the Ministry of Health and Welfare, the dataset contains longitudinal medical records spanning more than two decades, including patient demographics, diagnoses, prescriptions, medical procedures, clinical events, and hospital visits collected from healthcare facilities across Taiwan. The NHIRD consists of both registration records and hospital reimbursement claims submitted under the National Health Insurance (NHI) program.

NHIRD is accessible through a controlled access framework. Research institutions in Taiwan may apply for access by obtaining Institutional Review Board (IRB) approval and complying with data use regulations established by the Ministry of Health and Welfare, while international institutions may access the dataset through formal collaborations with Taiwanese research organizations. We obtained access through a collaboration with a Taiwanese medical school and completed the required IRB review process, including submission of the data schema, research protocol, access procedures, and authorized user list. Our study received IRB approval with US data and exemption because it relied exclusively on fully de-identified secondary data and involved no human subjects. To support reproducibility, we will publicly release the complete preprocessing pipeline and modeling code. In addition, pretrained model checkpoints will be made available to researchers who independently obtain NHIRD access through the same regulatory framework, enabling reproducible downstream research while maintaining strict privacy and compliance standards.

Data De-identification and Privacy. All NHIRD data are de-identified following strict protocols mandated by the National Health Insurance Administration (NHIA). Personally identifiable information (PII), such as names and ID numbers, is removed and irreversibly encrypted using non-public anonymization methods. Our study uses only anonymized demographic variables, e.g., age and gender, for model training. Given the level of anonymization and the coarse granularity of these attributes, the risk of patient re-identification is negligible. Hence, our use of NHIRD data fully complies with privacy standards and poses no ethical or legal concerns regarding patient confidentiality.

NeurIPS Paper Checklist

The checklist is designed to encourage best practices for responsible machine learning research, addressing issues of reproducibility, transparency, research ethics, and societal impact. Do not remove the checklist: The papers not including the checklist will be desk rejected. The checklist should follow the references and follow the (optional) supplemental material. The checklist does NOT count towards the page limit.

The checklist answers are an integral part of your paper submission. They are visible to the reviewers, area chairs, senior area chairs, and ethics reviewers. You will also be asked to include it (after eventual revisions) with the final version of your paper, and its final version will be published with the paper.

The reviewers of your paper will be asked to use the checklist as one of the factors in their evaluation. While [Yes] is generally preferable to [No], it is perfectly acceptable to answer [No] provided a proper justification is given (e.g., error bars are not reported because it would be too computationally expensive” or “we were unable to find the license for the dataset we used”). In general, answering [No] or [N/A] is not grounds for rejection. While the questions are phrased in a binary way, we acknowledge that the true answer is often more nuanced, so please just use your best judgment and write a justification to elaborate. All supporting evidence can appear either in the main paper or the supplemental material, provided in appendix. If you answer [Yes] to a question, in the justification please point to the section(s) where related material for the question can be found.