---
title: DeepGraphLog Neurosymbolic Framework
url: https://www.emergentmind.com/topics/deepgraphlog
type: topic
---

# DeepGraphLog Neurosymbolic Framework

Searching arXiv for the specified paper to ground the article.
DeepGraphLog is a neurosymbolic AI framework that extends ProbLog with Graph Neural Predicates (GNPs) and enables multi-layer neural-symbolic reasoning in arbitrary order, rather than enforcing a fixed flow in which symbolic reasoning always follows neural processing. It is introduced to address complex dependencies in irregular data structures such as graphs, and it does so by treating symbolic representations as graphs that can be processed by Graph Neural Networks (GNNs). The framework is presented as more expressive and flexible than existing NeSy systems such as DeepProbLog, while retaining rigorous probabilistic semantics and end-to-end differentiability [2509.07665].

## 1. Conceptual scope and relation to prior neurosymbolic frameworks

Neurosymbolic AI aims to integrate the statistical strengths of neural networks with the interpretability and structure of symbolic reasoning. Within that setting, DeepGraphLog is defined by a specific contrast with current NeSy frameworks like DeepProbLog: those systems enforce a fixed flow where symbolic reasoning always follows neural processing, whereas DeepGraphLog permits arbitrary interleaving of neural and symbolic components [2509.07665].

This distinction is central to the framework’s motivation. In the formulation associated with DeepGraphLog, symbolic reasoning is not restricted to a terminal stage after representation learning. Instead, symbolic outputs can be converted into graph-structured inputs for later neural stages, and neural outputs can in turn trigger further rule-based derivations. The paper characterizes this as multi-layer neural-symbolic reasoning and explicitly associates it with planning, knowledge graph completion with distant supervision, and GNN expressivity [2509.07665].

A common assumption in earlier NeSy pipelines is that neural modules consume raw data while symbolic modules consume neural predictions. DeepGraphLog rejects that restriction by allowing symbolic representations themselves to become graph objects for GNN processing. This suggests a broader view of NeSy composition in which learned relational inference and logical derivation can alternate across multiple layers rather than occupy fixed roles.

## 2. Formal foundations: syntax, semantics, and objective

DeepGraphLog extends probabilistic logic programs (ProbLog) with Graph Neural Predicates. A DeepGraphLog program is a triple $(F,R,G)$, where $F$ is a set of ground probabilistic facts of the form $p :: f$, with $0 \le p \le 1$ and $f$ a ground atom; $R$ is a set of definite clauses of the form $h :- b_1,\ldots,b_n$; and $G$ is a set of graph neural facts of the form
$$
\mathrm{gnn}(m_r, Y_r, [x_1,\ldots,x_k]) :: r(x_1,\ldots,x_k).
$$
Here, $m_r$ is an identifier for a fixed GNN architecture whose parameters are learned, $Y_r \subseteq S_2$ is a ground set of atoms encoding a possibly probabilistic input graph, and $r(x_1,\ldots,x_k)$ is the predicate whose probability is given by evaluating the GNN $m_r$ on the graph induced by $Y_r$ [2509.07665].

The semantics treat $F$ and $G$ symmetrically as random facts. A possible world is determined by choosing a subset $F' \subseteq F \cup G$ of true facts and then taking the least model with respect to $R$. If $f \in F$ is sampled, its probability is $p$; if $f \in G$, then its truth is sampled according to the neural predicate on the concrete graph induced by $Y_r \cap F'$. For each neural fact $f \in G$, the input-graph instance is defined as $G_f = Y_r \cap F'$, and the probability of $f$ in world $w$ is
$$
P(f \mid G_f) = m_r(G_f).
$$
Under the assumption that, conditioned on their input graphs, all facts are independent, the probability of a world $W$ is
$$
P(W) = \prod_{f \in W \cap (F \cup G)} P(f \mid G_f)\cdot \prod_{f \in (F \cup G)\setminus W} (1-P(f \mid G_f)).
$$
Queries $q$ have marginal probability
$$
P(q) = \sum_{W \models q} P(W),
$$
and conditional queries follow
$$
P(q \mid e) = \frac{P(q \land e)}{P(e)}.
$$

