KnowFormer: Revisiting Transformers for Knowledge Graph Reasoning

J. Liu, Qianren Mao, Weifeng Jiang, Jianxin Li
9/1/2024

No official code found. Best implementation: jnanliu/KnowFormer (26 stars, MIT, last commit 2024-09-20).

Abstract

Knowledge graph reasoning plays a vital role in various applications and has garnered considerable attention. Recently, path-based methods have achieved impressive performance. However, they may face limitations stemming from constraints in message-passing neural networks, such as missing paths and information over-squashing. In this paper, we revisit the application of transformers for knowledge graph reasoning to address the constraints faced by path-based methods and propose a novel method KnowFormer. KnowFormer utilizes a transformer architecture to perform reasoning on knowledge graphs from the message-passing perspective, rather than reasoning by textual information like previous pretrained language model based methods. Specifically, we define the attention computation based on the query prototype of knowledge graph reasoning, facilitating convenient construction and efficient optimization. To incorporate structural information into the self-attention mechanism, we introduce structure-aware modules to calculate query, key, and value respectively. Additionally, we present an efficient attention computation method for better scalability. Experimental results demonstrate the superior performance of KnowFormer compared to prominent baseline methods on both transductive and inductive benchmarks.

View on arXivView PDF

Code Implementations(1)

jnanliu/KnowFormerCommunity78%
MIT

[ICML 2024] KnowFormer: Revisiting Transformers for Knowledge Graph Reasoning

263C++, CudaMay 25, 20242 years agoMIT
knowledge-graphknowledge-graph-reasoningknowledge-representation

Similar Papers

Cite this paper

@article{liu2024knowformer,
  title  = {KnowFormer: Revisiting Transformers for Knowledge Graph Reasoning},
  author = {J. Liu and Qianren Mao and Weifeng Jiang and Jianxin Li},
  year   = {2024},
  eprint = {2409.12865},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2409.12865},
  journal = {ICML 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/2409.12865.svg)](https://codeofpaper.com/paper/2409.12865)

Discussion