Inductive Relation Prediction by BERT

Hanwen Zha, Zhiyu Chen, Xifeng Yan

Introduction

Knowledge Graphs (KGs) serve as the backbone for numerous AI applications, providing structured factual data in the form of triples like (Franklin Roosevelt, president_of, USA). However, these graphs are often incomplete. Predicting missing links, known as Relation Prediction, is a critical task. Traditional approaches generally fall into two categories: embedding-based methods, which are powerful but transductive (unable to handle entities unseen during training), and logical induction methods, which are inductive but often ignore the semantic richness of entity and relation names.

BERTRL (BERT-based Relational Learning) bridges this gap by leveraging pre-trained language models to perform inductive relation prediction. By treating graph reasoning as a natural language classification task, BERTRL utilizes textual prior knowledge to reason about unseen entities and provide explainable predictions.

Methodology

The BERTRL framework operates by transforming graph subgraphs into linearized reasoning paths that a transformer model can process. The workflow consists of three primary stages:

  1. Knowledge Linearization: To evaluate a target triple (e.g., Is X related to Z?), the model identifies paths in the graph connecting X and Z. These paths are converted into natural language prompts. For instance, a path through entity Y might be formatted as: [CLS] Question: X work at what? Is the answer Z? [SEP] Context: X president of Y; Z capital of Y;.
  2. BERT Scoring: These linearized paths are fed into a pre-trained BERT model. The model is fine-tuned to output a probability score representing the likelihood that the target triple is true based on the provided reasoning path.
  3. Score Aggregation: Since multiple paths may connect two entities, BERTRL employs a max-pooling strategy, taking the highest score among all candidate paths as the final confidence level for the triple.
Overview of the BERTRL framework, illustrating the transition from a knowledge subgraph to linearized reasoning paths and final BERT-based inference.

Experimental Evaluation

The authors evaluated BERTRL on three standard benchmarks: WN18RR (lexical relations), FB15k-237 (real-world facts), and NELL-995 (web-extracted facts). To test the model's inductive capabilities, the experiments used versions of these datasets where the test set entities were entirely absent from the training set. Additionally, "few-shot" variants were tested, where the model was trained on as few as 1,000 or 2,000 links to assess generalization performance under data sparsity.

Results and Discussion

BERTRL demonstrated significant improvements over existing state-of-the-art inductive methods such as GraIL and RuleN, outperforming them in 15 out of 18 experimental scenarios.

Key Strengths

  • Semantic Prior Knowledge: Unlike models that treat entities as arbitrary IDs, BERTRL "reads" the names. This enables zero-shot relation prediction, where the model can predict relations it has never seen before by understanding the semantic similarity between terms (e.g., "spouse" and "marriage").
  • Explainability: The path-based scoring mechanism provides inherent transparency. The highest-scoring path serves as a human-readable justification for the model's prediction. In human evaluations, 84% of these paths were found to be logically sound.
  • Few-Shot Robustness: In data-constrained environments, BERTRL significantly outperformed competitors, in some cases improving Hits@1 accuracy by over 30%.
Comparison of BERTRL with existing relation prediction methods across transductive and inductive settings, highlighting its unique combination of prior knowledge and explainability.

Conclusion and Future Work

BERTRL represents a significant step forward in making Knowledge Graph completion more robust and interpretable. By combining the structural logic of graphs with the semantic power of language models, it handles unseen entities and relations with high accuracy. Future research will focus on improving computational efficiency—as BERT-based inference is resource-intensive—and exploring more sophisticated path aggregation techniques to better synthesize evidence from multiple reasoning chains.

Summary updated

BibTeX
@inproceedings{zha2022inductive,
  author = {Hanwen Zha and Zhiyu Chen and Xifeng Yan},
  title = {{Inductive Relation Prediction by BERT}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i5.20537},
}
Figure