OpenTCM: A GraphRAG-Empowered LLM-based System for Traditional Chinese Medicine Knowledge Retrieval and Diagnosis

Jinglin He, Yunqi Guo, Lai Kwan Lam, Waikei Leung, Lixing He, Yuanan Jiang, Chi Chiu Wang, Guoliang Xing, Hongkai ChenarXiv 2025 · DOI

Introduction

Traditional Chinese Medicine (TCM) represents a vast repository of medical knowledge spanning millennia. However, much of this knowledge is locked within archaic classical texts, making it difficult for modern practitioners and standard computational models to access. While Large Language Models (LLMs) have shown promise in medical domains, they often struggle with the linguistic nuances of ancient Chinese and are prone to hallucinations when dealing with complex TCM relationships.

OpenTCM addresses these challenges by bridging ancient literature with modern AI. It combines a custom-built TCM knowledge graph with Graph-based Retrieval-Augmented Generation (GraphRAG). This approach allows for accurate, grounded retrieval and diagnostic reasoning without the need for resource-intensive model fine-tuning.

Methodology

The OpenTCM system is built upon a three-stage pipeline designed to transform unstructured classical texts into a structured, queryable knowledge base.

  1. Data Collection & Pre-processing: The corpus consists of 68 authoritative ancient books on TCM gynecology, obstetrics, and fertility. This data was meticulously cleaned and reviewed by TCM experts to ensure high fidelity.
  2. Knowledge Graph (KG) Construction: Using Chinese-oriented LLMs (such as DeepSeek and Kimi) with customized prompts, the system extracts structured entities and relationships. These prompts use role-playing, context injection, and few-shot learning to guide the LLM in identifying 10 specific relation types from archaic text.
  3. GraphRAG Integration: Unlike standard RAG, which retrieves flat text chunks, GraphRAG traverses multi-hop paths within the KG. This enables the system to follow clinical logic (e.g., linking a symptom to a syndrome and then to a specific herbal formula).

Knowledge Graph Construction

The resulting Knowledge Graph is a dense network of TCM concepts. By leveraging LLMs for extraction, the researchers achieved high precision and recall, significantly outperforming general-purpose models like GPT-4 in parsing classical Chinese.

Visualization of the TCM Knowledge Graph, showing the complex interconnections between symptoms, syndromes, and treatments.

The final graph contains over 48,000 entities and 152,000 relationships, providing a robust foundation for the retrieval system.

Evaluation and Results

OpenTCM was evaluated against a curated dataset of 257 ingredient search queries and 303 diagnostic questions. A panel of medical experts scored the responses based on accuracy and clinical relevance.

  • Extraction Performance: The Kimi-based extraction pipeline achieved 98.55% precision and 98.17% accuracy.
  • Retrieval Accuracy: OpenTCM achieved 99.0% accuracy in ingredient retrieval, far exceeding the performance of the base Kimi model (53.9%) and fine-tuned models like BianCang (47.1%).
  • Clinical Consultation: In diagnostic scenarios, the system maintained a 98.8% accuracy rate with a Mean Expert Score of 4.045 out of 5.

Conclusion

OpenTCM demonstrates that grounding LLMs in structured knowledge graphs via GraphRAG is a highly effective strategy for specialized domains like Traditional Chinese Medicine. By bypassing the need for fine-tuning, the system reduces computational costs while significantly improving the reliability of AI-generated medical advice. Future work will focus on expanding the knowledge base to other TCM specialties and integrating multimodal data for more comprehensive diagnostics.

Summary updated

BibTeX
@misc{he2025opentcm,
  author = {Jinglin He and Yunqi Guo and Lai Kwan Lam and Waikei Leung and Lixing He and Yuanan Jiang and Chi Chiu Wang and Guoliang Xing and Hongkai Chen},
  title = {{OpenTCM: A GraphRAG-Empowered LLM-based System for Traditional Chinese Medicine Knowledge Retrieval and Diagnosis}},
  year = {2025},
  eprint = {2504.20118},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.20118},
}
Figure