Papers
Topics
Authors
Recent
Search
2000 character limit reached

Deep Stochastic Logic Programs (DSLP)

Updated 22 May 2026
  • DSLP is a neural-symbolic framework that integrates logic programming with neural networks to enable context-dependent, probabilistic reasoning.
  • It replaces fixed rule probabilities with learnable distributions via neural modules, supporting both static and dynamic inference.
  • The approach facilitates end-to-end gradient optimization, scalable proof search, and interpretable derivations for complex reasoning tasks.

A Deep Stochastic Logic Program (DSLP) is a neural-symbolic framework that unifies stochastic logic programming with neural network parameterization, furnishing a principled, probabilistic approach to logical reasoning with learnable components. DSLPs generalize classical stochastic logic programs by replacing or augmenting scalar rule probabilities with neural network–parameterized, context-dependent distributions, supporting efficient, exact, or approximate inference in complex reasoning and perception tasks at scales previously intractable for probabilistic logic frameworks rooted in possible-world semantics (Winters et al., 2021, Jiao et al., 11 Nov 2025).

1. Formal Foundations

A DSLP is specified as a finite set of clauses of the form

C:  H    B1,,BmC: \; H \; \longleftarrow\; B_1, \dots, B_m

where HH and each BjB_j are atoms. In classical stochastic logic programs (SLPs), each clause is annotated with a probability λC[0,1]\lambda_C \in [0,1], such that the probabilities for all clauses with the same predicate head sum to 1. The execution or proof of a goal proceeds leftmost first (SLD resolution), choosing among applicable clauses based on the assigned probabilities, thus assigning a distribution over possible derivations (proof trees).

In DSLPs, fixed probabilities λC\lambda_C are generalized to neural parameterizations. In DeepStochLog, this is realized via neural grammar rules embedded into stochastic definite clause grammars (SDCGs), where the probability vector for rule alternatives is the output of a softmax over neural network activations. In DeepProofLog, a goal-conditioned neural scoring function

fθ(G,G)Rf_\theta(G, G') \in \mathbb{R}

produces context-dependent transition probabilities via

pθ(GG)=exp(fθ(G,G))HN(G)exp(fθ(G,H))p_\theta(G' \mid G) = \frac{\exp(f_\theta(G, G'))}{\sum_{H \in \mathcal{N}(G)} \exp(f_\theta(G, H))}

where N(G)\mathcal{N}(G) is the set of resolvents of the leftmost atom of GG (Winters et al., 2021, Jiao et al., 11 Nov 2025).

2. Neural and Symbolic Integration

DSLPs support both classical (static) and neural grammar rules:

  • Static rules retain fixed probabilities as in conventional SLPs or SDCGs.
  • Neural rules are declared as

nn(m,[I1,,Im],[O1,,OL],[D1,,DL])::AB1,,Bknn(m, [I_1, \ldots, I_m], [O_1, \ldots, O_L], [D_1, \ldots, D_L]) :: A \leftarrow B_1, \ldots, B_k

where HH0 specifies a neural module. For each input grounding, the network produces a categorical softmax distribution over output tuples. Each possible output instantiates a separate weighted grammar rule, with weights differentiated via the neural network (Winters et al., 2021).

In DeepProofLog, all clause choices are parameterized by neural scorers that aggregate embeddings of symbolic and subsymbolic tokens. Atoms and goals are embedded by neural functions, and transitions are scored by inner products in the embedding space (Jiao et al., 11 Nov 2025).

This design allows seamless composition of high-level logical abstraction with perception modules (e.g., image or text classifiers), enabling end-to-end training.

3. Probabilistic Semantics

The probability of a proof (SLD-derivation) HH1 is given by

HH2

The probability of goal HH3 yielding a terminal HH4 marginalizes over the set HH5 of all derivations that result in HH6:

HH7

In the neural case, these probabilities are differentiable functions of network weights, enabling gradient-based optimization. This direct marginalization over derivations distinguishes DSLPs from possible-worlds-based frameworks, substantially improving tractability for structured reasoning (Winters et al., 2021, Jiao et al., 11 Nov 2025).

4. Inference and Learning

