Abstract
Deep learning models are typically viewed as "black boxes," excelling at pattern recognition but faltering on discrete algorithmic tasks. This paper introduces Neural Logic Networks (NLNs), a differentiable framework that utilizes Boolean logic operators (AND, OR, XOR) to learn explicit, human-readable algorithms. NLNs demonstrate the ability to learn complex recursive tasks, such as decimal multiplication and sorting, from a small number of examples while maintaining symbolic interpretability and superior generalization capabilities.
Introduction
While Multi-Layer Perceptrons (MLPs) are effective for continuous data, they struggle with the discrete logic required for algorithmic reasoning. For instance, learning decimal multiplication from input-output pairs is notoriously difficult for standard neural architectures. The primary challenges include a lack of interpretability, poor generalization to larger problem instances, and low data efficiency. While Inductive Logic Programming (ILP) addresses symbolic reasoning, it is generally non-differentiable, making it difficult to integrate with modern deep learning. Neural Logic Networks bridge this divide by integrating differentiable logic gates into a neural architecture.
Methods
The fundamental building blocks of NLNs are differentiable logic gates. Unlike standard neurons that use weights and biases to compute linear combinations, NLN neurons use "membership weights" ($m_i$) to determine whether an input variable is included in a logical conjunction (AND) or disjunction (OR).
As shown in the truth tables above, the membership weights allow the model to learn which inputs are relevant to a specific logical clause. Because these operations are formulated algebraically, they are fully differentiable, enabling training via standard gradient descent methods like ADAM. Furthermore, the architecture includes a specialized Neural XOR layer to handle high-dimensional parity problems and a Neural ILP solver that supports recursion and the invention of helper predicates (sub-routines).
Results and Evaluation
The efficacy of NLNs was tested across several domains, demonstrating significant improvements over existing neural logic solvers:
- Symbolic Benchmarks: NLNs achieved a 100% success rate on 20 standard ILP problems, including FizzBuzz and graph coloring, where previous solvers like dILP struggled.
- Recursive Tasks: The model successfully discovered recursive algorithms for decimal addition, multiplication, and list sorting. The ability to learn a recursive solution for sorting is a significant milestone, as it involves complex clauses with multiple atoms and variables previously unreachable by neural ILP methods.
- Generalization: In LDPC decoding tasks, NLNs showed sustained performance improvements with increased iterations during test time, whereas MLP-based models often exhibited performance degradation.
Discussion and Conclusion
NLNs offer a path toward interpretable AI by embedding symbolic logic directly into the network structure. The learned membership weights provide a transparent look into the model's "reasoning," allowing the discovered Boolean formulas to be directly verified by humans. While the current implementation is sensitive to initialization in high-dimensional spaces and primarily focused on discrete logic, it represents a significant step toward combining the strengths of deep learning and symbolic AI. Future research will explore extending NLNs to handle noisy, continuous real-world data while maintaining their inherent interpretability.
Summary updated