Enhancing Graph Query Generation for Medical Text by Aligning Domain Knowledge Graph with Large Language Models
Despite the growing interest in Natural Language to Cypher (NL2Cypher) for querying graph databases, driven by advances in Large Language Models (LLMs), research in this area remains limited. However, there are still challenges to be overcome, including the lack of domain‐specific knowledge constraints and the inconsistent generation of graph query language. This paper proposed a solution to these challenges by improving the LLM's ability to generate Cypher through the creation of a specialized dataset and subsequent fine‐tuning of the LLM. Our method involved three key steps: we constructed a medical NL2Cypher dataset that included both single‐hop and multi‐hop question types. Subsequently, we conducted named entity recognition on the queries and classified the recognized entities to provide contextually relevant entity information to LLM. By incorporating code‐structure graph schema details into the fine‐tuning input, we aligned the domain‐specific knowledge graph with the LLM, ensuring that the generated output adhered to the predefined Cypher structure. Finally, we utilized this prepared dataset for supervised fine‐tuning on the LLM. The experimental results showed that the accuracy of Cypher execution for single‐hop and multi‐hop questions is 95.65% and 96.69%, respectively. These outcomes were achieved with a smaller training set, indicating the effectiveness of the approach. © 2026 Institute of Electrical Engineers of Japan and Wiley Periodicals LLC.
Authors
- Wei Liao
- Lei Wang
- Yang Liu
- Zhen Xu
Institutions
- Shanghai University of Engineering Science (CN)
Publication Details
- Journal
- IEEJ Transactions on Electrical and Electronic Engineering
- Published
- 2026-04-27
- DOI
- https://doi.org/10.1002/tee.70313
- Primary Topic
- Advanced Graph Neural Networks
- Type
- article
- Field-Weighted Citation Impact
- 0.00