Inductive Relation Prediction with Logical Reasoning Using Contrastive Representations

Yudai Pan, Jun Liu, Lingling Zhang, Tianzhe Zhao, Qika Lin, Xin Hu, Qianying Wang

Introduction

LogCo is a novel framework designed to master inductive relation prediction in knowledge graphs (KGs). Unlike traditional models that struggle with unseen entities, LogCo leverages Graph Convolutional Networks (GCNs) and a contrastive learning strategy to treat relational paths as logical rules. This approach allows the model to remain lightweight and interpretable while outperforming current state-of-the-art methods.

The Inductive Reasoning Challenge

Most Knowledge Graph models operate in a transductive setting, assuming a fixed set of entities. However, real-world KGs are dynamic, frequently encountering new entities. Inductive models address this by reasoning based on relational patterns rather than specific entity identities.

Inductive relation prediction using first-order rules. The model learns patterns like workIn(X, Z) ∧ locatedIn(Z, Y) → liveIn(X, Y) from training data and applies them to unseen entities in the test set.

Existing inductive models face two primary hurdles:

  1. Entity-Independence: Models often over-rely on specific entity features instead of abstract relational logic.
  2. Deficient Supervision: Identifying meaningful logical paths among millions of possibilities is challenging with standard supervised learning.

The LogCo Framework

LogCo (Logical reasoning with Contrastive representations) addresses these challenges through a three-stage pipeline:

The LogCo architecture, featuring subgraph extraction, contrastive representation learning with multiple loss functions, and joint training.
  1. Subgraph and Path Extraction: For a target entity pair, LogCo extracts an enclosing subgraph and relational paths (up to 3 hops) that serve as potential logical rule bodies.
  2. Contrastive Representation Learning: To bridge the supervision gap, LogCo employs "positive" (actual) and "negative" (corrupted) paths. It utilizes three distinct losses:
  3. Associative Contrast: Aligns subgraph topology with relational path semantics.
  4. Path Contrast: An InfoNCE-inspired loss to distinguish logical rules from noise.
  5. Supervised Training: Standard cross-entropy loss for final prediction accuracy.
  6. GCN & CNN Integration: A GCN captures structural neighborhoods, while a CNN or CBOW aggregates relation sequences, preserving the critical order of relations.

Experimental Evaluation

The model was evaluated on twelve inductive datasets derived from three standard benchmarks: WN18RR, FB15K-237, and NELL-995. Each dataset is split into four versions (v1-v4) with increasing sizes and complexity, where the test entities are entirely absent from the training set.

Key Results

LogCo achieved significant improvements over previous SOTA models like GraIL, CoMPILE, and TACT:

  • Performance: On WN18RR, LogCo improved the AUC-PR (Area Under the Precision-Recall Curve) by an average of 6.15% over GraIL.
  • Ranking: In the "Hits@10" metric, LogCo outperformed rule-based methods like RuleN by up to 12.54% on some datasets.
  • Efficiency: Despite its performance, LogCo is remarkably efficient. For example, on the WN18RR_v4 dataset, it uses roughly 17k parameters, whereas a competitor like CoMPILE requires over 34k.

Discussion and Insights

  • Paths as Rules: By treating a sequence of relations as the "body" of a Horn clause, the model bridges the gap between neural embeddings and symbolic logic.
  • Contrastive Learning as a "Denoise" Filter: Because KGs are sparse, most possible paths are logically useless. Contrastive learning forces the model to learn what a good rule looks like by comparing it against randomly corrupted paths.
  • Entity-Independence is Key: By focusing on the sequence of relations rather than the entities themselves, the model becomes truly inductive.
  • Interpretability: Unlike "black-box" neural models, LogCo provides attention weights ($\beta$) for each path, allowing researchers to see exactly which logical rules the model used to reach its conclusion.

Conclusion and Future Work

While powerful, LogCo has areas for improvement, such as dynamic path length exploration and better scalability for massive graphs. The authors also suggest extending the framework to common-sense knowledge graphs where entities are often free-form text.

Summary updated

BibTeX
@inproceedings{pan2022inductive,
  author = {Yudai Pan and Jun Liu and Lingling Zhang and Tianzhe Zhao and Qika Lin and Xin Hu and Qianying Wang},
  title = {{Inductive Relation Prediction with Logical Reasoning Using Contrastive Representations}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-main.286},
}
Figure