$\texttt{EHR-RAGp}$: Prototype-Guided Retrieval of Longitudinal Electronic Health Records for Clinical Prediction Models
Anonymous authors
ICLR 2027
TL;DR. Retrieval Augmented EHR framework
Abstract. Electronic Health Records (EHR) contain rich longitudinal patient information and are widely used in predictive modeling applications. However, effectively leveraging historical data remains challenging due to long trajectories, heterogeneous events, temporal irregularity, and the varying relevance of past clinical context. Existing approaches often rely on fixed windows or uniform aggregation, which can obscure clinically important signals. In this work, we introduce , a retrieval-based framework that dynamically integrates the most relevant patient history consisting of diverse clinical event types. We propose a prototype-guided retrieval module that acts as an alignment mechanism and estimates the relevance of retrieved historical chunks with respect to a given prediction task, guiding the model towards the most informative context. Across multiple clinical prediction tasks and two benchmark datasets, consistently outperforms state-of-the-art EHR-based and transformer-based baselines. Furthermore, is model-agnostic, as integrating it with various backbone models yields substantial performance gains. Overall, establishes a novel direction for modeling long-range clinical context to improve downstream performance via retrieval.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
ICLR 2027
Under review · 3 reviews · OpenReview
Updated 24 Nov 2026, 16:44 UTC.
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 1/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
The paper recasts long-horizon EHR modeling as retrieval. A patient's history is chunked along four granularities (event, time, visit, care stage), embedded with a RoBERTa encoder, stored in a FAISS index, and top-M chunks are retrieved by cosine similarity. A prototype-guided alignment operator soft-reweights chunks by agreement between query and chunk prototype assignments, and a two-layer transformer fuses the result. Evaluation covers four MIMIC-IV ICU tasks and nine EHRSHOT tasks with a CLMBR backbone, claiming improvement in every backbone/task/metric cell tested.
Strengths
Leakage hygiene is better than typical here: pretraining uses only the training split, splits are patient-disjoint, normalization is fit on training data only, and the paper explicitly declines significance claims against EHRSHOT long-context baselines it cannot match. Confidence intervals are reported for all MIMIC numbers.
Weaknesses
- The headline numbers cannot be reproduced from the paper's own tuning and ablation tables: Appendix S4 reports Ts = 0.22 for the one-year task, outside the search space {0.1, 0.15, 0.2, 0.25} declared in S3, and S13 shows the best one-year setting at Ts = 0.20 (0.853 AUROC / 0.564 AUPRC).
- The in-hospital task is inconsistent the same way: S4 uses 0.20 while S13 reports 0.25 as best (0.950 / 0.736).
- Table 5 reports ICU prototype entropies of 6.198 and 6.232, which exceed the maximum possible for the 64-prototype ICU configuration (ln 64 = 4.159); values near ln 512 = 6.238 suggest a different prototype count was used, and since the ablation never reproduces the headline values I could not determine which configuration produced them.
- No seeds or error bars are reported anywhere, and the prototype-attribution gain (AUROC 0.008-0.015) is smaller than the spread of the prototype-count sweep itself (0.018 in S12), so the benefit of the central mechanism is within run-to-run variation.
- On EHRSHOT the paper reports no confidence intervals and no significance tests, and uses quoted rather than re-run baselines for eight of nine headline tasks; Section S10 reports p-values from 0.0098 to 0.0355 across roughly 112 tests with no multiplicity correction.
- Table 5 shows prototype assignments operating at about 99% of maximum entropy, meaning the weights are nearly uniform, which sits awkwardly with the claim that prototypes meaningfully guide retrieval.
Questions for the authors
- Which exact configuration produced the headline 0.750/0.141 and 0.853/0.564 results? Please reconcile S4, S12 and S13, including the Ts = 0.22 value.
- What prototype count and model size produced the Table 5 ICU entropies, and can Table 5 be reproduced from a stated configuration?
- Please report seeds and mean +/- SD for Tables 1-3, and add a multiplicity correction for S10.
- Does the removal of billing codes extend to DRG codes, and can discharge-coded events that postdate the query time leak into the retrieved context?
- What is the code/data URL? The current "link" placeholder prevents verification.
4 comments
Response to Reviewer xmev comments (7/13) and (8/13)
Comment (7/13):
On EHRSHOT, the paper reports no confidence intervals and no significance tests, and uses quoted rather than re-run baselines for eight of nine headline tasks;
We thank the reviewer for this comment. We would like to indicate that EHRSHOT [1] is a standardized benchmark published in the NeurIPS Datasets and Benchmarks Track. The benchmark provides fixed patient splits, task definitions, and an evaluation protocol precisely so that results from different groups are directly comparable. To ensure consistency with their baselines, we used their provided config files (official data, splits, and evaluation protocol without modification) and we used their provided pretrained CLMBR checkpoint.
This way we ensured that EHR-RAGp is built on the same pretrained model that the leaderboard reports. The CLMBR baseline results are taken from the benchmark’s public leaderboard, and the long-context results from the Context Clues study [2] (ICLR 2025), a peer-reviewed evaluation of long-context models using the same config.
The purpose of a benchmark is to avoid re-implementation differences, and re-running published models in-house would risk introducing deviations from the reported protocol, not removing them. We therefore report the published numbers and cite their source. We also made a clear statement that these comparisons are descriptive in: “we make no claim of superiority or statistical significance on EHRSHOT”, which the reviewer supports. Our goal was to show how EHR-RAGp compares with models trained on long contexts as a secondary analysis. We agree that this was not clear in the paper so we added a clear statement.
References:
[1] Wornow M, Thapa R, Steinberg E, Fries J, Shah N. Ehrshot: An ehr benchmark for few-shot evaluation of foundation models. Advances in Neural Information Processing Systems. 2023 Dec 15;36:67125-37.
[2] Wornow M, Bedi S, Fuentes Hernandez MA, Steinberg E, Fries J, Ré C, Koyejo S, Shah N. Context clues: evaluating long context models for clinical prediction tasks on EHR data. In International Conference on Learning Representations 2025 May 1 (Vol. 2025, pp. 16518-1)
Comment (8/13):
Section S10 reports p-values from 0.0098 to 0.0355 across roughly 112 tests with no multiplicity correction. Add a multiplicity correction for S10.
We applied Holm correction across all 112 comparisons in Table S10, with controlling the family-wise error rate at 0.05. After correction, we found that 108 out of all 112 comparisons remain statistically significant. The four non-significant comparisons concern EHR-RAGp’s ICU-readmission AUPRC against BigBird, GenHPF, RoBERTa, and RoFormer. We will report the adjusted p-values and update the corresponding significance markers and claims in the manuscript. The correction results are shown below.
Updated Table S10: Adjusted p-values for paired patient-level bootstrap comparisons between EHR-RAGp and each baseline. Adjusted p-values were computed with Holm’s step-down procedure over all 112 comparisons (14 baselines × 8 metrics), using 10,000 bootstrap resamples with the add-one convention p = (k+1)/(B+1). The smallest attainable raw p-value is therefore 1/10,001 ≈ 0.0001, which Holm scales to 112 × 0.0001 = 0.0112; entries equal to 0.0112 are comparisons where no resample favored the baseline, so their true p-value is below this resolution limit.
| Model | ICU-Readmit 30d AUROC | ICU-Readmit 30d AUPRC | In-hospital Mortality AUROC | In-hospital Mortality AUPRC | Long LOS 7d AUROC | Long LOS 7d AUPRC | 1YR Mortality AUROC | 1YR Mortality AUPRC |
|---|---|---|---|---|---|---|---|---|
| DescEmb I | 0.0112 | 0.0117 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| DescEmb II | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| GenHPF | 0.0112 | 0.2395 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| REMed | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| Med-BERT | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| CEHR-BERT | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| BEHRT | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| Hi-BEHRT | 0.0112 | 0.0117 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| EHRMamba | 0.0112 | 0.0117 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| ModernBERT | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| Longformer | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| BigBird | 0.0490 | 0.0738 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| RoFormer | 0.0112 | 0.0652 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
| RoBERTa | 0.0117 | 0.0738 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 | 0.0112 |
Response to Reviewer xmev comments (9/13), (10/13), and (11/13)
Comment (9/13):
Table 5 shows prototype assignments operating at about 99% of maximum entropy, meaning the weights are nearly uniform, which sits awkwardly with the claim that prototypes meaningfully guide retrieval.
The entropy in Table 5 is that of the batch-averaged prototype assignment, the quantity our usage regularizer maximizes. Hence, a value near ln K means that all prototypes are used, not that every chunk receives the same weight. The corrected values in Table 5 above show the difference: without the regularizer (×), the assignments collapse (a single prototype takes 63% of the query mass, with entropy 1.557) and performance drops (0.715/0.118); with it (✓), the usage is balanced across the 64 prototypes (entropy 4.149 and 4.155, close to ln 64 = 4.159) and performance improves (0.750/0.141). Near-maximal entropy is therefore the intended healthy outcome, and the failure case is the low-entropy collapse. The chunk weights are a separate quantity, computed from the agreement between the query and chunk assignments. We will clarify in the Table 5 caption that the entropies are computed on the batch-averaged assignments.
Comment (10/13):
No seeds or error bars are reported anywhere, and the prototype-attribution gain (AUROC 0.008-0.015) is smaller than the spread of the prototype-count sweep itself (0.018 in S12), so the benefit of the central mechanism is within run-to-run variation.
Comment (11/13):
Please report seeds and mean +/- SD for Tables 1-3
We ran new experiments and now report mean ± SD over 3 random seeds for Tables 1–3 of the manuscript, with the hyperparameters of each model fixed to its best configuration.
Updated Table 1: Performance on the four MIMIC-IV tasks (test set). AUROC and AUPRC, reported as mean ± SD over 3 random seeds, with the hyperparameters of each model fixed to its best configuration.
| Model | ICU AUROC | ICU AUPRC | In-hospital AUROC | In-hospital AUPRC | Long LOS AUROC | Long LOS AUPRC | 1-year AUROC | 1-year AUPRC |
|---|---|---|---|---|---|---|---|---|
| DescEmb I | ||||||||
| DescEmb II | ||||||||
| GenHPF | ||||||||
| Med-BERT | ||||||||
| REMed | ||||||||
| CEHR-BERT | ||||||||
| BEHRT | ||||||||
| Hi-BEHRT | ||||||||
| EHRMamba | ||||||||
| ModernBERT | ||||||||
| Longformer | ||||||||
| BigBird | ||||||||
| RoFormer | ||||||||
| RoBERTa | ||||||||
| EHR-RAGp |
Response to Reviewer xmev comments (11/13), (12/13), and (13/13)
Comment (11/13): Continued
Updated Table 3: Performance on the four MIMIC-IV tasks (test set) for existing baselines with/without EHR-RAGp. AUROC and AUPRC, reported as mean ± SD over 3 random seeds, with the hyperparameters of each model fixed to its best configuration.
| Model | EHR-RAGp | ICU AUROC | ICU AUPRC | In-hospital AUROC | In-hospital AUPRC | Long LOS AUROC | Long LOS AUPRC | 1-year AUROC | 1-year AUPRC |
|---|---|---|---|---|---|---|---|---|---|
| Med-BERT | x | ||||||||
| Med-BERT | ✓ | ||||||||
| CEHR-BERT | x | ||||||||
| CEHR-BERT | ✓ | ||||||||
| BEHRT | x | ||||||||
| BEHRT | ✓ | ||||||||
| Hi-BEHRT | x | ||||||||
| Hi-BEHRT | ✓ |
New Supplementary Table: EHRSHOT results for EHR-RAGp with AUROC reported as mean ± SD over 3 random seeds, with the hyperparameters of each model fixed to its best configuration.
| ICU | LLOS | RA | MI | LP | HL | HT | CEL | PC |
|---|---|---|---|---|---|---|---|---|
Comment (12/13):
Does the removal of billing codes extend to DRG codes, and can discharge-coded events that postdate the query time leak into the retrieved context?
For leakage prevention, we exclude all kinds of billing codes that exist in the dataset from appearing in the query segment that serves as a direct input to our model and all baselines, including DRG codes. We have made this statement more clear in Section B.5 Leakage Prevention as follows:
(3) We examine each query if its contents could include any billing codes that might leak labels. Billing codes accounted for are ICD diagnosis codes, ICD procedure codes, DRG codes, as well as MEDS specific codes (i.e. MEDS_DEATH code). ”
Comment (13/13):
What is the code/data URL? The current "link" placeholder prevents verification.
The anonymized code repository is already linked in the manuscript: the word “link” in the contribution section (page 2) is a clickable hyperlink to https://anonymous.4open.science/r/EHR-RAGp-5857. We have now included the URL in full in the text and in the Reproducibility Statement, so that it is also visible in printed copies. We hope these additions address the reviewer’s concerns. We would be grateful if the reviewer would consider revising their score and we are happy to answer any further questions.
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 1/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
The paper introduces EHR-RAGp, a retrieval-augmented framework for long-horizon structured EHR modeling. The patient timeline is partitioned into multi-granular chunks. A frozen MLM-pretrained EHR encoder selects top- candidate chunks via cosine similarity to the current visit's query segment. A learnable set of prototypes assigns soft weights to these candidates using asymmetric temperatures and cross-entropy agreement. The weighted chunks and query are then fused via a shallow transformer for downstream binary prediction (trained via BCE + entropy regularization). Evaluated across 4 MIMIC-IV and 9 EHRSHOT tasks, EHR-RAGp improves over a RoBERTa backbone and enhances four existing EHR models.
Strengths
- Plug-and-Play Generalizability: EHR-RAGp consistently boosts performance across 32 model/task/metric combinations when added to Med-BERT, CEHR-BERT, BEHRT, and Hi-BEHRT (supported by paired bootstrap tests). This strongly validates the benefit of integrating long-horizon history.
- Rigorous MIMIC-IV Protocol: Re-training baselines on a unified feature set with bootstrap CIs ensures reliable within-paper comparisons.
Weaknesses
- Unjustified Prototype Reranking Mechanism: The prototype module operates purely as a re-weighting layer over a fixed candidate set without influencing candidate selection. It lacks comparison against natural weighting/reranking baselines: (a) LLM-as-a-reranker over serialized chunks, (b) retriever cosine similarity scores, or (c) uniform weighting relying solely on the fusion transformer's attention. Case studies (Figs S5–S6) reveal that most retrieved chunks originate from the current visit, raising concerns that a trivial recency baseline could achieve similar gains. Zero-shot small LLMs in Table S5 fail to address LLM reranking capabilities. Furthermore, labeling the framework "end-to-end" is an overstatement since gradients do not flow to retrieval selection.
- Incomplete Baseline Comparisons:
- Missing Modern SOTA: Lacks comparisons against generative EHR foundation models like ETHOS (open-source, MIMIC-IV pretrained) and competitive tree models (e.g., Count-based GBM from EHRSHOT).
- Unclear Protocol Details: EHRSHOT long-context results are directly copied without paired tests, and baseline context budgets (e.g., ModernBERT's 8K capacity) are omitted, making fair comparison unclear.
Questions for the authors
- Reranking Baseline & Efficiency: Holding the top- candidates and backbone fixed, how does prototype weighting perform against:
- (a) An LLM reranker scoring serialized chunk relevance?
- (b) Direct query–chunk cosine similarity weighting?
- (c) Uniform weighting with standard fusion transformer attention?
- Please provide relative compute/latency costs.
- Retrieval Analysis & Recency: How do random and recency-based chunk selection compare to EHR-RAGp? What percentage of retrieved chunks actually originate from prior visits vs. the current visit across the test set?
- Ablation Setup: How is "w/o Prototypes" specifically implemented (unweighted fusion, similarity-weighted, or otherwise)?
- Additional Baselines: Can you evaluate ETHOS, Count-based GBM, and REMed (in its native setup), while explicitly reporting the exact token/context length assigned to every baseline?
- Inconsistencies & Data Discrepancies:
- Table S11 columns appear mislabeled (In-Hospital Mortality instead of ICU Readmission / 1-year Mortality).
- Table S12 reports 0.744/0.139 for 64 prototypes on ICU readmission, contradicting Table S4 (selected config) and Table 1 (0.750/0.141).
- in Table S4 falls outside the search space listed in Table S3.
- Are reported main results from a single run or the best across multiple seeds?
- Literature (Suggestion): Please cite and discuss EHR-RAG (arXiv:2601.21340), which addresses a very similar topic with identical nomenclature.
9 comments
Response to Reviewer 9FsW comments (1/15), (2/15), and (3/15)
We thank Reviewer 9FsW for the careful review. We appreciate that the reviewer recognizes the plug-and-play generalizability of EHR-RAGp: it consistently improves performance in all 32 model/task/metric combinations when added to Med-BERT, CEHR-BERT, BEHRT, and Hi-BEHRT (supported by paired bootstrap tests), which supports the benefit of integrating long-horizon patient history. We also appreciate the reviewer’s recognition of our MIMIC-IV protocol, in which all baselines are re-trained on a unified feature set with bootstrap confidence intervals, ensuring reliable within-paper comparisons.
Comment (1/15)
I have significant concerns about the paper’s soundness that do not appear easy to address.
We have addressed each of the soundness concerns raised:
- We added chunk-weighting baselines (self-attention, uniform, cosine similarity) with their compute costs, and a pilot cost study of an LLM reranker.
- We clarified the intended objective of the LLM zero-shot results.
- We revised the use of the term “end-to-end”.
- We clarified the setup of EHRSHOT results.
- We ran experiments with matched context budgets, and stated the context budget of every baseline.
- We clarified the ablation set up. 7.We fixed some inconsistencies flagged by the reviewer.
- We reported mean ± SD over 3 seeds for the main results.
- We added random and recency chunk-selection analyses, and the share of retrieved chunks from the current and prior visits.
- We added a count-based GBM baseline on MIMIC-IV and EHRSHOT, and clarified that REMed was run in its native form.
- We explained why ETHOS could not yet be run, and discussed the related EHR-RAG preprint.
We hope these revisions resolve the reviewer’s concerns about soundness. Each revision is described in more detail below.
Comment (2/15)
Zero-shot small LLMs in Table S5 fail to address LLM reranking capabilities.
We thank the reviewer for this comment. Table S5 was not intended to evaluate LLM reranking. It reports zero-shot LLMs used as direct outcome predictors, as supplementary context, and these models are not part of any comparison in the main paper. The protocol in the appendix describes them as predictors, and we make no claim about their reranking ability. We address LLM reranking directly in our response to your other reranking-baseline question, where an LLM scores the relevance of each retrieved chunk under a protocol of its own. We will also state this explicitly in the updated manuscript to clarify the purpose of Table S5.
Comment (3/15)
Furthermore, labeling the framework "end-to-end" is an overstatement since gradients do not flow to retrieval selection.
We clearly state in Figure 1 and Section 3 that the retriever R is frozen and that the search indices are precomputed apriori. By “end-to-end” we mean that the backbone encoder, the prototype module and the fusion module are trained jointly from the task loss, with gradients flowing through all of them. Keeping the retriever fixed is a deliberate design choice, since it allows a precomputed index and constant-cost inference. To remove any ambiguity, we will describe the stage as “end-to-end fine-tuning with a frozen retriever” throughout the paper.
Response to Reviewer 9FsW comments (4/15) and (5/15)
Comment (4/15)
Unclear Protocol Details: EHRSHOT long-context results are directly copied without paired tests,
We thank the reviewer for this comment. We would like to indicate that EHRSHOT [1] is a standardized benchmark published in the NeurIPS Datasets and Benchmarks Track. The benchmark provides fixed patient splits, task definitions, and an evaluation protocol precisely so that results from different groups are directly comparable. To ensure consistency with their baselines, we used their provided config files (official data, splits, and evaluation protocol without modification) and we used their provided pretrained CLMBR checkpoint.
This way we ensured that EHR-RAGp is built on the same pretrained model that the leaderboard reports. The CLMBR baseline results are taken from the benchmark’s public leaderboard, and the long-context results from the Context Clues study [2] (ICLR 2025), a peer-reviewed evaluation of long-context models using the same config.
The purpose of a benchmark is to avoid re-implementation differences, and re-running published models in-house would risk introducing deviations from the reported protocol. We therefore report the published numbers and cite their source. We also made a clear statement that these comparisons are descriptive in: “we make no claim of superiority or statistical significance on EHRSHOT”. Our goal was to show how EHR-RAGp compares with models trained on long contexts as a secondary analysis. We agree that this was not clear in the paper, so we added a clear statement.
References
[1] Wornow M, Thapa R, Steinberg E, Fries J, Shah N. Ehrshot: An ehr benchmark for few-shot evaluation of foundation models. Advances in Neural Information Processing Systems. 2023 Dec 15;36:67125-37.
[2] Wornow M, Bedi S, Fuentes Hernandez MA, Steinberg E, Fries J, Ré C, Koyejo S, Shah N. Context clues: evaluating long context models for clinical prediction tasks on EHR data. In International Conference on Learning Representations 2025 May 1 (Vol. 2025, pp. 16518-1)
Comment (5/15)
Baseline context budgets (e.g., ModernBERT's 8K capacity) are omitted, making fair comparison unclear.
We agree that the baselines’ context budgets were not stated clearly. The budgets are 512 for DescEmb, GenHPF, Med-BERT, CEHR-BERT and BEHRT; 1,024 for Hi-BEHRT, Longformer, BigBird and RoFormer; 2,048 for EHRMamba; and 4,096 for ModernBERT, whose native capacity is 8K. REMed reads the full history and selects 128 events from it. EHR-RAGp uses the same 512-event query segment as the 512-token baselines, and adds retrieved history of up to 24 chunks of 256 tokens from earlier in the timeline. The comparison therefore contrasts two ways of using more than the most recent window: reading a longer contiguous window (the 1,024 to 4,096 baselines) against retrieving the relevant older segments.
We conducted a new analysis to assess performance with a matched budget (Table 1 below), with EHR-RAGp and ModernBERT as a long-context baseline, at the same context budget of 6,656 tokens (EHR-RAGp’s maximum: 512 query + 24 × 256 retrieved tokens). We chose ModernBERT because it’s the only baseline that can handle up to 8K tokens at once. Both models run on the same GPU (A100 80GB) with BF16 mixed precision, the SGD optimizer, up to 75 epochs, with each model at its best hyperparameters. Batch size of 12 for ModernBERT is the maximum that can fit in the GPU memory, whereas batch size of 24 for EHR-RAGp is the same used during training. Overall, EHR-RAGp achieves a better performance. The new Table (1) will be added to the main results section and the new Table (2) with detailed per task results will be added to the appendix. We will also add the context budgets of all models as supplementary information.
Table (1): Controlled comparisons under matched context length, parameter budget and computational setting.
| Model | Input tokens | Max batch size | Params (M) | GPU | Precision | Optimizer | Max Epochs | Train time per epoch (min) | Mean Runtime (h) | Inference latency (ms/example) | Peak GPU Mem. (Training) (GB) | Peak GPU Mem. (Inference, per example) (GB) | Mean AUROC (macro) | Mean AUPRC (macro) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ModernBERT | 6,656 | 12 | 148 | A100 80GB | BF16 mixed | SGD | 75 | 213 | 46.25 | 281 | 74.6 | 1.460 | 0.786 | 0.384 |
| EHR-RAGp | 6,656 | 24 | 137 | A100 80GB | BF16 mixed | SGD | 75 | 38 | 13.4 | 83 | 65.4 | 0.881 | 0.855 | 0.488 |
Response to Reviewer 9FsW comments (5/15), (6/15), (7/15), and (8/15)
Comment (5/15): Continued
-
Parameter budget: EHR-RAGp has 137M effective parameters (fusion module and prototypes included) compared to 148M for ModernBERT encoder, excluding the default text embedding layer. The EHR embedding Layer is identical for both models, which account for 37M parameters summed to the earlier mentioned effective parameters.
-
Computational settings: EHR-RAGp is much cheaper. It trains 5.6× faster per epoch (38 vs. 213 min) with a mean total runtime of 13.4 vs. 46.25 hours, runs inference 3.4× faster (83 vs. 281 ms per example), and uses less memory in both training (65.4 vs. 74.6 GB, at twice the batch size) and inference (0.881 vs. 1.46 GiB). It is worth noting that building the retrieval index (chunking and encoding each stay’s history with the frozen retriever) takes roughly 57 ms per stay on an A100 a one-time offline cost that is not included in the reported 83 ms inference latency.
-
Performance: At this matched budget, EHR-RAGp reaches a macro-average AUROC/AUPRC of 0.855/0.488, against 0.786/0.384 for ModernBERT.
Table (2): Per-task performance comparison between EHR-RAGp and ModernBERT at matched budgets across all tasks.
| Model | Input tokens | ICU Readmission AUROC | ICU Readmission AUPRC | In-Hospital Mortality AUROC | In-Hospital Mortality AUPRC | Long LOS AUROC | Long LOS AUPRC | 1-Year Mortality AUROC | 1-Year Mortality AUPRC |
|---|---|---|---|---|---|---|---|---|---|
| ModernBERT | 6,656 | 0.638 | 0.071 | 0.921 | 0.659 | 0.827 | 0.437 | 0.759 | 0.369 |
| EHR-RAGp | 6,656 | 0.750 | 0.141 | 0.950 | 0.736 | 0.867 | 0.509 | 0.853 | 0.564 |
Comment (6/15)
Ablation Setup: How is "w/o Prototypes" specifically implemented (unweighted fusion, similarity-weighted, or otherwise)?
“w/o Prototypes” is self-attention. The fusion transformer’s own self-attention is the only thing that weighs the chunks.
Comment (7/15)
Table S11 columns appear mislabeled (In-Hospital Mortality instead of ICU Readmission / 1-year Mortality).
Thanks for spotting this. The results shown in Table S11, second task, are intended for In-Hospital Mortality, not 1-Year Mortality. We fixed this by updating the column names.
Comment (8/15)
Table S12 reports 0.744/0.139 for 64 prototypes on ICU readmission, contradicting Table S4 (selected config) and Table 1 (0.750/0.141). in Table S4 falls outside the search space listed in Table S3.
We thank the reviewer for raising this inconsistency.
-
We double-checked the best configuration of each task and found that the entries in Table S4 were mistakenly reported while copying them. The correct values of Ts for the 1-Year Mortality and In-Hospital Mortality tasks are 0.2 and 0.25. These have been corrected in Table S4.
-
These corrections agree with results reported in Table S13.
-
We also updated Table S12.
Updates to Table S4: Best configuration selected for 1-year mortality and In-hospital Mortality after hyperparameter optimization.
| Hyperparameter | In-hospital Mortality | 1YR Mortality |
|---|---|---|
| Chunking Strategy | Event-Based | Care-Stage |
| Prototype count | 256 | 512 |
| Weighting temperature () | 0.25 | 0.2 |
| Usage penalty () | 0.005 | 0.006 |
| Learning rate | ||
| Weight decay |
Updated Table S13: Effect of the softmax temperature on model performance.
| 1-Year Mortality AUROC | 1-Year Mortality AUPRC | In-Hospital Mortality AUROC | In-Hospital Mortality AUPRC | |
|---|---|---|---|---|
| 0.10 | 0.845 | 0.540 | 0.947 | 0.728 |
| 0.15 | 0.852 | 0.552 | 0.948 | 0.730 |
| 0.20 | 0.853 | 0.564 | 0.948 | 0.732 |
| 0.25 | 0.851 | 0.553 | 0.950 | 0.736 |
Updated Table S12: Ablation of the number of prototypes.
| # Prototypes | ICU Readmission 30d AUROC | ICU Readmission 30d AUPRC | 1-Year Mortality AUROC | 1-Year Mortality AUPRC |
|---|---|---|---|---|
| 64 | 0.750 | 0.141 | 0.850 | 0.558 |
| 128 | 0.747 | 0.137 | 0.851 | 0.551 |
| 256 | 0.743 | 0.135 | 0.849 | 0.554 |
| 512 | 0.739 | 0.129 | 0.853 | 0.564 |
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
The authors introduce a retrieval-based framework to integrate the most relevant patient history. It first estimates the relevance of retrieved historical chunks and uses a prototype-guided retrieval module that acts as an alignment mechanism and uses the features for EHR prediction.
Strengths
The research is quite interesting, as longitudinal EHRs are irregular, heterogeneous, and can exceed model context limits. Retrieving historical information specific to each patient before using it for prediction is computation efficient and useful.
Weaknesses
For me, it is not clear if the performance gain is from the proposed mechanism or from other factors. e.g., Table 4 shows that much of the improvement comes from introducing retrieval alone, while prototype-guided alignment provides relatively modest additional gains.
The fundamental novelty is not clear. The proposed framework mainly combines prototype-based representation learning, similarity-based weighting, and transformer fusion. Some related work, e.g., REMed, did similar things. The cross-entropy alignment is equivalent to KL-divergence-based weighting after softmax normalization.
The comparison is not fair enough to validate the effectiveness of the proposal. EHR-RAGp accesses additional historical information and introduces an extra fusion module, whereas many baselines operate on restricted input sequences.
Questions for the authors
-
Could the authors compare it with simpler alternatives, such as standard attention, cosine-similarity weighting, and uniform aggregation?
-
Could the authors provide comparisons under matched context lengths, parameter budgets, and computational settings?
-
Could the authors report training and inference costs, memory consumption, and scalability with increasing history length?
4 comments
Response to Reviewer sH3K comments (1/6) and (2/6)
We would like to thank Reviewer sH3K for the careful review and constructive feedback. We appreciate that the reviewer finds our submitted paper (i) interesting (ii) with minor and fixable concerns (iii) and targets the challenge of longitudinal, irregular, and heterogeneous EHR data that can exceed the context limits of existing models. We also appreciate that the reviewer recognizes that retrieving patient-specific history for a prediction is computationally efficient and useful, which is the main motivation behind EHR-RAGp. In summary, we conducted new experiments and added matched-budget comparison, weighting ablation, cost/scalability analysis.
Comment (1/6):
For me, it is not clear if the performance gain is from the proposed mechanism or from other factors. e.g., Table 4 shows that much of the improvement comes from introducing retrieval alone, while prototype-guided alignment provides relatively modest additional gains.
We agree that retrieving patient-specific history accounts for most of the improvement, and this is a central contribution of EHR-RAGp so it is not a weakness. We present EHR-RAGp as an integrated system, with prototype refinement on top of retrieval. Table 4 shows that retrieval provides the largest gains, while the full model achieves a further statistically significant improvement over the ablation without prototypes (p<0.05 for both tasks and across AUROC/AUPRC). These results support both the value of patient-specific retrieval and the additional benefit of incorporating prototypes. We now have two new experiments that address this more: the matched-budget comparison and the weighting ablation (described in more detail to specific questions below).
Comment (2/6):
The fundamental novelty is not clear. The proposed framework mainly combines prototype-based representation learning, similarity-based weighting, and transformer fusion. Some related work, e.g., REMed, did similar things. The cross-entropy alignment is equivalent to KL-divergence-based weighting after softmax normalization.
Although we agree that individual components such as retrieval, chunking, and prototype-based weighting have been explored independently in other domains, our contribution is not the introduction of these components in isolation, but rather their integration into a patient-specific retrieval framework for structured longitudinal EHR modeling, where retrieval must operate over heterogeneous, irregular, and temporally evolving clinical event sequences.
REMed is the closest approach to our work, and is included in our list of baselines. However, REMed scores individual events sampled randomly (128 events max) in a text-based setup, while EHR-RAGp retrieves query-conditioned history segments from code-based timelines exploring four chunking strategies. Furthermore, EHR-RAGp significantly improves over REMed as indicated in Table 1 and Table S10. Summary (Ours vs REMed):
- ICU readmission 0.750 vs 0.561 AUROC and 0.141 vs 0.060 AUPRC
- In-hospital mortality 0.950 vs 0.865 AUROC and 0.736 vs 0.501 AURPC
- Long LoS 7d 0.867 vs 0.786 AUROC and 0.509 vs 0.348 AUPRC
- 1-Year mortality 0.853 vs 0.680 AUROC and 0.564 vs 0.280 AUPRC
We also agree that the cross-entropy alignment is equivalent to KL-divergence weighting after softmax normalization, since the query entropy is constant across chunks and cancels out. This intends to learn a prototype space with asymmetric query/history temperatures and a usage regularizer that prevents prototype collapse. We have noted this in the updated manuscript.
Response to Reviewer sH3K comments (3/6) and (4/6)
Comment (3/6):
The comparison is not fair enough to validate the effectiveness of the proposal. EHR-RAGp accesses additional historical information and introduces an extra fusion module, whereas many baselines operate on restricted input sequences.
Comment (4/6):
Could the authors provide comparisons under matched context lengths, parameter budgets, and computational settings?
We acknowledge that EHR-RAGp accesses historical information and introduces an extra fusion module. We believe that this is an advantage of our proposed work, which is designed to retrieve historical information from the patient's own history. This is opposed to existing clinical baselines, which handle fixed clinical context and rely on feature selection or regular sampling to manage the context. Hence, our proposed work presents itself as a solution to these limitations and allows for extended information usage.
First, the results on the EHRSHOT benchmark compare EHR-RAGp with long-context baselines (4k - 16k), where EHR-RAGp achieves comparable or better performance.
Second, we conducted a new analysis (Table 1 below) to compare EHR-RAGp to ModernBERT as a long-context baseline, at the same context budget of 6,656 tokens (EHR-RAGp’s maximum: 512 query + 24 × 256 retrieved tokens). We chose ModernBERT because it’s the only baseline that can handle up to 8192 tokens at once. Both models run on the same GPU (A100 80GB) with BF16 mixed precision, the SGD optimizer, up to 75 epochs, with each model at its best hyperparameters. Batch size of 12 for ModernBERT is the maximum that can fit in the GPU memory, whereas batch size of 24 for EHR-RAGp is the same used during training. Overall, EHR-RAGp achieves a better performance. The new Table (1) will be added to the main results section and the new Table (2) with detailed per task results will be added to the appendix.
Table (1): Controlled comparisons under matched context length, parameter budget and computational setting.
| Model | Input tokens | Max batch size | Params (M) | GPU | Precision | Optimizer | Max Epochs | Train time per epoch (min) | Mean Runtime (h) | Inference latency (ms/example) | Peak GPU Mem. (Training) (GB) | Peak GPU Mem. (Inference, per example) (GB) | Mean AUROC (macro) | Mean AUPRC (macro) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ModernBERT | 6,656 | 12 | 148 | A100 80GB | BF16 mixed | SGD | 75 | 213 | 46.25 | 281 | 74.6 | 1.460 | 0.786 | 0.384 |
| EHR-RAGp | 6,656 | 24 | 137 | A100 80GB | BF16 mixed | SGD | 75 | 38 | 13.4 | 83 | 65.4 | 0.881 | 0.855 | 0.488 |
-
Parameter budget: EHR-RAGp has 137M effective parameters (fusion module and prototypes included) compared to 148M for ModernBERT encoder, excluding the default text embedding layer. The EHR embedding Layer is identical for both models, which account for 37M parameters summed to the earlier mentioned effective parameters.
-
Computational settings: EHR-RAGp is much cheaper. It trains 5.6× faster per epoch (38 vs. 213 min) with a mean total runtime of 13.4 vs. 46.25 hours, runs inference 3.4× faster (83 vs. 281 ms per example), and uses less memory in both training (65.4 vs. 74.6 GB, at twice the batch size) and inference (0.881 vs. 1.46 GiB). It is worth noting that building the retrieval index (chunking and encoding each stay’s history with the frozen retriever) takes roughly 57 ms per stay on an A100 a one-time offline cost that is not included in the reported 83 ms inference latency.
-
Performance: At this matched budget, EHR-RAGp reaches a macro-average AUROC/AUPRC of 0.855/0.488, against 0.786/0.384 for ModernBERT.
Table (2): Per-task performance comparison between EHR-RAGp and ModernBERT at matched budgets across all tasks.
| Model | Input tokens | ICU Readmission AUROC | ICU Readmission AUPRC | In-Hospital Mortality AUROC | In-Hospital Mortality AUPRC | Long LOS AUROC | Long LOS AUPRC | 1-Year Mortality AUROC | 1-Year Mortality AUPRC |
|---|---|---|---|---|---|---|---|---|---|
| ModernBERT | 6,656 | 0.638 | 0.071 | 0.921 | 0.659 | 0.827 | 0.437 | 0.759 | 0.369 |
| EHR-RAGp | 6,656 | 0.750 | 0.141 | 0.950 | 0.736 | 0.867 | 0.509 | 0.853 | 0.564 |
Response to Reviewer sH3K comments (5/6) and (6/6)
Comment (5/6):
Could the authors compare it with simpler alternatives, such as standard attention, cosine-similarity weighting, and uniform aggregation?
We thank the reviewer for this suggestion. We conducted new analysis accordingly (see new Table 3 below). All variants use the same retrieved top-M chunks, backbone, fusion transformer, and differ only in how the chunks are weighted:
- Standard self-attention: This is the “w/o Prototypes” setting mentioned in the original Table 4 in the submitted manuscript.
- Uniform aggregation: Every valid chunk gets equal weight of 1/M.
- Cosine-similarity weighting: A softmax over the retriever’s query–chunk cosine scores, with the temperature tuned over the same grid as EHR-RAGp.
- EHR-RAGp: Prototype weighting mechanism.
Results are mean ± SD over 3 seeds on all four tasks. Prototype weighting gives the best average AUROC/AUPRC (0.854/0.487), against 0.844/0.463 for attention only, 0.833/0.447 for uniform and 0.839/0.463 for cosine similarity. The learned prototype weighting achieves the best performance in most tasks and metrics, and a comparable performance to cosine similarity in long length of stay. No single simple alternative is consistently second. These results will be added to the ablations section (extension of the original Table 4).
Table (3): Comparison of chunk-weighting strategies (mean ± SD over 3 seeds).
| Weighting | ICU Readmission AUROC | ICU Readmission AUPRC | In-Hospital Mortality AUROC | In-Hospital Mortality AUPRC | Long LOS AUROC | Long LOS AUPRC | 1-Year Mortality AUROC | 1-Year Mortality AUPRC | Mean AUROC | Mean AUPRC |
|---|---|---|---|---|---|---|---|---|---|---|
| Self-attention | ||||||||||
| Uniform () | ||||||||||
| Cosine similarity | ||||||||||
| Prototype (EHR-RAGp) |
Comment (6/6):
Could the authors report training and inference costs, memory consumption, and scalability with increasing history length? We thank the reviewer for this question.
Training and inference costs (Table 1). On an A100 80GB with BF16, EHR-RAGp trains at 38 min per epoch (mean total runtime 13.4 hours per task), using 65.4 GB of GPU memory at batch size 24. At inference, it takes 83 ms and 0.88 GiB per example at batch size 1.
Scalability (Table 4). We grouped test stays by the number of chunks in their history (from ≤24 to >100) and measured each stage of inference. The forward pass (about 83 ms) and peak memory (0.88 GiB) stay constant, because the model always encodes a fixed maximum number of retrieved chunks (M=24) regardless of the number of chunks available. FAISS search grows only from 0.03 to 0.08 ms, and online chunking, the only component that scales with history, from 0.4 to 13.7 ms. These results will be added to the appendix of the main paper.
Table (4): Scalability with increasing history length.
| History group (chunks) | FAISS search latency (ms) | Online chunking latency (ms) | Forward latency (ms/example) | Peak GPU inference memory (GiB) |
|---|---|---|---|---|
| ≤24 | 0.028 ± 0.003 | 0.368 ± 0.225 | 83.491 ± 0.545 | 0.881 |
| 25–50 | 0.035 ± 0.006 | 1.112 ± 0.638 | 83.747 ± 0.568 | 0.882 |
| 51–100 | 0.046 ± 0.009 | 3.132 ± 1.640 | 83.652 ± 0.532 | 0.882 |
| >100 | 0.075 ± 0.021 | 13.675 ± 17.782 | 83.107 ± 0.799 | 0.881 |
We hope these additions address the reviewer’s concerns. We would be grateful if the reviewer would consider revising their score and we are happy to answer any further questions.
Dear authors, I appreciate your response to my questions as well as the newly added experiment. I agree that this is an interesting paper but I feel that there is a lot of content and experiments that need to be clarified and revised. I therefore keep my original rating and suggest that you carefully revise your paper for future submission.
Comments on the paper
1 comment
Summary of the rebuttal and updates (Submission #9518)
Dear PC, SAC, AC, and Reviewers,
We sincerely thank the reviewers for their constructive feedback, which has strengthened the manuscript. We are encouraged that the reviewers found the problem important and the approach useful: retrieving patient-specific history for long, irregular and heterogeneous EHRs. They also recognized EHR-RAGp’s consistent gains across 32 model/task/metric combinations when added to existing EHR models, the rigorous MIMIC-IV protocol, and our attention to data-leakage prevention.
Based on your feedback, we have made the following updates to the manuscript:
-
Matched budget comparison: We added a matched-budget comparison with ModernBERT at the same context length (6,656 tokens), GPU and precision, together with training and inference costs. We also stated the context budget of every baseline and added a scalability analysis with increasing history length. We also clarified the breadth of baseline chosen for comparison.
-
Statistical reporting: We now report mean ± SD over 3 seeds for the main results (Tables 1–3 and EHRSHOT), and applied Holm correction across all 112 significance tests, where 108 comparisons remain significant.
-
Weighting analysis: We added comparisons of prototype weighting against various common sense weighting mechanisms including: self-attention, uniform and cosine-similarity weighting, with compute and latency costs as requested by the reviewers.
-
Retrieval analysis: We added random and recency chunk-selection comparisons in the same pipeline, and the proportions of retrieved chunks coming from prior versus current visits for each chunking strategy and prediction window.
-
Corrections and clarifications: We corrected the reporting inconsistencies in Tables S4, S11, S12 and Table 5, clarified how prototype entropy is computed, and stated that DRG codes are excluded from the inputs. We also clarified the use of “end-to-end”, the purpose of the zero-shot LLM results, the EHRSHOT protocol, and added the full code URL.
-
Additional baselines: We added a count-based GBM on MIMIC-IV and EHRSHOT, and clarified that REMed was run in its native form. We explain why ETHOS could not yet be evaluated on our cohort: the public weights rest on a different patient split, data version and tokenization, which could introduce leakage. ETHOS-ARES does not release weights. We discuss ETHOS and the EHR-RAG preprint in the related work.
All changes are incorporated in the updated manuscript and described in detail in our point-by-point responses. We are pleased that Reviewer xmev has confirmed they read the response and has no further questions. We remain available to address any further questions/concerns from the other reviewers and the AC.
Thank you again for your time and dedication in reviewing our submission.
Sincerely, The Authors
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Response to Reviewer xmev comments (1/13), (2/13), (3/13), (4/13), (5/13), and (6/13)
We thank Reviewer xmev for the constructive feedback. We are glad that the reviewer appreciates our attention to data-leakage hygiene.
Comment (1/13):
We have addressed each of the soundness concerns raised:
Comment (2/13):
Comment (3/13):
Comment (4/13):
We thank the reviewer for raising this inconsistency.
Updates to Table S4: Best configuration selected for 1-year mortality and In-hospital Mortality after hyperparameter optimization.
Updated Table S13: Effect of the softmax temperature on model performance.
Updated Table S12: Ablation of number of prototypes.
Comment (5/13):
Comment (6/13):
The ICU entropy entries in Table 5 were left over from an earlier 512-prototype run, which is why they exceeded ln 64. We corrected them and they are consistent with all performance results: the ICU configuration uses 64 prototypes, and the entropies are now 4.149 and 4.155 (maximum ln 64 = 4.159). Corrections are shown below for updated rows in Table 5.
Updated rows in Table 5: Ablation of usage regularization on ICU 30-day readmission.