Training uses a negative log-likelihood objective over queries with labels $y \in \{0,1\}$:
$$
L(\theta) = -\sum_i \left[y_i \cdot \log P(q_i) + (1-y_i)\cdot \log(1-P(q_i))\right],
$$
where $\theta$ denotes all learnable parameters, including GNN weights and, if present, probabilities of pure ProbLog facts. Gradients are computed by backpropagating through the summation, or via sampling or approximation if the world-space is large [2509.07665].

These definitions situate DeepGraphLog as a probabilistic logic programming framework rather than merely a neural architecture with logical post-processing. Its semantics are given at the level of possible worlds, least models, and marginal query probabilities, which is significant because it preserves the formal discipline of ProbLog while admitting neural predicates over graph-structured symbolic inputs.

## 3. Graph Neural Predicates and symbolic-to-graph translation

Graph Neural Predicates are the mechanism by which symbolic structures become neural inputs. Given a neural fact
$$
\mathrm{gnn}(m_r, Y_r, [x_1,\ldots,x_k]) :: r(x_1,\ldots,x_k),
$$
DeepGraphLog constructs a directed multi-relational graph $G=(V,E)$ in which $V$ consists of all constants appearing in $Y_r$; each unary atom $q(c) \in Y_r$ becomes a node attribute for node $c$ and, more specifically, gives node $c$ a one-hot feature $e_q$; and each binary atom $q(c_1,c_2) \in Y_r$ becomes a directed labelled edge $(c_1 \to c_2)$ labelled $q$ [2509.07665].

The generic $L$-layer GNN update is specified as
$$
m_{u\to v}^{(\ell)} = \mathrm{MLP}_{\mathrm{edge}}([h_u^{(\ell)}, e_{(u\to v)}]),
$$
$$
\mathrm{agg}_v^{(\ell)} = \bigoplus_{u \in N(v)} m_{u\to v}^{(\ell)},
$$
$$
h_v^{(\ell+1)} = \sigma \left(W_{\mathrm{self}}\cdot h_v^{(\ell)} + W_{\mathrm{neigh}}\cdot \mathrm{agg}_v^{(\ell)} \right),
$$
for $\ell = 0,\ldots,L-1$, where $\bigoplus$ is sum, mean, or max, $\sigma$ is an activation, and $e_{(u\to v)}$ is an edge-type embedding. The final node embeddings $h_v^{(L)}$ are pooled over query nodes $[x_1,\ldots,x_k]$, then passed through a readout layer and sigmoid or softmax to yield the probability of the predicate:
$$
h_{\mathrm{query}} = \mathrm{READOUT}(\{h_{x_i}^{(L)}\}_{i=1..k}),
$$
$$
P = \sigma(W_{\mathrm{out}}\cdot h_{\mathrm{query}} + b_{\mathrm{out}}).
$$

The framework therefore does not merely attach a GNN to a logic program; it defines a translation from atoms to graph structure and then evaluates predicates over that induced graph. This suggests that the expressive contribution of DeepGraphLog lies partly in its ability to reinterpret symbolic state as a relational graph on demand, including possibly incomplete or uncertain inputs, rather than requiring all graph structure to be given exogenously.

## 4. Layered reasoning, optimization, and inference modes

DeepGraphLog permits arbitrary interleaving of neural and symbolic layers. The typical two-layer pipeline described for the framework is:

- INPUT facts $(F_0,G_0)$
- Neural layer 1: evaluate all $\mathrm{gnn}(m_1, Y_1, \cdot) \in G_0$
- Derive new symbolic facts via $R_1$
- Neural layer 2: evaluate $\mathrm{gnn}(m_2, Y_2, \cdot)$ on extended graph
- Final symbolic inference via $R_2$
- QUERY $P(q)$

