Large Language Models are Powerful Electronic Health Record Encoders

Stefan Hegselmann, Georg von Arnim, Tillmann Rheude, Noel Kronenberg, David Sontag +3 more
2/24/2025
40 citations
cs.LGcs.AIcs.CL

Official code: stefanhgm/ehrshot-benchmark (4 stars, Jupyter Notebook, Apache-2.0, last commit 2026-03-13).

Abstract

Electronic Health Records (EHRs) offer considerable potential for clinical prediction, but their complexity and heterogeneity challenge traditional machine learning. Domain-specific EHR foundation models trained on unlabeled EHR data have shown improved predictive accuracy and generalization.

Show full abstract

However, their development is constrained by limited data access and site-specific vocabularies. We convert EHR data into plain text by replacing medical codes with natural-language descriptions, enabling general-purpose Large Language Models (LLMs) to produce high-dimensional embeddings for downstream prediction tasks without access to private medical training data. LLM-based embeddings perform on par with a specialized EHR foundation model, CLMBR-T-Base, across 15 clinical tasks from the EHRSHOT benchmark. In an external validation using the UK Biobank, an LLM-based model shows statistically significant improvements for some tasks, which we attribute to higher vocabulary coverage and slightly better generalization. Overall, we reveal a trade-off between the computational efficiency of specialized EHR models and the portability and data independence of LLM-based embeddings.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

A benchmark for few-shot evaluation of foundation models for electronic health records (EHRs)

41Jupyter Notebook, PythonJul 2, 20248 months agoApache-2.0

Similar Papers

Cite this paper

@article{hegselmann2025large,
  title  = {Large Language Models are Powerful Electronic Health Record Encoders},
  author = {Stefan Hegselmann and Georg von Arnim and Tillmann Rheude and Noel Kronenberg and David Sontag and Gerhard Hindricks and Roland Eils and Benjamin Wild},
  year   = {2025},
  eprint = {2502.17403},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.17403v6}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.17403.svg)](https://codeofpaper.com/paper/2502.17403)

Discussion