Papers › LTNtorch: PyTorch Implementation of Logic Tensor Networks

LTNtorch: PyTorch Implementation of Logic Tensor Networks

24 Sep 2024arXiv:2409.16045archive 2025-07-28

Tommaso Carraro, Luciano Serafini, Fabio Aiolli

Logic Tensor Networks (LTN) is a Neuro-Symbolic framework that effectively incorporates deep learning and logical reasoning. In particular, LTN allows defining a logical knowledge base and using it as the objective of a neural model. This makes learning by logical reasoning possible as the parameters of the model are optimized by minimizing a loss function composed of a set of logical formulas expressing facts about the learning task. The framework learns via gradient-descent optimization. Fuzzy logic, a relaxation of classical logic permitting continuous truth values in the interval [0,1], makes this learning possible. Specifically, the training of an LTN consists of three steps. Firstly, (1) the training data is used to ground the formulas. Then, (2) the formulas are evaluated, and the loss function is computed. Lastly, (3) the gradients are back-propagated through the logical computational graph, and the weights of the neural model are changed so the knowledge base is maximally satisfied. LTNtorch is the fully documented and tested PyTorch implementation of Logic Tensor Networks. This paper presents the formalization of LTN and how LTNtorch implements it. Moreover, it provides a basic binary classification example.

PaperPDFCode

Code

tommasocarraro/ltntorch officialmentioned in paperpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Binary ClassificationLogical ReasoningTensor Networks

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

BASESET

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections