Neural Logic Networks

Shaoyun Shi, Hanxiong Chen, Min Zhang, Yongfeng ZhangarXiv 2019

Introduction

Deep learning has achieved remarkable success in statistical pattern recognition, yet it often struggles with the structured, recursive nature of logical reasoning. Traditional symbolic AI, while excellent at logic, is brittle and lacks the generalization capabilities of neural networks. Neural Logic Networks (NLN) bridge this gap by introducing a dynamic neural architecture that constructs its computational graph on the fly to match the structure of logical expressions.

Architecture and Methodology

The core innovation of the NLN is its move away from static architectures. Instead of a fixed stack of layers, the network's structure is determined by the specific logical expression it processes.

Neural Logic Modules

The basic logical operators—AND, OR, and NOT—are implemented as small Multi-Layer Perceptrons (MLPs). Every logic variable and constant (True/False) is represented as a $d$-dimensional vector.

The NLN architecture dynamically constructs a computational graph based on the input logical expression, evaluating truth values through vector similarity.

Logic Regularization

To ensure these neural modules behave like logical gates, the authors introduce "logic regularization." This involves loss terms derived from fundamental logical laws, such as idempotence ($w \land w \approx w$) and complementation ($w \land \neg w \approx \text{False}$). These constraints act as a "logical physics," guiding the differentiable modules to follow the rules of propositional logic.

Dynamic Construction

For any given expression, such as $(v_i \land v_j) \lor \neg v_k$, the NLN assembles the corresponding modules into a tree structure. The final output vector is compared against a fixed "True" vector using a similarity module to determine the expression's truth value. To manage complexity, all input expressions are transformed into Disjunctive Normal Form (DNF).

Experimental Evaluation

The authors evaluated NLN on both simulated logical data and real-world recommendation tasks.

  • Simulated Logical Data: On randomly generated boolean expressions with up to 20,000 variables, NLN achieved an accuracy of 97.16%, significantly outperforming sequence models like Bi-LSTMs (61.28%).
  • Recommendation Systems: Using datasets like ML-100k (MovieLens) and Amazon Electronics, user-item interactions were modeled as logical expressions. NLN outperformed state-of-the-art models like Neural Collaborative Filtering (NCF), achieving a Preference AUC of 0.8211 on ML-100k.

Key Insights

The Importance of Structure

Standard sequence models fail on logical tasks because they treat expressions as flat strings. NLN's success stems from explicitly mirroring the expression's hierarchy in its architecture.

Emergent Semantic Clustering

A key finding is that the model naturally learns to organize its vector space. t-SNE visualizations of the learned variable embeddings show that the model clusters "True" and "False" variables into distinct, separable groups, demonstrating that it captures the underlying semantics of the logic.

t-SNE visualization of learned embeddings shows clear separation between positive (true) and negative (false) variables.

Fuzzy Logic for Human Preference

By treating recommendation as a "fuzzy" logical inference problem, NLN handles the inherent uncertainty of human behavior while benefiting from the structural constraints of formal logic.

Conclusion and Future Work

Neural Logic Networks provide a robust framework for combining symbolic reasoning with deep learning. While currently focused on propositional logic, future work aims to extend the model to predicate logic, involving quantifiers and complex relations. This approach opens new avenues for reasoning tasks in knowledge graphs and automated theorem proving.

Summary updated

BibTeX
@misc{shi2019neural,
  author = {Shaoyun Shi and Hanxiong Chen and Min Zhang and Yongfeng Zhang},
  title = {{Neural Logic Networks}},
  year = {2019},
  eprint = {1910.08629},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.08629},
}
Figure