NeuralLog: Natural Language Inference with Joint Neural and Logical Reasoning

Zeming Chen, Qiyue Gao, Lawrence S. Moss

Introduction

Natural Language Inference (NLI) is the task of determining whether a premise sentence entails, contradicts, or is neutral toward a hypothesis. While modern Deep Learning (DL) models like BERT have set new benchmarks, they often function as "black boxes," relying on statistical heuristics rather than transparent reasoning. Conversely, symbolic logic systems offer high explainability but are notoriously brittle, failing when faced with minor syntactic variations or missing background knowledge.

NeuralLog addresses this gap by framing NLI as a path-finding problem. It combines the precision of symbolic logic—specifically monotonicity-based reasoning—with the flexibility of neural networks to handle linguistic variety.

Methods: NLI as Path Planning

NeuralLog treats the transition from a premise to a hypothesis as a navigation task through a space of possible sentence transformations. The goal is to find a sequence of valid "edits" that bridge the gap between the two.

Transformation of a premise into a hypothesis via logical and syntactic edits

The system architecture consists of several key components working in concert:

  1. Search Engine: A beam search algorithm explores potential inference paths. It uses Sentence-BERT to calculate the Euclidean distance between the current state and the target hypothesis, prioritizing paths that appear closer to the goal.
  2. Polarity Annotation (Udep2Mono): Before transformation, sentences are processed to identify the "polarity" of each word (monotone, antitone, or neutral). This logical marking determines which substitutions are valid (e.g., replacing "dog" with "animal" is valid in a monotone context).
  3. Inference Modules:
    • Lexical/Phrasal Logic: These modules use external knowledge bases like WordNet and ConceptNet to perform logical substitutions based on polarity.
  4. Syntactic Variation: To handle rephrasing that logic cannot easily capture, a neural ALBERT model acts as a "bridge." It detects if two sentence chunks are paraphrases, allowing for "horizontal" moves like changing "down the road" to "along a roadway."
Overview of the NeuralLog hybrid inference framework

Evaluation and Results

The researchers tested NeuralLog on two distinct benchmarks to evaluate its versatility and logical depth: the SICK (Sentences Involving Compositional Knowledge) dataset and the MED (Monotonicity Entailment Dataset).

Performance on SICK

On the SICK dataset, which focuses on general semantic and syntactic phenomena, NeuralLog achieved 90.3% accuracy. This outperformed pure DL models like BERT-base (86.7%) and previous logic-based systems, demonstrating that the hybrid approach does not sacrifice general performance for logical precision.

Performance on MED

The model's true strength was revealed in the MED benchmark, a challenge set specifically designed for monotonicity reasoning. NeuralLog reached 93.4% accuracy, a stark contrast to standard BERT models, which struggled with a score of 44.7%. Even logic-augmented BERT variants only reached 71.6%, highlighting the superiority of NeuralLog's explicit symbolic engine.

Conclusion

NeuralLog demonstrates that the "one-dimensional" approach of using either pure logic or pure deep learning is insufficient for robust NLI. By using neural networks specifically to handle the "messiness" of natural language (syntactic variation) while letting a symbolic engine handle the "rules" of reasoning (monotonicity), the framework achieves both high accuracy and explainability. Future work will focus on reducing dependency on initial parse trees and expanding the system's common-sense knowledge base.

Summary updated

BibTeX
@inproceedings{chen2021neurallog,
  author = {Zeming Chen and Qiyue Gao and Lawrence S. Moss},
  title = {{NeuralLog: Natural Language Inference with Joint Neural and Logical Reasoning}},
  booktitle = {SEM},
  year = {2021},
  doi = {10.18653/v1/2021.starsem-1.7},
}
Figure