ResearchJournal of the American Medical Informatics Association · Sep 8, 2026
Evaluating retrieval-augmented generation versus long-context input for clinical reasoning over electronic health records
Myers S, Dligach D, Miller TA, Barr S, Landefeld J, Gao Y, et al
Abstract
Objective
To evaluate whether retrieval-augmented generation (RAG) can serve as an efficient alternative to long-context prompting for clinical reasoning over electronic health records (EHRs). Materials and methods
We defined 3 EHR-based tasks that are replicable across health systems and vary in reasoning complexity: (1) extracting imaging procedures (modality, date, and anatomic site), (2) generating timelines of therapeutic antibiotic use, and (3) identifying the key diagnoses for a hospitalization. Using real inpatient clinical notes from a US academic health system, we evaluated 3 large language models (GPT-5.4-mini, Mistral Medium 3, DeepSeek V3.1) with varying amounts of provided context, comparing targeted retrieval to using the most recent clinical notes. Results
For Imaging Procedures, RAG strongly outperformed recent-note inputs and exceeded long-context performance (by 0.17-9.83 F1 across all models) using fewer than 8K tokens. Similar benefits were observed for Antibiotic Timelines, where Discussion
RAG demonstrated strong token efficiency across tasks, with the clearest and most consistent gains observed for imaging extraction and antibiotic timeline reconstruction. Diagnosis generation proved the most challenging task, suggesting ceiling effects imposed by documentation variability and evaluation constraints. Conclusion
Our results suggest that RAG remains a competitive and efficient approach for clinical tasks over large amounts of EHR, even as newer models become capable of handling increasingly longer amounts of text.
Topics
Electronic Health Records; Large Language Models; Humans; Information Storage and Retrieval; Generative Artificial Intelligence; Natural Language Processing; Diagnostic Imaging; Anti-Bacterial Agents
DOI: 10.1093/jamia/ocag139 · PubMed: 42710003
Spotted a mistake? Suggest a correction
More in Digital Health & AI
ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI
ClinicalAge, a framework for modelling ageing trajectories from longitudinal electronic health records in the UK: a model development and validation study
ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI
Foundation artificial intelligence models for health recognition by use of face photographs (FAHR-Face): a model development and validation study
ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI
A prognostic model for use at labour onset to estimate the risk of severe fetal compromise at birth: a retrospective, model development and validation study
ResearchNPJ Digit Med · Nov 21, 2026 · Digital Health & AI
ECG foundation models for cardiovascular screening in a cohort of young competitive athletes
ResearchJ Med Internet Res · Nov 20, 2026 · Digital Health & AI
Medical Reasoning in Large Language Models: Development and Evaluation of the MedEvalArena Benchmark