Clinical RAG Assistant

A clinical RAG that won't lie to a doctor, and proves it.

RAGQdrantBGE embeddingsOllama ยท Llama 3.1FastAPIStreamlitMLflow

Demo

Problem

An LLM that sounds confident but invents a medication or dose is worse than useless in a clinical setting; it is dangerous. Most RAG demos ignore this and optimize only for fluent answers.

Approach

Local-first RAG over clinical notes with section-aware chunking and character-span provenance. Every citation is parsed and verified against the retrieved text, and fabricated ones are dropped. A relevance gate enforces honest refusal when the answer is not in the notes, and extracted entities (diagnoses, medications, allergies, procedures, follow-ups) are grounded to verbatim source spans. Single-patient scope is enforced so answers can never blend patients.

Result

On a hand-labeled gold set of 24 Q&A pairs: 84% answer correctness, 90% citation accuracy, 90% retrieval recall@k, and (with the relevance gate on) 100% refusal on unanswerable questions, at a measured ~10% false-refusal cost. Runs entirely offline; no clinical text ever leaves the machine.

Highlights

  • Character-span citation verification: fabricated citations are provably dropped
  • LLM relevance gate lifts refusal on unanswerable questions from 60% โ†’ 100%
  • Schema-constrained entity extraction with source-span grounding
  • Full stack: ingestion โ†’ retrieval โ†’ generation โ†’ FastAPI โ†’ Streamlit UI โ†’ MLflow eval
Next projectAutonomous ML Pipeline with AI Agents โ†’