LLM-Powered Contextual Diagnosis Support for Rare Diseases Using Electronic Health Records

Read full text
Authors: Goutam Adwant, Manjari Srivastav
Cited by: 0

Abstract

Rare diseases affect millions of patients worldwide, yet timely diagnosis remains a significant challenge due to fragmented clinical information and the complexity of phenotypes. On average, patients with rare conditions experience diagnostic delays of 4-5 years before receiving a correct diagnosis. Early detection is critical to improving outcomes, but traditional approaches relying on rule-based phenotyping or manual chart review are often slow, errorprone, and lack interpretability. In this study, we propose and implement a retrieval-augmented large language model (RAG-LLM) framework that integrates structured electronic health records (EHRs), unstructured clinical notes, and curated rare-disease ontologies to provide contextual diagnostic support. The system synthesizes patient history, prioritizes likely differential diagnoses with confidence scores, and links recommendations to evidence from patient data and ontology sources for interpretability. We implement and evaluate the framework on Synthea synthetic EHR data (50 patients, 3,465 encounters) using local Ollama llama2 model for privacy-preserving inference. The system achieves 60% evidence coverage, generating structured ranked differential diagnoses with explicit evidence citations. Our implementation demonstrates that the RAG-LLM framework provides significant advantages over traditional methods: (1) ranked differential diagnoses vs. binary classification, (2) evidence-grounded output with 60% coverage vs. no evidence, (3) multi-source integration (structured + unstructured + ontologies) vs. structured-only, and (4) contextual LLM reasoning vs. pattern matching. Key experimental findings include: successful generation of structured JSON output with diagnoses, confidence scores (0.45-0.85 range), evidence citations, and rationale explanations; 100% evidence coverage for successful predictions; and efficient retrieval over 3,465+ passages with sub-second query times. The framework architecture supports early detection through time-to-flag evaluation and provides interpretable, evidence-based recommendations that enable clinician validation. This research demonstrates that AI-powered, evidence-grounded diagnostic support systems can assist clinicians in early identification of rare diseases, provide interpretable recommendations through evidence linking, and offer a pathway toward reducing diagnostic delays while maintaining privacy through local inference capabilities.

Fields of Study & Subjects

Machine Learning in Healthcare Artificial Intelligence in Healthcare and Education Electronic Health Records Systems

Publication details

Publication date
13 January 2026
Document type
Preprint