DeepLog: Unified Neurosymbolic AI
- DeepLog is a neurosymbolic framework that integrates Boolean, fuzzy, and probabilistic logics via a declarative language with neural annotations.
- It compiles advanced neurosymbolic models into efficient algebraic circuits, achieving significant speedups through CPU and GPU optimizations.
- The system supports flexible integration styles—embedding logic in the architecture or applying it in the loss function—facilitating scalable and rapid experimentation.
DeepLog is a theoretical and operational framework for neurosymbolic artificial intelligence providing language-level and computational abstractions that unify Boolean, fuzzy, and probabilistic logics. At its core, DeepLog serves as a “neurosymbolic abstract machine,” comprising a language for specifying neurosymbolic models and a computational substrate based on extended algebraic circuits. The framework offers an intermediate declarative language for annotating logic with neural components, and compiles this representation to efficient executable computational graphs, with support for execution on both CPUs and GPUs. This design enables representation and emulation of a broad spectrum of neurosymbolic systems, establishing DeepLog as a foundational approach for expressing and executing neurosymbolic AI models, accommodating diverse logical semantics, integration modalities, and performance requirements (Derkinderen et al., 19 Aug 2025).
1. Language Structure and Semantics
DeepLog establishes a three-tier architecture: high-level modeling, the DeepLog language as an intermediate layer, and computation via algebraic circuits. The language extends grounded first-order logic, permitting annotation of specific predicates as learnable neural components and abstracting over Boolean, fuzzy, and probabilistic semantics.
The signature of a DeepLog program is a tuple
where is a finite set of constants, is a finite set of predicate symbols with fixed arity and typed argument domains, and is the distinguished subset of neural predicates whose ground instances are labeled by parameterized neural networks.
Clauses in a DeepLog program take the form
where head and each body atom are ground atoms. Neural annotation is specified via
which links ground atoms to the output of neural network on inputs .
Semantics are determined by an abstract algebraic structure
with a set of labels, a set of unary ops, and a set of binary ops. Canonical instances include:
- Boolean:
- Fuzzy (t-norm):
- Probabilistic:
Interpretation of formulas is by structural induction on these algebraic operations, allowing both crisp and soft semantics, as well as probabilistic modeling.
2. Computational Model: Algebraic Circuits
Every DeepLog formula is compiled into a single computational graph termed an extended algebraic circuit. This acyclic directed graph has leaves as labeling functions (atomic ground atoms or neural inferences) and interior nodes as associative, commutative binary gates—addition () and multiplication () in the appropriate algebraic structure.
The compilation workflow includes:
- Grounding the program with respect to a query to generate a propositional atom theory
- Compiling Boolean structure (e.g., ) into a decomposable deterministic DNNF (d-DNNF) or SDD, mapping logical OR to decomposable sum and AND to decomposable product
- Pushing algebraic transformations (e.g., or fuzzy embeddings) down to ensure all gates are in the chosen semiring
- Collapsing factorized beliefs into product nodes
Key algebraic mechanisms include aggregation over interpretations ( or over assignments), belief factorization via product, marginalization by sum, and neural activation as differentiable graph leaves.
3. Logical–Neural Integration Design Patterns
DeepLog enables declarative specification of the mode of logic integration in a neurosymbolic system, distinguishing:
- Logic in the Architecture (Rules): Logical rules are embedded in the forward pass as extra layers. Predictions are structurally guaranteed to satisfy rules (to the extent permitted by neural errors); e.g., modeling diagnostics like “Alarm :- Burglary ∨ Earthquake.”
- Logic in the Loss (Constraints): Neural predictions are unconstrained in the forward pass; logical constraints are imposed by augmenting the loss function . This soft approach guides optimization but does not enforce logic at inference.
- Declarative Semantics Selection: The user explicitly sets the semantics and associated operators in the program header (e.g., ; ; ), and the semantics propagate through all subsequent compilation stages.
This design supports flexibility in architectural choices and rapid experimentation across semantics and integration strategies.
4. Efficient Implementation and Hardware Acceleration
DeepLog is implemented with a focus on high-throughput circuit execution. Circuits are compiled into batched PyTorch modules using KLay. Circuit gates are implemented with fused GPU kernels (e.g., batched scatter_add for , scatter_mul for ), ensuring end-to-end execution occurs wholly on the GPU with no intervening CPU loops.
The framework demonstrates substantial improvements in computational efficiency over prior systems. Compared to CPU-based DeepProbLog, DeepLog’s vectorized scatter-gather achieves speedup on the CPU. GPU execution yields a further gain. For example, inference time per query for MNIST Addition is reduced as follows:
| #digits | DeepProbLog CPU (ms) | DeepLog CPU (ms) | DeepLog GPU (ms) |
|---|---|---|---|
| 1 | 6.1 | 0.011 | 0.00056 |
| 2 | 35 | 0.041 | 0.0015 |
| 3 | 132 | 2.4 | 0.15 |
| 4 | — | 196 | 54 |
DeepLog’s GPU-based implementation is therefore up to faster than DeepProbLog on CPU (Derkinderen et al., 19 Aug 2025).
5. Comparative Evaluation Across Logics and Architectures
Empirical studies demonstrate the adaptability and performance of DeepLog across various logical semantics and architectural choices.
- Fuzzy vs. Probabilistic Semantics: On Visual Sudoku (4×4), ProbLog () in-architecture yields AP 99.7%, Product t-norm 99.7%, Gödel 99.2%, and Lukasiewicz 50% (unstable). On MNIST Addition, in-architecture maintains accuracy up to 4 digits, fuzzy-product achieves ≈91%, while Gödel and Lukasiewicz semantics degrade.
- Logic-in-Architecture vs. Logic-in-Loss: Logic-in-architecture consistently outperforms logic-in-loss; for Sudoku, average precision is 52% for both loss and pure neural baseline, while architecture integration reaches 99.7%. The advantage becomes more pronounced as task complexity increases (e.g., MNIST Addition 4-digit: 91% vs 0%), indicating scalability and expressivity in enforcing logical constraints.
A plausible implication is that logic-in-architecture integration is crucial for complex neurosymbolic tasks where strict logical adherence is required, and that DeepLog’s abstraction layers facilitate switching among semantic choices and integration patterns without reengineering the computational backend.
6. Summary of Capabilities and Significance
DeepLog unifies the declarative specification and efficient computation of neurosymbolic systems across Boolean, fuzzy, and probabilistic logics. Key capabilities include:
- A single intermediate language for representing diverse logical semantics
- Neural annotation for making logical predicates differentiable and learnable
- Automatic compilation to efficient algebraic circuits executable on modern hardware
- Declarative control over logical–neural integration modalities
- Empirical gains in both predictive performance and computational efficiency over prior CPU-bound frameworks (Derkinderen et al., 19 Aug 2025)
These characteristics position DeepLog as a foundational infrastructure for neurosymbolic research, supporting rapid prototyping, benchmarking, and exploration of advanced logical–neural models within a unified framework.