RulE: Knowledge Graph Reasoning with Rule Embedding

Xiaojuan Tang, Song-Chun Zhu, Yitao Liang, Muhan Zhang

Abstract

Knowledge graph reasoning is an important problem for knowledge graphs. In this paper, we propose a novel and principled framework called RulE (stands for Rule Embedding) to effectively leverage logical rules to enhance KG reasoning. Unlike knowledge graph embedding methods, RulE learns rule embeddings from existing triplets and first-order rules by jointly representing entities, relations and logical rules in a unified embedding space. Based on the learned rule embeddings, a confidence score can be calculated for each rule, reflecting its consistency with the observed triplets. This allows us to perform logical rule inference in a soft way, thus alleviating the brittleness of logic. On the other hand, RulE injects prior logical rule information into the embedding space, enriching and regularizing the entity/relation embeddings. This makes KGE alone perform better too. RulE is conceptually simple and empirically effective. We conduct extensive experiments to verify each component of RulE. Results on multiple benchmarks reveal that our model outperforms the majority of existing embedding-based and rule-based approaches.

Introduction

Knowledge Graphs (KGs), such as Freebase or WordNet, are massive networks of real-world facts that are notoriously incomplete. To fill these gaps, researchers typically follow one of two paradigms: Knowledge Graph Embedding (KGE) or Rule-Based Reasoning.

KGE methods (e.g., TransE, RotatE) map entities and relations into a latent vector space. While efficient and robust to noise, they are often "blind" to high-level logical constraints. Conversely, rule-based methods use explicit symbolic logic, which is interpretable but "brittle"—a single exception in real-world data can invalidate a hard-logic rule.

Comparison between traditional KGE and the proposed RulE framework. RulE incorporates logical rules directly into the embedding space to regularize representations.

RulE (Rule Embedding) bridges this gap by jointly learning from both triplets and first-order logical rules in a unified vector space, enabling "soft" logical inference that is robust to noise and significantly improves prediction accuracy.

Methodology

The RulE framework consists of three core components designed to integrate symbolic logic into neural embeddings:

1. Joint Embedding Space

Unlike standard KGEs, RulE assigns an embedding vector to the logical rules themselves. For a chain rule like $r_1 \wedge r_2 \Rightarrow r_3$, the model defines a distance function where the head of the rule ($r_3$) should be close to the composition of the body relations ($r_1, r_2$) plus a "rule residual" embedding. This allows rules to act as regularizers, shaping entity and relation embeddings to be more logically consistent.

2. Soft Rule Reasoning

Instead of treating rules as absolute truths, RulE calculates a confidence score for each rule based on its embedding. When multiple rules are "activated" (i.e., paths exist in the graph that match the rule's body), the model uses these confidence scores to weight their contributions, alleviating the brittleness of hard logic.

3. MLP Aggregator

To handle complex interdependencies and redundancies between different rules, RulE feeds activated rule information into a Multi-Layer Perceptron (MLP). This allows the model to learn non-linear combinations of rules, such as identifying when two "weak" rules together provide a strong signal for a specific fact.

The RulE architecture overview, illustrating the joint training of embeddings and the soft rule reasoning pipeline.

Experiments and Key Results

The authors evaluated RulE on six diverse datasets, including standard benchmarks (FB15k-237, WN18RR, YAGO3-10) and relational datasets (UMLS, Kinship, Family).

  • Superior Performance: RulE outperformed the majority of existing KGE and rule-based baselines across all datasets. On the UMLS and Kinship datasets, RulE achieved absolute Mean Reciprocal Rank (MRR) gains of 4.4% and 4.7% over the TransE baseline.
  • Rules as Regularizers: A striking finding was that simply adding the rule-embedding loss during training improved the quality of entity/relation embeddings, even if rules were not used during the final inference step.
  • Soft Advantage: By moving from "hard" logic to soft confidence scores, the model became much more resilient to the noise and exceptions common in real-world knowledge graphs.

Conclusion

RulE provides a principled framework for combining the strengths of neural embeddings and symbolic reasoning. While currently focused on chain rules, future work may extend the model to handle more complex logical structures like negation or disjunction, and integrate end-to-end rule discovery directly into the embedding process.

Summary updated

BibTeX
@inproceedings{tang2024rule,
  author = {Xiaojuan Tang and Song-Chun Zhu and Yitao Liang and Muhan Zhang},
  title = {{RulE: Knowledge Graph Reasoning with Rule Embedding}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=8Kx8e9XHKh},
}
Figure