IBM/LNN

A `Neural = Symbolic` framework for sound and complete weighted real-value logic

Logical Neural Networks (LNN)

What it is – LNN is an open‑source Python library that implements Logical Neural Networks, a neuro‑symbolic framework that blends the learning ability of neural nets with the explicit reasoning of symbolic logic. Each neuron corresponds to a logical formula component, giving a fully interpretable, differentiable model that can perform logical inference, theorem proving, and handle uncertain or incomplete knowledge.

Key ideas

  • Neuro‑symbolic representation – neurons carry weighted real‑valued truth values, so the network encodes a weighted logical formula.
  • Omnidirectional inference – the system can answer any query, not just pre‑specified targets, by propagating truth bounds throughout the network.
  • End‑to‑end differentiable – a custom loss measures logical contradiction, allowing gradient‑based learning even when the knowledge base contains inconsistencies.
  • Open‑world semantics – truth values are maintained as intervals (bounds), supporting probabilistic interpretation and resilience to missing facts.

Typical use cases

  • Building AI systems that need both learning from data and explicit reasoning (e.g., knowledge‑graph completion, rule‑based decision support).
  • Research on neuro‑symbolic AI, theorem proving, or explainable AI where interpretability of the model is crucial.
  • Situations where the knowledge base may be noisy, contradictory, or incomplete, and you still want a trainable model.

Getting started

# Clone and set up the exact environment (requires Python 3.11+)
git clone https://github.com/IBM/LNN
cd LNN
uv sync --locked          # install runtime dependencies
# Run the test suite to verify the install
uv sync --locked --extra dev
uv run pytest -v

The repository ships with extensive documentation, tutorials, and API reference hosted on Read the Docs.

Documentation & resources

  • Read the Docs – full user guide, API reference, and examples: https://ibm.github.io/LNN/
  • Academic papers – links to the original arXiv paper and follow‑up work.
  • Educational material – notebooks and walkthroughs for newcomers.
  • Neuro‑Symbolic AI team page – context about the research group behind LNN.

License – Apache 2.0 (permissive, commercial‑friendly).

Citation – If you use LNN in research, cite the 2020 arXiv paper:

@article{riegel2020logical,
  title={Logical neural networks},
  author={Riegel, Ryan and Gray, Alexander and Luus, Francois and Khan, Naweed and Makondo, Ndivhuwo and Akhalwaya, Ismail Yunus and Qian, Haifeng and Fagin, Ronald and Barahona, Francisco and Sharma, Udit and others},
  journal={arXiv preprint arXiv:2006.13155},
  year={2020}
}

Related

  • Project
  • Dispatch
  • Project
  • Project