EHR-RAG: Bridging Long-Horizon Structured Electronic Health Records and Large Language Models via Enhanced Retrieval-Augmented Generation
Lang Cao, Qingyu Chen, Yue Guo · 2026
Read EHR-RAG: Bridging Long-Horizon Structured Electronic Health Records and Large Language Models via Enhanced Retrieval-Augmented Generation by Lang Cao, Qingyu Chen, Yue Guo (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-21340.txt.
Introduction
Lang Cao, Qingyu Chen, and Yue Guo help language models use long patient records without losing key facts. Health records hold rich evidence spread over years of visits. That history often runs past what a model can read at once, and simple search can drop vital events or their order.
Their system improves retrieval for long records before the model answers. It keeps clinical events and their timing in view rather than chopping the record blindly. Better grounding should mean answers that rest on the patient's real history. The work targets safer, more faithful AI help in medical decisions.
Catalog record
| CREATOR | Lang Cao, Qingyu Chen, Yue Guo |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 64 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2601-21340
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
EHR-RAG: Bridging Long-Horizon Structured Electronic Health Records and Large Language Models via Enhanced Retrieval-Augmented Generation Lang Cao, Qingyu Chen, Yue Guo Abstract Electronic Health Records (EHRs) provide rich longitudinal clinical evidence that is central to medical decision-making, motivating the use of retrieval-augmented generation (RAG) to ground large language model (LLM) predictions. However, long-horizon EHRs often exceed LLM context limits, and existing approaches commonly rely on truncation or vanilla retrieval strategies that discard clinically relevant events and temporal dependencies. To address these challenges, we propose EHR-RAG , a retrieval-augmented framework designed for accurate interpretation of long-horizon structured EHR data. EHR-RAG introduces three components tailored to longitudinal clinical prediction tasks: Event- and Time-Aware Hybrid EHR Retrieval to preserve clinical structure and temporal dynamics, Adaptive Iterative Retrieval to progressively refine queries in order to expand broad evidence coverage, and Dual-Path Evidence Retrieval and Reasoning to jointly retrieves and reasons over both factual and counterfactual evidence. Experiments across four long-horizon EHR prediction tasks show that EHR-RAG consistently outperforms the strongest LLM-based baselines, achieving an average Macro-F1 improvement of 10.76%. Overall, our work highlights the potential of retrieval-augmented LLMs to advance clinical prediction on structured EHR data in practice. 1 Introduction Electronic Health Records (EHRs) are digital longitudinal patient records composed of structured clinical events such as diagnoses, medications, laboratory results, and procedures. Unlike free-text clinical notes, structured EHR data are systematically collected, standardized across care settings, and less subjective in description, making them a reliable and widely available foundation for clinical decision making ( 43 ; 16 ) . Beyond individual events, structured EHRs encode rich temporal and categorical information, including event types, ordering, recurrence patterns, and long-term clinical trajectories, that underpins clinical decision-making across the full course of clinical care ( 39 ; 13 ) . For many non-acute or chronic conditions, patients accumulate long-horizon EHRs spanning years of irregular visits and thousands of heterogeneous events. These trajectories are common in real-world healthcare but difficulty to interpret, even for clinicians, and recent studies have highlighted both their modeling challenges and clinical importance ( 37 ; 53 ; 18 ) . Effective clinical prediction in this setting requires reasoning over long temporal spans while preserving event-type structure and clinical dependencies. Traditional machine learning (ML) methods have been widely studied for EHR-based prediction tasks, including length-of-stay estimation ( 7 ; 31 ) , readmission prediction ( 4 ; 54 ) , and medication recommendation ( 6 ; 44 ) . More recently, large language models (LLMs) ( 2 ; 49 ) have shown promise in clinical reasoning due to their strong generalization capabilities to new task and their capability to perform multi-step reasoning to provide rationale instead of only final answer to make it more trustworthy for clinician’s decision making ( 5 ; 24 ; 25 ; 29 ) . However, LLMs cannot natively process long-horizon structured EHRs: their fixed context windows are quickly exceeded by multi-visit patient histories, and naive event serialization obscures temporal structure and discards clinically relevant context. Existing approaches address this limitation primarily through heuristic truncation, such as retaining only recent events ( 35 ) or selecting events associated with high-frequency codes ( 34 ) . While retrieval-augmented generation (RAG) ( 19 ) offers a mechanism to selectively retrieve relevant events, existing RAG-based methods typically retrieve isolated subsets of the patient history primarily to satisfy context-length constraints ( 60 ; 30 ; 59 ) . As a result, vanilla RAG in clinical settings often suffers from low retrieval quality, incomplete evidence coverage, and reduced robustness when reasoning over long-horizon EHRs ( 33 ; 42 ) . Despite the prevalence and importance of such data, to the best of our knowledge, no existing RAG framework is explicitly designed to handle their longitudinal, multi-event nature. In this work, we study clinical prediction with long-horizon structured EHR data and propose EHR-RAG , an enhanced retrieval-augmented framework tailored for this setting. EHR-RAG is built around three components designed to improve retrieval quality , completeness , and robustness under strict context constraints: (a) E vent- and T ime-Aware H ybrid E HR R etrieval ( ETHER ), which preserves event-type structure and temporal dynamics during retrieval; (b) A daptive I terative R etrieval ( AIR ), which progressively refines retrieval queries to expand evidence coverage while respecting context limits; and (c) D ual-Path E vidence R etrieval and R easoning ( DER ), which jointly retrieves and reasons over both factual patient history and counterfactual evidence to improve robustness. Together, these designs enable reliable long-horizon clinical reasoning with LLMs. We evaluate EHR-RAG against a range of baseline methods on a long-horizon EHR benchmark. Experimental results demonstrate consistent Macro-F1 improvements across all four clinical prediction tasks, with gains of 3.63% on Long Length of Stay , 11.28% on 30-day Readmission , 16.46% on Acute Myocardial Infarction , and 7.66% on Anemia relative to the strongest LLM-based baselines. Overall, EHR-RAG achieves an average Macro-F1 improvement of 10.76%. In summary, we make the following contributions: • We identify and analyze the limitations of existing truncation-based and vanilla RAG approaches on long-horizon structured EHR data, highlighting challenges in evidence completeness and temporal reasoning for reliable clinical prediction. • We propose EHR-RAG , a retrieval-augmented framework explicitly designed for long-horizon EHR reasoning, integrating event- and time-aware retrieval, adaptive iterative retrieval, dual-path evidence retrieval. • We conduct extensive experiments demonstrating consistent improvements over strong baselines across multiple long-horizon EHR prediction tasks. 2 Related Work Figure 1 : Overview of the EHR-RAG framework for long-horizon clinical prediction. Compared with Direct Generation and Vanilla RAG , our framework explicitly addresses context truncation and incomplete retrieval. It integrates (a) Event- and Time-aware Hybrid Retrieval (ETHER) , (b) Adaptive Iterative Retrieval (AIR) , and (c) Dual-Path Factual and Counterfactual Reasoning (DER) , ensuring retrieval quality, robustness, and completeness for reliable clinical decision-making. Clinical Predictive Models. Structured EHR data has supported the development of a wide range of machine learning models for different clinical prediction tasks ( 7 ; 31 ; 4 ; 6 ) . Models such as RETAIN ( 12 ) , GRAM ( 11 ) , and KerPrint ( 55 ) are specifically designed to capture complex temporal and hierarchical patterns within structured EHRs and have shown strong performance across multiple predictive settings. In parallel, recent efforts have focused on scaling clinical prediction through large foundation models, including CLMBR-T-Base ( 53 ) , Virchow ( 51 ) , and MIRA ( 32 ) . However, traditional predictive models—ranging from task-specific architectures to supervised foundation model training—remain inflexible, requiring labeled data for every downstream task and often failing to generalize beyond the distribution on which they were trained. These limitations are especially problematic in the dynamic and heterogeneous healthcare environment. LLM-based Clinical Prediction. Recently, the paradigm of clinical prediction has begun to shift toward the use of LLMs ( 2 ) . LLMs offer greater adaptability and generalization than traditional supervised models, with the capacity to interpret diverse medical information and support more versatile clinical decision-making. Several studies apply LLMs directly to clinical prediction tasks ( 38 ; 61 ; 10 ; 30 ) , while others employ LLMs as encoders for structured EHR data ( 21 ) . Additional efforts explore training or adapting