MedKGent: A Large Language Model Agent Framework for Constructing Temporally Evolving Medical Knowledge Graph

Duzhen Zhang, Zixiao Wang, Zhong-Zhi Li, Yahan Yu, Shuncheng Jia, Jiahua Dong, Haotian Xu, Xing Wu, Yingying Zhang, Tielin Zhang, Jie Yang, Xiuying Chen, Le Song · DOI · OpenReview

Introduction

The exponential growth of medical literature presents a significant challenge for researchers and clinicians attempting to stay current with scientific discoveries. While Knowledge Graphs (KGs) offer a structured way to represent biomedical facts—such as relationships between drugs, genes, and diseases—traditional construction methods are often static. These methods typically treat the entire corpus as a single snapshot, ignoring the temporal dynamics of science where new evidence constantly refines or contradicts older findings.

To address this, we introduce MedKGent, a novel LLM-agent framework designed to construct a massive, temporally evolving medical KG. By processing over 10 million PubMed abstracts chronologically from 1975 to 2023, MedKGent tracks the emergence and evolution of medical knowledge, providing a dynamic resource that reflects the historical trajectory of scientific discovery.

The MedKGent Framework

MedKGent utilizes a dual-agent architecture powered by the Qwen2.5-32B-Instruct model to simulate the process of scientific accumulation. Unlike bulk-processing pipelines, MedKGent operates day-by-day, ensuring that the graph's state at any point in time accurately reflects the literature available up to that date.

The MedKGent framework pipeline, showing the transition from PubMed collection to agent-based graph construction.

Extractor Agent

The Extractor Agent first identifies biomedical entities (genes, diseases, chemicals) using PubTator3. It then prompts the LLM to infer relationships between these entities. To ensure reliability and mitigate hallucinations, the framework employs sampling-based confidence estimation. The agent runs each extraction prompt 50 times at a high temperature; a confidence score is then assigned based on the frequency of the resulting relationship. Extractions with a confidence score below 0.6 are discarded to maintain high data quality.

Constructor Agent

The Constructor Agent integrates these triples into a Neo4j graph database. It handles three primary scenarios:

  1. New Knowledge: Directly inserting facts not previously in the KG.
  2. Reinforcement: If a fact is encountered again in later literature, its confidence score is mathematically strengthened, and its timestamp is updated.
  3. Conflict Resolution: When a new relationship contradicts an existing one for the same entity pair, the agent uses the LLM to resolve the conflict by weighing competing confidence scores and publication dates.

Data and Scale

The framework was applied to a filtered dataset of 10,014,314 PubMed abstracts. The resulting KG is the largest LLM-derived medical knowledge graph to date, containing 156,275 entities and 2,971,384 relational triples. The dataset spans nearly five decades, providing a unique lens into how medical consensus has shifted over time.

Results and Evaluation

MedKGent was evaluated for both the accuracy of its extractions and its utility in downstream tasks. Automated evaluations using GPT-4.1 and DeepSeek-v3, alongside manual reviews by human domain experts, confirmed an extraction accuracy of nearly 90%.

A sample subgraph centered on COVID-19, illustrating temporal metadata, confidence scores, and multi-hop relationships.

RAG Performance Boost

When integrated as a Retrieval-Augmented Generation (RAG) backend, the MedKGent graph significantly improved the zero-shot accuracy of five major LLMs (including GPT-4-turbo and DeepSeek-v3) across seven medical QA benchmarks. Notably, GPT-3.5-turbo achieved an 8.5% absolute accuracy improvement on the MedQA-US dataset when utilizing the KG.

Predictive Capabilities

Because the graph captures multi-hop relationships and temporal metadata, it can be used to infer novel therapeutic links. The authors demonstrated that MedKGent could have predicted the use of tocilizumab for COVID-19 treatment by analyzing relationships between the drug, specific genes, and related respiratory conditions in pre-2020 literature.

Discussion and Future Work

While MedKGent represents a major step forward, it currently relies solely on PubMed abstracts. Future iterations aim to incorporate full-text articles, Electronic Health Records (EHRs), and clinical trial registries to capture more nuanced data. Additionally, the team plans to explore advanced Bayesian modeling to further refine uncertainty quantification in the confidence scoring system. By treating medical knowledge as a living, evolving entity, MedKGent provides a robust foundation for the next generation of medical AI assistants.

Summary updated

BibTeX
@misc{zhang2025medkgent,
  author = {Duzhen Zhang and Zixiao Wang and Zhong-Zhi Li and Yahan Yu and Shuncheng Jia and Jiahua Dong and Haotian Xu and Xing Wu and Yingying Zhang and Tielin Zhang and Jie Yang and Xiuying Chen and Le Song},
  title = {{MedKGent: A Large Language Model Agent Framework for Constructing Temporally Evolving Medical Knowledge Graph}},
  year = {2025},
  eprint = {2508.12393},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.12393},
}
Figure