MED-KG-LLM: A Modular Pipeline for Knowledge Graph–Augmented Medical Question Answering on Clinical Data
摘要
With the growing digitization of electronic health records (EHRs), there is an urgent need to transform raw, unstructured clinical tabular data into structured representations that support accurate and explainable question answering (QA). We introduce MED-KG-LLM, a fully modular and scalable pipeline that ingests raw dataset based patient-symptom records, performs hybrid named entity recognition (NER) using spaCy and BioBERT, and applies deterministic pattern-driven open information extraction to produce normalized subject-predicate-object triples. These triples populate a multi-view biomedical knowledge graph (KG) in NetworkX, partitioned by relation type (e.g., treatment, symptom association, contraindication). For query processing, both user questions and KG components are embedded with a proprietary OpenAI model; relevant graph passages are retrieved via approximate nearest neighbor search. A two-stage answer generation cascade first leverages BioGPT for domain-specific draft responses, followed by GPT-4o-mini for fluency and factual refinement. We evaluate our system on three publicly available healthcare datasets, benchmarking generated answers against human ground truths using BERTScore, ROUGE-L, and METEOR. Experimental results demonstrate that MED-KG-LLM substantially outperforms existing baselines (e.g., Microsoft Copilot, DeepSeek) in both semantic accuracy and linguistic quality, highlighting its potential as an end-to-end solution for clinical QA over tabular medical data.