Retrieval-Augmented Foundation Model Enhances Risk Prediction Using Electronic Health Records

Saeed Shurrab, Mariam Al-Omari, Dana El Samad, Farah E. Shamout

TL;DR

EHR-RAGp is a retrieval-augmented foundation model that solves the "long-range history" problem in electronic health records (EHR) by dynamically fetching and weighting relevant past clinical events. By treating a patient's history as a searchable database rather than a fixed sequence, it consistently outperforms state-of-the-art models on critical tasks like mortality and ICU readmission prediction.

What Problem Does This Paper Address?

Predicting patient outcomes from Electronic Health Records (EHR) is notoriously difficult. EHR data is "messy": it consists of long, irregular sequences of heterogeneous events (labs, medications, diagnoses) spanning years.

Current foundation models for EHR typically take one of two shortcuts:

  1. Fixed Windows: They only look at a small slice of time (e.g., the last 48 hours), ignoring potentially life-saving historical context.
  2. Uniform Aggregation: They try to compress the entire history into a single summary, which often "washes out" specific, clinically important signals from the past.

The authors address this by reframing longitudinal modeling as a retrieval-augmented problem. Instead of forcing a model to "remember" everything in its internal state, they allow it to "look up" relevant historical segments when making a prediction.

Methods

The authors introduce EHR-RAGp, which utilizes a two-stage architecture:

  1. Vector Database & Chunking: A patient’s history is partitioned into "chunks" using various strategies (event-based, time-based, visit-level, or care-stage). These chunks are converted into embeddings using a pretrained encoder and stored in a vector database (using FAISS).
  2. Prototype-Guided Retrieval: This is the core innovation. To find the most relevant history, the model uses a set of learnable prototypes—latent vectors that represent common clinical patterns.
  3. The model computes how the current "query" (the current visit) aligns with these prototypes.
  4. It then retrieves historical chunks that show similar prototype alignment.
  5. A soft-weighting mechanism ensures that all retrieved chunks contribute to the final prediction, but those most contextually relevant get the highest "vote."
  6. Fusion: A Transformer-based fusion module combines the current query with the weighted historical chunks to produce the final risk score.

The backbone of the system is RoFormer, an encoder-based transformer, pretrained using a Masked Language Modeling (MLM) objective on a massive medical dataset.

Datasets

The study utilizes the MIMIC-IV (v3.1) dataset, a gold standard in clinical research containing data from over 364,000 patients.

  • Pretraining Cohort: ~199,000 patients with nearly 500 million medical events.
  • Downstream Cohort: ~50,000 patients used for specific risk prediction tasks.

The authors evaluated the model on four standard benchmarks:

  • In-hospital mortality
  • ICU readmission within 30 days
  • Long length of stay (LOS ≥ 7 days)
  • 1-year post-discharge mortality

Key Insights and Ideas

  • RAG for Structured Data: While Retrieval-Augmented Generation (RAG) is famous in Natural Language Processing (LLMs), this paper proves it is highly effective for structured, longitudinal medical data.
  • The Power of Prototypes: Simple similarity search (like "find me similar labs") isn't enough in medicine. By using learnable prototypes, the model discovers "clinical archetypes" that help it understand why a piece of history is relevant to the current situation.
  • Regularization is Vital: The authors found that without specific regularization, the model suffers from "prototype collapse"—it starts relying on just one or two patterns for everything. Adding an entropy-based penalty forces the model to use a diverse range of clinical patterns.
  • Plug-and-Play Performance: EHR-RAGp isn't just a standalone model; it can be used as an "extension" to existing models like Med-BERT or BEHRT, significantly boosting their accuracy by giving them "retrieval powers."

Key Results

EHR-RAGp achieved state-of-the-art (SOTA) results across all four tasks:

  • ICU Readmission: Achieved an AUROC of 0.747, significantly outperforming established models like BEHRT (0.737) and CEHR-BERT (0.718).
  • Long LOS: Showed massive gains, with an AUPRC of 0.618, compared to the next best baseline at 0.578.
  • Model Boosting: When added as a retrieval layer to Med-BERT, the AUPRC for Long LOS prediction jumped from 0.387 to 0.586—a nearly 20-point improvement.
  • Qualitative Success: UMAP visualizations showed that the model's latent space naturally organizes patients by clinical severity (e.g., clear separation between ICU and outpatient care stages).

Limitations and Future Work

  • Frozen Retriever: Currently, the initial retrieval stage uses a frozen pretrained encoder. The authors suggest that training the retriever and the predictor jointly (end-to-end) might yield even better alignment.
  • Single-Center Study: While MIMIC-IV is large, it comes from a single hospital system. Future work needs to validate these findings across multiple institutions to ensure the "prototypes" generalize.
  • Computational Overhead: Maintaining and querying a vector database for every patient adds complexity to real-time clinical deployment, which requires further optimization.

Summary updated

BibTeX
@inproceedings{shurrab2026retrieval,
  author = {Saeed Shurrab and Mariam Al-Omari and Dana El Samad and Farah E. Shamout},
  title = {{Retrieval-Augmented Foundation Model Enhances Risk Prediction Using Electronic Health Records}},
  booktitle = {FMSD @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=UMGFi5C19P},
}
Figure