Welcome to the MedKGent repository! This repository contains the code for MedKGent, a framework designed for constructing temporally evolving medical knowledge graphs using large language models.
For any questions, suggestions, or collaboration opportunities, please feel free to reach:
| Contact | |
|---|---|
| Duzhen Zhang | 📧 duzhen.zhang@mbzuai.ac.ae |
- [2026.06.18] We open-sourced the MedKGent codebase.
git clone https://github.com/BladeDancer957/MedKGent.git
cd MedKGentconda env create -f environment.yaml
conda activate medkgentAlternatively, if you prefer using pip directly:
pip install -r requirements.txtCreate a .env file in the project root directory. The file should define the following variables:
| Variable | Description |
|---|---|
API_KEY |
API key for the commercial LLM service. |
BASE_URL |
LLM API base URL, for example the DashScope compatible endpoint. |
NEO4J_URI |
Neo4j connection URI, for example a local Bolt URI. |
NEO4J_USER |
Neo4j username. |
NEO4J_PASSWORD |
Neo4j password. |
NEO4J_DATABASE |
Neo4j database name. |
Please do not commit your real .env file to GitHub.
Make sure run.sh is executable:
chmod +x run.shThen run:
./run.shYou can also override the default runtime parameters:
./run.sh --model qwen-max --base_dir ./data_samples --N 50 --confidence_threshold 0.6You can explore the Medical Knowledge Graph built using the MedKGent framework here: MedKGent-KG.
The current code version in this repository uses ready-to-use commercial LLM APIs and processes abstracts serially in chronological order.
Since the number of abstracts to be processed is very large, at the scale of tens of millions, we deployed open-source LLMs ourselves when using MedKGent to reduce API calling costs, and we also implemented parallel extraction to accelerate.
If you have any questions or need help with deploying open-source LLMs or accelerating extraction with parallel processing, please feel free to contact us.
If you use this framework or dataset in your research, please cite the following paper:
@article{zhang2025medkgent,
title={MedKGent: A Large Language Model Agent Framework for Constructing Temporally Evolving Medical Knowledge Graph},
author={Zhang, Duzhen and Wang, Zixiao and Li, Zhong-Zhi and Yu, Yahan and Jia, Shuncheng and Dong, Jiahua and Xu, Haotian and Wu, Xing and Zhang, Yingying and Zhang, Tielin and others},
journal={arXiv preprint arXiv:2508.12393},
year={2025}
}