The corresponding pseudocode for layered reasoning evaluates all subsets $W \subseteq F \cup G$ consistent with evidence, computes the least model $M = \mathrm{LeastModel}(R \cup W)$, extracts the input subgraph $G_f = Y_f \cap W$ for each GNN fact, computes each $p_f = m_f(G_f)$ through a forward pass, forms
$$
P_W = \prod_{f \in W} p_f \cdot \prod_{f \notin W} (1-p_f),
$$
and sums these probabilities over worlds satisfying the query [2509.07665].

Optimization minimizes the negative log-likelihood $L(\theta)$ over training queries using gradient descent (Adam). Gradients flow through both symbolic inference and neural predicates: through the enumeration or circuit-compiled path on the symbolic side, and through standard backpropagation on the GNN side [2509.07665].

Inference is divided into two modes. Pure ProbLog queries with no GNPs use knowledge compilation, such as d-DNNF or SDD, in time polynomial in circuit size. Mixed queries with GNPs require explicit summation over worlds or Monte Carlo sampling, and each world evaluation involves one GNN forward pass per neural fact. The framework description explicitly notes that approximate methods, including importance sampling and variational methods, may be used for scalability [2509.07665].

This architecture clarifies a key point that is sometimes blurred in discussions of NeSy systems: the layering is not only conceptual but operational. Neural modules can alter the set of facts from which later graphs are induced, and symbolic rules can alter the graph context seen by later GNN predicates. A plausible implication is that DeepGraphLog is designed for settings where intermediate symbolic state is not a static annotation but part of the learned computation.

## 5. Empirical demonstrations: expressivity and structure learning

One evaluation concerns GNN expressivity beyond 1-WL. The task is to classify graphs by the presence of a 4-cycle, a case in which 1-WL GNNs alone fail. The baselines are a 1-WL GNN on the raw graph and a GNN with “logic-at-the-bottom,” where the graph is augmented with explicit cycle-indicator nodes. DeepGraphLog is used in a “logic-at-the-top” configuration that employs a GNP to detect $\mathrm{cycle}_4$ via a logical predicate and GNN readout [2509.07665].

The reported test accuracies, averaged over 5 runs, are:

- For 1000 training examples: GNN raw $0.92 \pm 0.02$, GNN + feats $0.93 \pm 0.01$, DeepGraphLog $\mathbf{0.94 \pm 0.01}$
- For 500 training examples: GNN raw $0.89 \pm 0.03$, GNN + feats $0.90 \pm 0.02$, DeepGraphLog $\mathbf{0.92 \pm 0.02}$
- For 100 training examples: GNN raw $0.61 \pm 0.05$, GNN + feats $0.68 \pm 0.06$, DeepGraphLog $\mathbf{0.85 \pm 0.03}$ [2509.07665]

A second evaluation addresses structure learning via parameter learning. The task is graph classification where $\mathrm{class}_0 \leftrightarrow$ presence of $\mathrm{cycle}_4$, $\mathrm{class}_1 \leftrightarrow \mathrm{cycle}_3$, and $\mathrm{class}_2 \leftrightarrow$ no cycle. The model uses GNPs $r_F(\mathrm{cycle}_k,\mathrm{class}_j)$ with learnable probability $p_{kj}$. The reported outcome is that DeepGraphLog correctly learns
$$
p(\mathrm{cycle}_4 \to \mathrm{class}_0)=1.0,\quad p(\mathrm{cycle}_3 \to \mathrm{class}_1)=0.8,\quad p(\mathrm{cycle}_3 \to \mathrm{class}_2)=0.2,\ldots
$$
and that this matches ground truth, while a standard GNN cannot isolate these patterns [2509.07665].

Taken together, these experiments are used to support two claims made explicitly in the paper: improved data efficiency and expressivity beyond 1-WL GNNs. They also illustrate a broader methodological point. In DeepGraphLog, logical structure is not only auxiliary supervision or feature engineering; it can define latent predicates and probability parameters that are subsequently learned through the probabilistic semantics of the overall program.

