DeepStochLog: Neural Stochastic Logic Programming

Thomas Winters, Giuseppe Marra, Robin Manhaeve, Luc De Raedt

Abstract

DeepStochLog is a novel neuro-symbolic framework that integrates neural networks with stochastic logic programming. By shifting the underlying mathematical foundation from traditional "possible worlds" semantics to stochastic grammars, it bypasses massive computational bottlenecks. This approach achieves state-of-the-art accuracy on complex reasoning tasks while running orders of magnitude faster than existing neuro-symbolic systems.

Introduction

Neuro-symbolic AI aims to combine the pattern-recognition power of neural networks with the strict, interpretable reasoning of symbolic logic. A popular implementation method involves Probabilistic Logic Programs (PLPs), such as DeepProbLog, which use neural networks to process sub-symbolic data (like images) and logic rules to reason over them.

However, PLPs suffer from a severe scalability bottleneck known as the "disjoint-sum problem." They rely on "distribution semantics," which calculates probabilities by summing over all valid combinations of probabilistic facts. As reasoning chains grow, the number of possible worlds explodes, causing these systems to time out on tasks as simple as adding multi-digit numbers parsed from images.

Methods

To address this scalability issue, DeepStochLog replaces PLPs with Stochastic Logic Programs (SLPs)—specifically, Stochastic Definite Clause Grammars (SDCGs). While PLPs calculate probabilities on a random graph, SLPs function like a random walk, significantly simplifying the computation.

Neural Grammar Rules and Tabling

The framework extends standard grammar rules with neural networks. For instance, a rule can process an image of a handwritten digit through a Convolutional Neural Network (CNN) to output a probability distribution. To handle inference, DeepStochLog utilizes SLG resolution with tabling (memoization). This acts as a dynamic programming layer that caches intermediate proofs, preventing the redundant calculations that typically lead to exponential complexity.

Differentiable Logic Circuits

Logical derivations are compiled into a differentiable AND-OR circuit. Probabilities are computed via a bottom-up pass, where AND operations are replaced with multiplication and OR operations with addition.

The AND-OR circuit allows for differentiable probabilistic inference, enabling end-to-end training via backpropagation.

Because the entire circuit is differentiable, the system can be trained end-to-end using standard gradient descent (e.g., Adam), backpropagating errors through the logic circuit directly into the neural network weights.

Key Results

The authors evaluated DeepStochLog across several tasks, including MNIST addition, handwritten formula evaluation, and relational graph classification (Cora/Citeseer).

  • Efficiency: On MNIST addition (length 3), DeepStochLog performed inference in just 4.0ms, compared to 199.7ms for DeepProbLog.
  • Scalability: DeepStochLog scaled to complex handwritten formulas where competing methods failed. As shown in the experimental results, while DeepProbLog (DPL) and other baselines timed out as expression length increased, DeepStochLog maintained high accuracy and stability.
Comparison of accuracy and scalability across varying expression lengths. DeepStochLog (DSL) avoids the timeouts that plague DeepProbLog (DPL) as complexity increases.

Discussion and Future Work

DeepStochLog demonstrates that semantics matter for speed. By switching to random walk semantics, it entirely avoids the disjoint-sum problem. Furthermore, the use of "empty production rules" allows the system to function as a general-purpose logic program beyond simple sequence parsing.

Currently, the framework requires pre-defined logic rules and does not perform structure learning. Future work may involve parallelizing AND-OR circuits to further increase speed and exploring the model's potential for generative tasks, such as sequence synthesis.

Summary updated

BibTeX
@inproceedings{winters2022deepstochlog,
  author = {Thomas Winters and Giuseppe Marra and Robin Manhaeve and Luc De Raedt},
  title = {{DeepStochLog: Neural Stochastic Logic Programming}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i9.21248},
}
Figure