DSLP inference is performed in two phases:

  1. Proof graph construction: Logical resolution (SLD or SLG with tabling) constructs a proof forest, compactly represented as a directed acyclic AND–OR graph. Tabling ensures each unique subgoal is proved once, making the representation polynomial in the number of distinct subgoals. For neural rules, the AND–OR graph is dynamically constructed with neural softmax outputs as rule weights (Winters et al., 2021).
  2. Probabilistic evaluation: The proof graph is compiled into an arithmetic circuit (sum-product for marginal, max-product for MPE). Each leaf is a neural or static rule weight. The inside (marginal) and outside (expected counts) probabilities are efficiently computed bottom-up. To perform exact inference, dynamic programming solves linear Bellman recursions over the proof states (Winters et al., 2021, Jiao et al., 11 Nov 2025).

Learning proceeds by minimizing a per-example loss, typically negative log-likelihood,

HH8

with gradients computed by backpropagation through both arithmetic circuit and neural modules. This aligns the learning dynamics with the EM algorithm for grammars, but is fully differentiable end-to-end (Winters et al., 2021).

DeepProofLog further recasts DSLP inference as solving a Markov Decision Process (MDP), where each state is a goal, actions correspond to clause–substitution pairs, and policies are neural distributions over clause choices. This enables application of modern reinforcement learning (policy-gradient, PPO) and exact DP approaches for computing marginal success probabilities and optimal policies (Jiao et al., 11 Nov 2025).

5. Neural Architectures

Different perception predicates in DSLPs utilize specialized neural architectures:

  • Image predicates: Shallow CNNs (e.g., variants of LeNet or MNISTConv), with structure:

HH9

  • Textual inputs: RNN encoder architectures (Embedding BjB_j0 BiGRU BjB_j1 Dropout BjB_j2 Linear BjB_j3 Softmax).
  • Citation classifiers: Shallow MLPs on bag-of-words features.

In DeepProofLog, core symbolic tokens and subgoals are embedded into BjB_j4; atoms by an MLP atom encoder, goals by sum-pooling, and clause transitions are scored by the compatibility (dot product) between goal and resolvent embeddings. Subsymbolic data (e.g., images) are encoded by standard CNNs (Winters et al., 2021, Jiao et al., 11 Nov 2025).

6. Applications and Empirical Results

DSLP frameworks, as exemplified by DeepStochLog and DeepProofLog, have been evaluated on a variety of neural-symbolic reasoning tasks:

Task Description Representative Result
MNIST Addition Predict sum of two BjB_j5-digit image sequences BjB_j6: 92.7% accuracy (DeepStochLog); tractable up to BjB_j7 (DeepProofLog)
Handwritten Formulas Mixed digits/operators as images, parse and compute BjB_j894% accuracy in BjB_j9 ms/query (DeepStochLog)
Well-Formed Parentheses Parse up to 18-symbol bracket sequences (image inputs) 100% accuracy (DeepStochLog); %%%%30HH031%%%% ms/query
Context-Sensitive Grammar λC[0,1]\lambda_C \in [0,1]2 languages with permutations λC[0,1]\lambda_C \in [0,1]399% accuracy (DeepStochLog)
Citation Network Classification Semi-supervised citation/context reasoning 69.4% (Cora), 65.0% (Citeseer) (DeepStochLog)
Knowledge Graph Completion Family, WN18RR benchmarks MRR=0.986 (Family), MRR=0.834 (WN18RR) (DeepProofLog)
Word Algebra Problems Text λC[0,1]\lambda_C \in [0,1]4 arithmetic program induction λC[0,1]\lambda_C \in [0,1]594.8% accuracy (DeepStochLog)

In all benchmarks, DSLP systems achieve state-of-the-art accuracy and substantially outpace possible-worlds neural PLP models (e.g., DeepProbLog) in inference time and robustness (Winters et al., 2021, Jiao et al., 11 Nov 2025).

7. Theoretical Properties, Scalability, and Future Directions

DSLPs admit several desirable theoretical properties:

  • Universal approximation: Any distribution over SLD derivations can be approximated arbitrarily well by goal-conditioned neural parameterizations (Jiao et al., 11 Nov 2025).
  • Scalability: Proof graph tabling, goal-level scoring, and neural guidance prune irrelevant branches, yielding linear scaling in problem size for recursive grammars. RL-based inference extends scalability further.
  • Interpretability: Each prediction is accompanied by an explicit proof/derivation, supporting human auditability.

Outstanding challenges include relaxing the leftmost-atom restriction to support more general proof search strategies, addressing suboptimal convergence in RL for very large proof spaces, and integrating possible-world semantics (as in Markov Logic Networks) for broader expressiveness. Directions for future work involve non-leftmost atom selection, advanced RL (actor–critic, value-based), and program rewriting to shrink proof search spaces (Jiao et al., 11 Nov 2025).


References:

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Deep Stochastic Logic Program (DSLP).