Skip to main content
QUICK REVIEW

[Paper Review] RuleBERT: Teaching Soft Rules to Pre-Trained Language Models

Mohammed Saeed, Naser Ahmadi|arXiv (Cornell University)|Aug 25, 2021
Topic ModelingComputer Science5 citations
TL;DR

RuleBERT introduces a method to teach pre-trained language models (PLMs) to perform probabilistic, deductive reasoning using soft logical rules—approximate rules with confidence scores—by fine-tuning on a novel synthetic dataset of 3.2 million examples. The approach uses a revised loss function that mimics probabilistic logic programming (LP^MLN), enabling RuleBERT to predict accurate probabilities even on unseen rules, achieving state-of-the-art performance on external reasoning benchmarks while transferring logical notions like negation and symmetry to the model's representations.

ABSTRACT

While pre-trained language models (PLMs) are the go-to solution to tackle many natural language processing problems, they are still very limited in their ability to capture and to use common-sense knowledge. In fact, even if information is available in the form of approximate (soft) logical rules, it is not clear how to transfer it to a PLM in order to improve its performance for deductive reasoning tasks. Here, we aim to bridge this gap by teaching PLMs how to reason with soft Horn rules. We introduce a classification task where, given facts and soft rules, the PLM should return a prediction with a probability for a given hypothesis. We release the first dataset for this task, and we propose a revised loss function that enables the PLM to learn how to predict precise probabilities for the task. Our evaluation results show that the resulting fine-tuned models achieve very high performance, even on logical rules that were unseen at training. Moreover, we demonstrate that logical notions expressed by the rules are transferred to the fine-tuned model, yielding state-of-the-art results on external datasets.

Motivation & Objective

  • To address the limitation of pre-trained language models (PLMs) in capturing and applying common-sense, logical reasoning, especially with uncertain (soft) rules.
  • To bridge the gap between PLMs and logical reasoning by enabling them to learn from approximate, confidence-weighted rules rather than only exact ones.
  • To develop a fine-tuning framework that allows PLMs to predict precise probabilities for hypotheses based on facts and soft rules.
  • To evaluate whether logical notions such as negation, symmetry, and composition are effectively transferred to the model’s internal representations.

Proposed method

  • The method formulates the reasoning task as a binary classification problem: given facts and soft rules, predict the probability of a hypothesis being true.
  • It introduces a synthetic dataset of 3.2 million examples derived from 161 real-world common-sense rules mined from DBpedia, with target probabilities computed via formal reasoning in LP^MLN.
  • A revised loss function is designed to mirror the probabilistic outcomes of LP^MLN, enabling the model to learn uncertainty propagation across multiple rules.
  • The model is fine-tuned on this synthetic data, allowing it to generalize to unseen rules and handle conflicting evidence.
  • The approach supports multi-variable rules and complex reasoning chains involving multiple rules.
  • Knowledge distillation is used to transfer logical invariants (e.g., negation, symmetry) into the model’s attention and representation layers.

Experimental results

Research questions

  • RQ1Can pre-trained language models be effectively fine-tuned to perform probabilistic, deductive reasoning with soft logical rules?
  • RQ2How well can a fine-tuned PLM generalize to logical rules it has not seen during training?
  • RQ3To what extent are logical invariants such as predicate negation and symmetry transferred to the model’s internal representations?
  • RQ4Can a revised loss function that emulates probabilistic logic programming improve the accuracy and calibration of PLM predictions for reasoning tasks?
  • RQ5Does teaching soft rules lead to state-of-the-art performance on external reasoning benchmarks?

Key findings

  • RuleBERT achieves a test accuracy of 0.863 on the bAbI task #15 in two epochs, outperforming RoBERTa (0.676), with a significant generalization advantage on small datasets.
  • On the CheckList QQP benchmark, RuleBERT reaches 0.422 accuracy after one epoch, significantly outperforming RoBERTa’s 0.0, though it begins to overfit after three epochs due to catastrophic forgetting.
  • The model generalizes effectively to unseen rules, achieving high performance even when fine-tuned on only 20 rules.
  • RuleBERT’s predicted probabilities are very close to those produced by a formal LP^MLN reasoner, demonstrating strong calibration and uncertainty modeling.
  • Fine-tuning with rules that encode symmetric or negated predicates transfers these logical invariants to the lower layers of the transformer, improving reasoning capabilities.
  • RuleBERT achieves new state-of-the-art results on three external reasoning datasets, confirming the effectiveness of teaching soft rules to PLMs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.