Introduction
Electronic Health Records (EHRs) contain a wealth of information critical for predicting patient outcomes. However, these records are notoriously difficult to process due to their irregular time-series nature, missing data, and reliance on complex, hierarchical medical coding systems like ICD or LOINC. Traditionally, researchers have addressed these challenges by training specialized "EHR foundation models" on millions of private patient records. While effective, these models often suffer from fixed vocabularies—meaning they cannot easily adapt to new hospitals or updated coding standards—and require access to sensitive data that is difficult to share.
This research explores a paradigm shift: instead of building domain-specific models from scratch, can we leverage the reasoning and semantic capabilities of general-purpose Large Language Models (LLMs)? By translating structured EHR data into natural language, the authors demonstrate that off-the-shelf LLMs can serve as powerful, universal encoders for clinical data.
Methodology: EHRs as a Reading Comprehension Task
The core innovation of this work is treating EHR analysis as a text-based task rather than a discrete code-processing task. The methodology involves three primary steps:
1. EHR Serialization
Structured patient data—including demographics, vital signs, lab results, medications, and clinical conditions—is converted into a human-readable Markdown document. Crucially, medical codes are replaced with their natural language descriptions, transforming abstract identifiers into semantic text.
2. LLM Encoding
The resulting Markdown document is fed into instruction-tuned LLM embedding models, such as Qwen3-Embedding-8B. These models are prompted with specific clinical queries (e.g., "will the patient be readmitted within 30 days?") to generate context-aware embeddings. The use of models with long context windows (up to 8,192 tokens) allows for the inclusion of extensive patient histories.
3. Classification
The final hidden state of the LLM is extracted as a fixed-dimensional vector. A simple logistic regression or gradient-boosted machine (GBM) classifier is then trained on these embeddings to predict specific clinical outcomes.
Experimental Setup
The approach was evaluated on two distinct benchmarks:
- EHRSHOT: A dataset of 6,739 patients from Stanford Medicine encompassing 15 clinical prediction tasks. This served as an "in-domain" test for specialized baselines like CLMBR-T-Base, which was pretrained on similar data.
- UK Biobank (UKB): A massive external cohort of approximately 387,000 patients. This provided an "out-of-domain" test to measure how well models generalize to entirely different populations and coding systems.
Key Results and Insights
The study yielded several significant findings regarding the efficacy of LLMs in the clinical domain:
- Robust Generalization: In the out-of-domain UK Biobank test, the LLM approach outperformed the specialized CLMBR-T-Base model (AUROC of 0.748 vs. 0.713). While the specialized model only recognized 16% of the UKB medical codes due to its fixed vocabulary, the LLM handled 100% by reading semantic descriptions.
- Competitive In-Domain Performance: On the EHRSHOT benchmark, the Qwen3-Emb-8B model achieved a macro-AUROC of 0.761, nearly matching the specialized CLMBR-T-Base (0.769) and significantly exceeding traditional count-based baselines (0.719).
- Few-Shot Efficiency: LLM embeddings proved to be highly data-efficient, outperforming baselines even when only 4 to 16 labeled examples per class were available.
- Complementary Signals: Combining LLM embeddings with specialized EHR model embeddings resulted in the highest overall performance, suggesting that general text models and specialized code models capture different but complementary clinical signals.
Discussion and Future Work
The success of this approach suggests that "text is the ultimate universal API" for healthcare data. By bypassing the fixed-vocabulary bottleneck, LLMs offer a path toward more portable and adaptable clinical AI. However, challenges remain. The current reliance on manual Markdown serialization introduces potential human bias, and the computational cost of running large LLMs is significantly higher than that of specialized models. Additionally, the context window limits of current LLMs may necessitate the truncation of very long patient histories.
Future research will focus on "serialization-free" methods for processing tabular data directly, improving attention mechanisms for extreme context lengths, and distilling large LLMs into smaller, more efficient models suitable for real-world clinical deployment.
Summary updated