Enhancing Medical Question-Answering Systems with Knowledge Graph-Integrated Large Language Models: A Comparative Analysis
Abstract
This study investigates the impact of integrating knowledge graph prompt engineering (KGPE) with large language models in the context of medical question answering. The Hugging Face MedQA dataset (N = 5,000) was utilised for the extraction of key medical entities via the implementation of named entity recognition, and the construction of SPARQL-based relational prompts from the knowledge base of Wikipedia to guide the reasoning process. Two models, Llama-2-7B-chat-hf and Qwen-2-7B-Instruct, are evaluated through a weighted aggregation of BLEU, ROUGE, and cosine similarity metrics. The findings demonstrate that Qwen-2-7B-Instruct attains substantial enhancements under KGPE—BLEU escalating from 0.366 to 0.531 (+0.165) and cosine similarity rising from 0.763 to 0.820 (+0.057). Conversely, Llama-2-7B-chat-hf exhibits a modest decrease, signifying divergent responsiveness to structured knowledge. These findings demonstrate that integrating structured knowledge through KGPE enhances factual accuracy and semantic coherence in medical reasoning without modifying model architecture
Fields of Study & Subjects
Topic Modeling
Artificial Intelligence in Healthcare and Education
Biomedical Text Mining and Ontologies
Publication details
- Journal / source
- EAI Endorsed Transactions on Pervasive Health and Technology
- Volume
- 11
- Publication date
- 28 January 2026