A Prompt-Based Knowledge Graph Foundation Model for Universal In-Context Reasoning
About
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.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Hyper-Relational Link Prediction | JFFI100 V2 | H/T Score0.1022 | 22 | |
| Hyper-Relational Link Prediction | JFFI100 V1 | H/T Metric6.75 | 22 | |
| Hyper-Relational Link Prediction | WD20K66 V1 | MRR (H/T)0.239 | 19 | |
| Hyper-Relational Link Prediction | WD20K33 V1 | H/T Score0.2644 | 19 | |
| Hyper-Relational Link Prediction | WD20K100 V2 | H/T Ratio40.41 | 19 | |
| Hyper-Relational Link Prediction | WD20K66 V2 | H/T Score23.42 | 19 | |
| Hyper-Relational Link Prediction | JFFI V1 | MRR (H/T)0.0746 | 18 | |
| Hyper-relational Inductive Link Prediction | WDSPLIT100 V2 | MRR (H/T)0.3578 | 15 | |
| Hyper-Relational Link Prediction | WD20K100 V1 | MRR (H/T)52.84 | 15 | |
| Hyper-relational Inductive Link Prediction | WD20K33 V2 | MRR (H/T)0.2012 | 15 |