Back to AI Research

AI Research

NeSyCat Torch: A Differentiable Tensor Implementati... | AI Research

Key Takeaways

  • NeSyCat Torch: A Differentiable Tensor Implementation of Categorical Semantics for Neurosymbolic Learning Neurosymbolic AI aims to bridge the gap between the...
  • Neurosymbolic semantics is fragmented: classical, fuzzy, probabilistic and neural systems each define truth by their own inductive rules.
  • NeSyCat, extending ULLER, subsumes them under a single inductive definition of truth, parametric in a strong monad and an aggregation structure on truth-values.
  • NeSyCat has so far lacked an account of predicates and functions learned by neural networks.
  • We provide NeSyCat Torch as the missing link and interpret computational symbols via neural networks, implementing the framework in probabilistic programming and tensor-based backends.
Paper AbstractExpand

Neurosymbolic semantics is fragmented: classical, fuzzy, probabilistic and neural systems each define truth by their own inductive rules. NeSyCat, extending ULLER, subsumes them under a single inductive definition of truth, parametric in a strong monad and an aggregation structure on truth-values. NeSyCat has so far lacked an account of predicates and functions learned by neural networks. We provide NeSyCat Torch as the missing link and interpret computational symbols via neural networks, implementing the framework in probabilistic programming and tensor-based backends. We use the distribution monad for reference semantics and metric evaluation, and complement it by a monad for numerically stable, differentiable training: the lazy log-tensor monad over the log-semiring. For efficient training in batches, we furthermore employ a batch monad. The axioms are the source code: written once in monad-based do-notation, monadic bind performs marginalisation, lazily pruning unneeded branches. On MNIST addition, our HaskTorch, JAX, and PyTorch implementations outperform LTN and DeepProbLog in speed and accuracy, while achieving nearly the accuracy of DeepStochLog. However, unlike DeepStochLog, we stay in a uniform framework that applies to many first-order NeSy approaches. Namely, the construction is parametric in the monad; instantiating it with, e.g., the Giry monad extends the approach to continuous probability (working out a neural representation here is left for future work).

NeSyCat Torch: A Differentiable Tensor Implementation of Categorical Semantics for Neurosymbolic Learning

Neurosymbolic AI aims to bridge the gap between the intuitive, perceptual power of neural networks and the rigorous, verifiable reasoning of symbolic logic. Historically, this field has been fragmented, with different approaches—such as classical, fuzzy, and probabilistic logic—relying on their own unique rules for defining "truth." This paper introduces NeSyCat Torch, a framework that unifies these disparate systems under a single, consistent mathematical structure. By using categorical semantics, the authors provide a way to integrate neural networks into this unified framework, allowing for efficient, differentiable learning across various logical paradigms.

A Unified Mathematical Foundation

The core of the approach is the use of monads—a concept from functional programming used to handle computational effects. By treating logical reasoning as a series of monadic operations, the authors show that different types of neurosymbolic systems are simply different "choices" of monads. This allows researchers to write their logical axioms once using standard programming syntax (specifically, monad-based "do-notation") and apply them across different logical frameworks without needing to rewrite the underlying logic for each one.

Implementing Neural Integration

While previous iterations of NeSyCat provided the theoretical framework, they lacked a practical way to incorporate neural networks as predicates and functions. NeSyCat Torch addresses this by implementing the framework using tensor-based backends like PyTorch, JAX, and HaskTorch. To ensure the system is both efficient and numerically stable, the authors employ a "lazy log-tensor monad." This allows the system to perform complex calculations—such as marginalization—only when necessary, which significantly optimizes the training process.

Performance and Efficiency

The authors tested their implementation on the task of MNIST addition, a common benchmark for neurosymbolic systems. Their results demonstrate that NeSyCat Torch outperforms existing frameworks like LTN and DeepProbLog in both speed and accuracy. While it achieves performance levels nearly identical to DeepStochLog, the authors emphasize that their approach is more versatile. Because it is parametric in the monad, it provides a uniform framework that can be adapted to other first-order neurosymbolic approaches simply by swapping the underlying monad.

Future Directions

The framework is designed to be highly modular. By changing the monad, the system can be extended to handle different types of data and reasoning. For example, the authors note that instantiating the framework with the "Giry monad" could extend the approach to continuous probability. While they have established the foundational implementation for neural representations, they leave the specific neural architecture for continuous probability as an area for future research.

Comments (0)

No comments yet

Be the first to share your thoughts!