Learning Rules from KGs Guided by Language Models

Zihang Peng, Daria Stepanova, Vinh Thinh Ho, Heike Adel, Alessandra Russo, Simon OttarXiv 2024 · DOI

Introduction

Knowledge Graphs (KGs) serve as structured repositories of facts, such as (Paris, capitalOf, France), and are fundamental to modern semantic search and data analytics. However, due to their semi-automatic construction, KGs are often incomplete. Rule learning is a common technique used to infer missing facts; for instance, observing many instances of people born in a city being citizens of that country might lead to the rule: citizenOf(X, Z) ← bornIn(X, Y), locatedIn(Y, Z).

A significant hurdle in rule learning is data bias. If a KG predominantly contains facts about specific demographics, a learner might induce rules that are statistically "confident" within the incomplete dataset but factually incorrect in a global context. While previous approaches utilized KG embeddings to rank rules, this research explores whether the latent "common sense" and factual knowledge within pre-trained Large Language Models (LLMs), such as BERT, can provide a more robust evaluation metric.

Methodology: A Hybrid Ranking Approach

The proposed system integrates symbolic rule learning with LLM-based validation through a three-stage pipeline:

  1. Rule Extraction: Standard association rule mining is employed to extract Horn rules (logical implications) from the existing KG.
  2. LM-Based Evaluation: For each prediction generated by a rule, the system constructs a natural language prompt. For a predicted fact like livesIn(John, Budapest), the system queries the LM with: "John lives in [MASK]."
  3. Hybrid Ranking: Rules are ranked using a weighted combination of internal and external metrics: $$\mu(r) = (1 - \lambda) \cdot \mu_1(r) + \lambda \cdot \mu_2(r)$$ Here, $\mu_1$ represents traditional statistical confidence (e.g., PCA confidence), while $\mu_2$ is the external score derived from the LM's prediction rank. The parameter $\lambda$ (ranging from 0 to 1) allows for tuning the balance between KG statistics and LM knowledge.
System architecture illustrating the integration of Language Models into the rule learning and evaluation loop.

Experimental Setup

The approach was evaluated using Wiki44K, a benchmark derived from Wikidata containing 250,000 facts across 100 relations and 44,000 entities. To simulate real-world data sparsity, the researchers created a training set by removing 20% of the facts for every relation.

Key Results and Insights

The experiments yielded several critical findings regarding the synergy between structured data and language models:

  • The Hybrid "Sweet Spot": The highest precision in rule ranking was achieved when $\lambda$ was set between 0.4 and 0.6. This indicates that the most accurate results stem from a balanced reliance on both the empirical data in the KG and the general-purpose knowledge of the LM.
  • Correcting Sparse Data Bias: Traditional metrics often over-rank rules that are artifacts of biased sampling. The LM acts as a "sanity check," effectively filtering out these biased rules in favor of those that are globally true.
  • Zero-Shot Effectiveness: Notably, BERT was used "out of the box" without domain-specific fine-tuning. This suggests that the pre-existing factual knowledge in LLMs is sufficient to validate structured rules across diverse domains.
Average Precision across different top-K rule sets as a function of the tuning parameter λ.

As shown in the figure above, integrating the LM score ($\lambda > 0$) generally improves precision, particularly for the top-ranked rules. For the top-5 rules, even a high reliance on the LM ($\lambda = 1$) maintains strong performance compared to purely statistical methods.

Limitations and Future Directions

While promising, the current prototype faces challenges with multi-token entities (e.g., "New York City"), which required mapping to single tokens via sentence embeddings. Future work aims to address this through more sophisticated tokenization strategies. Additionally, while zero-shot performance was strong, fine-tuning the LM on the specific KG domain is expected to further enhance accuracy. Finally, extending this guidance to more complex logical frameworks beyond simple Horn rules remains a key area for exploration.

Summary updated

BibTeX
@misc{peng2024learning,
  author = {Zihang Peng and Daria Stepanova and Vinh Thinh Ho and Heike Adel and Alessandra Russo and Simon Ott},
  title = {{Learning Rules from KGs Guided by Language Models}},
  year = {2024},
  eprint = {2409.07869},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.07869},
}
Figure