## 6. Empirical demonstrations: distant supervision, planning, and limitations

In knowledge graph completion with distant supervision, the family-tree graph uses nodes in `person` and edges `parentOf`. The goal is to learn `motherOf` and `fatherOf` without direct supervision, using only `grandparentOf(a,b)`. The DeepGraphLog program includes GNN predicates for `fatherOf` and `motherOf` and symbolic rules for `grandfatherOf`:
```prolog
gnn(m_f, [parentOf/2, gender/1], [X,Y]) :: fatherOf(X,Y).
gnn(m_m, [parentOf/2, gender/1], [X,Y]) :: motherOf(X,Y).
grandfatherOf(X,Y) :- fatherOf(X,Z), fatherOf(Z,Y).
grandfatherOf(X,Y) :- fatherOf(X,Z), motherOf(Z,Y).
```
The baseline is a pure GNN predicting `fatherOf` and `motherOf`. For `fatherOf`, the reported results are F1 $22.95 \pm 30.1$ for the GNN and $\mathbf{98.94 \pm 1.2}$ for DeepGraphLog; AUCROC $35.40 \pm 20.3$ for the GNN and $\mathbf{99.20 \pm 0.1}$ for DeepGraphLog; Hits@5 $42.00 \pm 15.8$ for the GNN and $\mathbf{100.0 \pm 0.0}$ for DeepGraphLog; and Hits@20 $46.00 \pm 12.5$ for the GNN and $\mathbf{100.0 \pm 0.0}$ for DeepGraphLog. For `motherOf`, the reported F1 is $59.61 \pm 10.3$ for the GNN and $\mathbf{98.96 \pm 1.1}$ for DeepGraphLog [2509.07665].

In the Blocks World planning setting, the domain consists of blocks on the floor, each block in $\{\mathrm{glass}, \mathrm{metal}, \mathrm{plastic}\}$, under the constraint that one cannot move onto glass. The pipeline is explicitly multi-layered:

1. GNP `move(X,Y)` predicts all possible moves.
2. Symbolic filter `illegal(X,Y) :- move(X,Y),glass(Y)`.
3. Derived `after_move(X,Y)`.
4. GNP `tower(after_move/2,glass/1)` predicts if a valid tower results.

The baselines are a single GNN that directly predicts tower-possible and two GNNs without a symbolic constraint between them. Test accuracy is reported as $65.99 \pm 1.8\%$ for the single GNN, $75.44 \pm 3.0\%$ for the two-GNN system without constraint, and $\mathbf{100.0 \pm 0.0\%}$ for DeepGraphLog [2509.07665].

The framework’s advantages are summarized in the source as follows: arbitrary layering of neural and symbolic modules enables multi-step, bidirectional reasoning; GNPs allow neural nets to operate on symbolic graphs, possibly incomplete or uncertain; the approach retains rigorous probabilistic semantics; and it improves data efficiency and expressivity beyond 1-WL GNNs while enabling structure learning and distant supervision [2509.07665].

The limitations and open challenges are equally explicit. Inference with GNPs may require summation over exponentially many worlds and therefore incurs high computational cost. Approximate or sampling-based inference and variance-reduced gradient estimators are needed for large graphs. Automatic discovery of useful symbolic rules remains nontrivial beyond small template sets. Scaling to deep recursive reasoning or very large knowledge bases requires further work on compilation and caching of intermediate circuits [2509.07665].

These constraints are important for interpreting the reported results. The empirical demonstrations establish the framework’s reasoning power across planning, graph classification, and knowledge-graph tasks, but the same formal machinery that yields expressive layered inference also creates a computational bottleneck. A plausible implication is that the future development of DeepGraphLog will depend not only on better GNN architectures or richer logic templates, but also on improved approximate inference, compilation strategies, and intermediate-state reuse.

Source: https://www.emergentmind.com/topics/deepgraphlog