A Prompt-Based Knowledge Graph Foundation Model for Universal In-Context Reasoning

Yuanning Cui, Zequn Sun, Wei Hu
2/3/2026

No official code found. Best implementation: nju-websoft/KG-ICL (82 stars, GPL-3.0, last commit 2025-03-23).

Abstract

Extensive knowledge graphs (KGs) have been constructed to facilitate knowledge-driven tasks across various scenarios. However, existing work usually develops separate reasoning models for different KGs, lacking the ability to generalize and transfer knowledge across diverse KGs and reasoning settings. In this paper, we propose a prompt-based KG foundation model via in-context learning, namely KG-ICL, to achieve a universal reasoning ability. Specifically, we introduce a prompt graph centered with a query-related example fact as context to understand the query relation. To encode prompt graphs with the generalization ability to unseen entities and relations in queries, we first propose a unified tokenizer that maps entities and relations in prompt graphs to predefined tokens. Then, we propose two message passing neural networks to perform prompt encoding and KG reasoning, respectively. We conduct evaluation on 43 different KGs in both transductive and inductive settings. Results indicate that the proposed KG-ICL outperforms baselines on most datasets, showcasing its outstanding generalization and universal reasoning capabilities. The source code is accessible on GitHub: https://github.com/nju-websoft/KG-ICL.

View on arXivView PDF

Code Implementations(1)

nju-websoft/KG-ICLCommunity100%
GPL-3.0

A Knowledge Graph Foundation Model for Universal In-Context Reasoning, NeurIPS 2024

8210C++, CudaOct 8, 20241 years agoGPL-3.0

Similar Papers

Cite this paper

@article{cui2026promptbased,
  title  = {A Prompt-Based Knowledge Graph Foundation Model for Universal In-Context Reasoning},
  author = {Yuanning Cui and Zequn Sun and Wei Hu},
  year   = {2026},
  eprint = {2410.12288},
  archivePrefix = {arXiv},
  doi    = {10.52202/079017-0227},
  url    = {https://arxiv.org/abs/2410.12288},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.12288.svg)](https://codeofpaper.com/paper/2410.12288)

Discussion