Neurosymbolic programming in 2026: programs with neural parts and logic rules
What is neurosymbolic programming? It is writing programs that combine neural modules with symbolic code such as logic rules, so a network reads raw input and the rules reason over it exactly. The 2021 survey by Chaudhuri, Ellis, Polozov, Singh, Solar-Lezama and Yue describes it as learning functions from data that are represented as programs using neural modules alongside symbolic primitives.
Key number: DeepProbLog solves MNIST addition with a single rule, addition(X, Y, Z) :- digit(X, A), digit(Y, B), Z is A + B. Only the digit network is learned, from pairs of images labelled with their sum. (source: arXiv 1805.10872)
Last checked: 2026-12-05. Tool facts from each GitHub repository and the GitHub REST API on that date; papers linked in Evidence.
TL;DR A neurosymbolic program has two kinds of parts. Neural modules turn images, audio or text into facts with probabilities. Symbolic parts, such as Datalog rules or plain code, reason over those facts and can show a proof. Because the reasoning is differentiable or probabilistic, the whole program trains from examples. Try it with the addition program below, then compare the tools.
MNIST addition: two neural guesses, one logic rule, a proof for the sum
The program: addition(X, Y, Z) :- digit(X, A), digit(Y, B), Z is A + B. The neural predicate digit is a network that reads a handwritten digit and returns probabilities. Set what the network thinks it sees.
Presets
| Sum Z | Probability | Digit pairs that prove it |
|---|
Act as an AI engineer. Read https://xerj.org/science/neurosymbolic-programming and https://xerj.org/compare/neurosymbolic-ai-frameworks-2026. Find one task in my project where a model reads messy input and a rule could do the reasoning, write the rule as Datalog or plain code, and sketch how the model's output feeds it. Index my repo with https://xerj.org first and cite file paths.
How neurosymbolic programming works
Think of it in three steps. First, a neural predicate wraps a network: digit(img, 3) is true with the probability the network gives. Second, a symbolic program states what you already know, such as how addition works or which rules a decision must follow. Third, a reasoner runs the program over the uncertain facts and adds up the probability of every proof of the answer.
Training works backwards through the same proofs. In the demo, a label of 8 gives credit only to digit readings that can add up to 8, so the network learns to read digits without ever seeing a digit label. DeepProbLog does this on top of the ProbLog language, and Scallop does it with Datalog and provenance semirings.
Neurosymbolic programming languages and tools
Six open source projects you can run today. For a filterable table with more frameworks, solvers and agent memory engines, see neurosymbolic AI frameworks 2026.
| Tool | Language | Licence | GitHub stars | What it is |
|---|---|---|---|---|
| Scallop | Datalog, Rust and Python | MIT | 530 | Datalog with recursion, aggregation and negation, plus differentiable reasoning on provenance semirings; scallopy plugs into PyTorch. Paper at PLDI 2023. |
| DeepProbLog | ProbLog, Python | Apache-2.0 | 367 | ProbLog with neural predicates, trained end to end from examples such as pairs of digit images labelled with their sum. |
| Logic Tensor Networks | Python | MIT | 377 | First-order fuzzy logic written as tensor operations, so rules become part of the training loss. |
| DeepLog | Python, PyTorch | LGPL-2.1 | 30 | KU Leuven framework that compiles neurosymbolic languages into arithmetic circuits inside standard PyTorch workflows. Paper at IJCAI 2026. |
| DOLPHIN | Python | MIT | 22 | Writes neurosymbolic programs in Python, runs the symbolic part on the CPU and batches probabilities and gradients on the GPU. Paper at ICML 2025. |
| SymbolicAI | Python | BSD-3-Clause | 1,787 | Mixes plain Python code with LLM operations and contracts that check the results. |
Stars, licences and languages from the GitHub REST API on 2026-12-05. Paper venues from each paper's page, linked in Evidence.
Why write the reasoning as a program
The 2021 survey Neurosymbolic Programming in Foundations and Trends in Programming Languages gives four reasons. Programs handle long, step by step tasks well. They are easier to read and formally verify than a network. The limits of a programming language act as regularization, which helps a model learn from less data and generalize further. And a learned module, such as a digit reader, can be reused in new programs.
DeepProbLog shows the reuse point: a model trained on single digit sums is evaluated on numbers with three digits, with a small change to the logic program and no new training.
Neurosymbolic programming with LLMs
In 2026 the neural part is often a large language model. The model reads the question and writes a program, a set of facts or solver constraints; an interpreter, Datalog engine or SMT solver runs it and returns an answer you can check. See neurosymbolic reasoning for a live rule engine, neurosymbolic AI vs LLM for when to add a solver, and symbolic AI for the rule half on its own.
How XERJ uses it
XERJ is a new way for AI to search for data, with a neurosymbolic model inside. XERJ Query-1 compiles a prompt to a search program you can read and checks the result against stored facts, and XERJ Reader-1 writes a formula over a document that a separate engine calculates. See XERJ Query-1 and neurosymbolic models.
Read next
- Neurosymbolic AI 2026: what it is, how it works, examples
- Neurosymbolic AI examples
- Neurosymbolic AI frameworks 2026
FAQ
What is neurosymbolic programming?
Neurosymbolic programming is writing programs that combine neural modules with symbolic code such as logic rules. A neural network turns raw input like images or text into facts, and the rules reason over those facts exactly. The program can be trained end to end from examples.
What is an example of neurosymbolic programming?
The classic example is MNIST addition from the DeepProbLog paper. A neural network reads two handwritten digits, and one rule adds them: addition(X, Y, Z) :- digit(X, A), digit(Y, B), Z is A + B. The network learns to read digits from pairs labelled only with their sum.
Which languages are used for neurosymbolic programming?
Datalog in Scallop, ProbLog in DeepProbLog, fuzzy first-order logic in Logic Tensor Networks, and plain Python in DOLPHIN and SymbolicAI. Most of them connect to PyTorch so the neural parts train with ordinary gradient descent.
How is neurosymbolic programming different from deep learning?
Deep learning learns one large network for the whole task. Neurosymbolic programming learns only the perception parts and writes the reasoning as a program. The 2021 survey by Chaudhuri and colleagues lists the gains: programs are easier to read and verify, need less data, generalize further and reuse learned modules.
Is neurosymbolic programming the same as neurosymbolic AI?
It is the programming side of neurosymbolic AI. Neurosymbolic AI is the whole field of joining neural networks with symbolic reasoning; neurosymbolic programming is the practical way to build such a system as code you can run, read and train.
Can LLMs do neurosymbolic programming?
Yes. A common 2026 pattern has an LLM write a small program or a set of logic facts, and a solver or interpreter runs it and checks the result. The LLM is the neural part, and the program is the symbolic part you can read.
Evidence
- Definition and benefits of neurosymbolic programming: Chaudhuri, Ellis, Polozov, Singh, Solar-Lezama and Yue, Neurosymbolic Programming, Foundations and Trends in Programming Languages 7 (3): 158 to 243, published December 2021. Source: https://www.nowpublishers.com/article/Details/PGL-049
- DeepProbLog, neural predicates, the MNIST addition rule, training on pairs labelled with their sum, and evaluation on three digit numbers. Source: https://arxiv.org/abs/1805.10872
- Scallop: Datalog with recursion, aggregation and negation, differentiable reasoning based on provenance semirings, PLDI 2023 (PACMPL 7, PLDI). Source: https://arxiv.org/abs/2304.04812
- DeepLog: compiles neurosymbolic languages into optimized arithmetic circuits in PyTorch, IJCAI 2026. Source: https://ijcai.org/proceedings/2026/0980.pdf
- DOLPHIN: neurosymbolic programs in Python, symbolic reasoning on the CPU and vectorized probabilistic computation on the GPU, PMLR volume 267 (ICML 2025). Source: https://proceedings.mlr.press/v267/naik25a.html
- GitHub stars, licences and languages for the six tools from the GitHub REST API on 2026-12-05. Sources: the repository links in the table.