NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Differentiable Logic Machines

Matthieu Zimmer, Xuening Feng, Claire Glanois, Zhaohui Jiang, Jianyi Zhang, Paul Weng, Dong Li, Jianye Hao, Wulong Liu

Abstract

Differentiable Logic Machines (DLM) introduce a novel neuro-symbolic architecture capable of learning first-order logic programs through gradient descent. By placing learnable weights on predicates instead of rule templates, DLM achieves significant improvements in scalability and performance across Inductive Logic Programming (ILP) and Reinforcement Learning (RL) tasks. The resulting models are not only high-performing but also yield human-readable, executable logic rules, addressing the long-standing trade-off between neural robustness and symbolic interpretability.

Introduction

The AI community has long sought to combine the robust learning capabilities of neural networks with the clear, symbolic reasoning of logic. Traditional Inductive Logic Programming (ILP) offers high interpretability but struggles with noise and exponential search spaces. Conversely, "Neural-Logic" attempts like the Neural Logic Machine (NLM) are powerful but often rely on black-box Multi-Layer Perceptrons (MLPs), rendering the final reasoning opaque.

Previous differentiable logic approaches, such as $\partial$ILP, attempted to solve this by relaxing logic into a continuous space. However, these methods scaled poorly because they assigned weights to every possible rule template. DLM addresses this scalability-interpretability tradeoff by building a system that learns complex relational rules via gradients while remaining efficient enough for large-scale problems and transparent enough to output simple logic formulas.

Methodology

The DLM architecture is inspired by the hierarchical structure of NLMs but replaces neural "black boxes" with interpretable logic modules.

Predicate-Based Weighting

A key innovation in DLM is Predicate-Based Weighting. Instead of weighting every possible rule, DLM assigns weights to the input predicates of each module. This significantly reduces the parameter count, improving scalability and stability during training.

Core Operations and Logic Modules

DLM utilizes standard relational operations: Expansion (adding variables), Reduction (existential/universal quantification), and Permutation (reordering variables). It introduces two crucial additions: Negation and Preservation (allowing a predicate to pass through layers unchanged).

The DLM architecture consists of multiple layers of logic modules. Each module (right) uses soft AND/OR gates with predicate-based weighting to learn relational rules.

Each layer consists of "soft" (fuzzy) AND and OR gates. To transition from continuous weights to discrete logic, the authors employ Gumbel-Softmax with temperature annealing and dropout. This process effectively "hardens" the model into a symbolic program by the end of training.

Relational Actor-Critic

For Reinforcement Learning (RL) tasks, the authors designed a novel GRU-based critic. This critic processes relational state data (atoms and predicates) to estimate state values, enabling the use of Proximal Policy Optimization (PPO) within a relational framework.

Evaluation and Datasets

The model was evaluated across two primary domains:

  1. Inductive Logic Programming (ILP): Tasks included learning family relations (e.g., IsGrandparent, IsMaternalGreatUncle) and graph reasoning (e.g., AdjacentToRed, 4-Connectivity).
  2. Reinforcement Learning (RL): Classic tasks like Blocks World (Stack, Unstack) and algorithmic tasks such as Sorting (swapping list elements) and Path (finding shortest paths in a graph).

Key Results

  • ILP Performance: DLM solved 100% of the considered ILP problems. It demonstrated superior stability compared to $\partial$ILP, with a success rate for different random seeds up to 3.5x higher.
  • RL and Generalization: On the Sorting task, DLM outperformed other neural-logic RL approaches by up to 3.9% in reward. In Blocks World, enforcing interpretability actually improved generalization to larger environments compared to non-interpretable neural baselines.
  • Efficiency: Extracted logic programs are significantly faster and more memory-efficient during testing than the original neural weights, as they operate on Boolean tensors rather than floating-point tensors.

Discussion and Limitations

While DLM represents a significant step forward, several challenges remain. The model currently struggles with sparse reward environments where goals are rarely reached during exploration. Additionally, it does not natively support recursive logic definitions in a single pass, though incremental training provides a partial solution. The current fragment of logic (Datalog-like) also lacks support for function symbols (e.g., f(x)), limiting its application in certain mathematical domains. Future work will focus on resolving the tension between curriculum learning and the "hardening" of logic gates required for interpretability.

Summary updated

BibTeX
@article{zimmer2023differentiable,
  author = {Matthieu Zimmer and Xuening Feng and Claire Glanois and Zhaohui Jiang and Jianyi Zhang and Paul Weng and Dong Li and Jianye Hao and Wulong Liu},
  title = {{Differentiable Logic Machines}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2023},
  url = {https://openreview.net/forum?id=iHh3ArlnS4},
}
Figure