<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DTAI Stories</title><link>https://dtai.cs.kuleuven.be/stories/authors/rik-adriaensen/</link><atom:link href="https://dtai.cs.kuleuven.be/stories/authors/rik-adriaensen/index.xml" rel="self" type="application/rss+xml"/><description>DTAI Stories</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Tue, 13 Oct 2026 10:06:09 +0200</lastBuildDate><image><url>img/map[gravatar:%!s(bool=false) shape:circle]</url><title>DTAI Stories</title><link>https://dtai.cs.kuleuven.be/stories/authors/rik-adriaensen/</link></image><item><title>ProbLog4Fairness: A Neurosymbolic Approach to Modeling and Mitigating Bias</title><link>https://dtai.cs.kuleuven.be/stories/post/rik-adriaensen/problog4fairness/</link><pubDate>Tue, 13 Oct 2026 10:06:09 +0200</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/rik-adriaensen/problog4fairness/</guid><description>&lt;p>Machine learning algorithms are all around us. They decide which advertisements we see, which route our GPS recommends, and even whether our
&lt;a href="https://themarkup.org/denied/2021/08/25/the-secret-bias-hidden-in-mortgage-approval-algorithms" target="_blank" rel="noopener">loan request is granted&lt;/a>. Although these applications look very different, they all share the same core idea: learning a function from data.&lt;/p>
&lt;p>Depending on the task, this function can take many forms. It could be:&lt;/p>
&lt;ul>
&lt;li>a function mapping images of cats and dogs to the labels “cat” and “dog”,&lt;/li>
&lt;li>a function mapping a piece of text to the most likely next word,&lt;/li>
&lt;li>or a function mapping a person&amp;rsquo;s age, income and education level to the probability that they can repay a loan.&lt;/li>
&lt;/ul>
&lt;p>Some of these tasks involve high-dimensional inputs such as images or text. Others work on &lt;em>tabular data&lt;/em>, where each example consists of only a small number of variables (e.g., age, income and education level). In all cases, it is useful to think of the learned function not as a deterministic mapping from an input $X$ to an output $Y$, but as a conditional probability distribution $P(Y \mid X)$, which describes how likely each output $Y$ is given the input $X$.&lt;/p>
&lt;p>To find this target function, we choose a family of models, for example neural networks, and search for the member that fits best. The search is driven by a dataset of example inputs with their corresponding outputs, and it relies on one crucial assumption: that this dataset is representative of the function we want to learn. Unfortunately, this assumption is often violated in practice.&lt;/p>
&lt;h2 id="bias-in-datasets">Bias in datasets&lt;/h2>
&lt;p>Real-world datasets are shaped by historical decisions, measurement limitations, and human judgment. When the dataset systematically differs from the function we actually want to model, we say the dataset contains &lt;em>bias&lt;/em>.&lt;/p>
&lt;p>Suppose we want to train a model to predict whether someone can repay a loan based on their age, income and education level.&lt;/p>
&lt;div style="display:flex; justify-content:center; align-items:stretch; gap:16px; width:100%;">
&lt;figure style="flex:1; margin:0;">
&lt;img src="loan_approval.png" alt="Schematic of loan approval example" style="width:100%; height:320px; object-fit:contain; display:block;">
&lt;/figure>
&lt;/div>
&lt;p>Ideally, the labels in the dataset would reflect the person&amp;rsquo;s actual ability to repay. In practice, the dataset is often constructed from or influenced by historical decisions. For example, a bank may use past loan approvals and rejections as training data, which may have been overly strict for younger applicants. Then the dataset no longer reflects $P(\text{can pay loan} \mid X)$, but instead reflects $P(\text{bank approves loan} \mid X)$.&lt;/p>
&lt;p>The model is now learning the behavior of the bank rather than the target function we actually care about, and these two functions differ systematically for young applicants. This type of bias, where the &lt;em>label&lt;/em> is biased for a subgroup of the dataset (i.e., the young applicants), is known as &lt;em>label bias&lt;/em>.&lt;/p>
&lt;p>Training a standard model on such a dataset causes two problems. First, the predictive performance at test time degrades. The model learned patterns that do not hold in the setting where it will be deployed: it underestimates how well young people can repay. Second, the model reproduces the unfair patterns in the data. The errors it makes are not random, they are concentrated in exactly the subgroup that the bias affected.&lt;/p>
&lt;p>Both problems have the same solution. If we manage to approximate the correct target function despite the biased dataset, the accuracy at test time improves and, almost as a happy side-effect, the model becomes more fair. Collecting an unbiased dataset would work as well, but that is often very costly or simply impossible. The bank could, for example, grant a bunch of loans without any screening to find out who repays, but that takes a long time and loses money. Let&amp;rsquo;s find a better way.&lt;/p>
&lt;h2 id="modeling-bias-with-logic-and-probability">Modeling bias with logic and probability&lt;/h2>
&lt;p>Before correcting for the bias, we need a way to describe it. To do this, we use
&lt;a href="https://dtai.cs.kuleuven.be/stories/stories/post/robin-manhaeve/deepproblog/">DeepProbLog&lt;/a>, a framework that combines probabilistic reasoning with neural networks by extending the logic programming language Prolog. In Prolog, a program consists of facts and rules. For example:&lt;/p>
&lt;p>$$
\begin{aligned}
&amp;amp;\mathsf{age(ann, 18).} \\
&amp;amp;\mathsf{young(X) \mathrel{\vcenter{\hbox{:}}{-}} age(X, Y), Y &amp;lt; 25.}
\end{aligned}
$$&lt;/p>
&lt;p>The first statement is a fact: Ann is 18 years old. The second is a rule: a person is young if their age is below 25. DeepProbLog extends this idea by allowing facts to carry a probability, which may be predicted by a neural network. The neural network $\mathsf{h(X)}$ estimating $P(\mathsf{can\_pay\_loan} \mid X)$ is then expressed by the fact&lt;/p>
&lt;p>$$
\mathsf{h(X) :: can\_pay\_loan(X).}
$$&lt;/p>
&lt;p>where $\mathsf{X}$ is a variable that will be replaced by the available inputs.&lt;/p>
&lt;p>We can now describe the label bias example we saw before using the following program&lt;/p>
&lt;p>$$
\begin{aligned}
&amp;amp;\mathsf{h(X) :: can\_pay\_loan(X).}\\
&amp;amp;\mathsf{young(X) \mathrel{\vcenter{\hbox{:}}{-}} age(X, Y), Y &amp;lt; 25.}\\
&amp;amp;\mathsf{p\_bias :: bias\_when\_young.}\\
&amp;amp;\mathsf{biased(X) \mathrel{\vcenter{\hbox{:}}{-}} young(X), bias\_when\_young.}\\
&amp;amp;\mathsf{gets\_loan(X) \mathrel{\vcenter{\hbox{:}}{-}} can\_pay\_loan(X), not(biased(X)).}
\end{aligned}
$$&lt;/p>
&lt;p>On the first line the neural network predicts the probability that a person with inputs $\mathsf{X}$ can repay a loan. The second line decides whether the person is young. The final three lines express that bias occurs for young people with probability $\mathsf{p\_bias}$ and that someone gets a loan if they can pay it back and no bias occurred. The probability $\mathsf{p\_bias}$ is either derived by studying the process that introduced the bias, or estimated on a small subset of the data for which both biased and unbiased labels are available.&lt;/p>
&lt;p>Such a program describes how the observed labels differ from the true labels we actually care about. It can flip true labels to negative labels, as in the example, but also the other way around. It can combine different causes of bias, each with its own probability. In fact, any bias that can be represented as a Bayesian network, common practice in the field of algorithmic fairness, can be written as a DeepProbLog program! Beyond what is common in algorithmic fairness, the input $X$ is also not restricted to tabular data. The neural network $\mathsf{h(X)}$ natively handles images or text.&lt;/p>
&lt;h2 id="mitigating-bias-automatically">Mitigating bias automatically&lt;/h2>
&lt;p>Once the program is defined, we can ask it queries. Suppose we have a 24-year-old applicant with an income of €30,000 and a high education level, and we want to know the probability that this person gets a loan. Only two things are uncertain here: whether the applicant can repay, which the neural network estimates, and whether bias occurred, which happens with the probability we fixed in advance. The program combines these into a single probability and this probability varies smoothly with the output of the neural network. This means we can train the whole thing end-to-end, exactly as in standard machine learning: we compare the answer of the program to the biased label in our dataset, which is the only one we have, and propagate the error back into the neural network.&lt;/p>
&lt;div style="display:flex; justify-content:center; align-items:stretch; gap:16px; width:100%;">
&lt;figure style="flex:1; margin:0;">
&lt;img src="problog4fairness.jpg" alt="Schematic of ProbLog4Fairness applied to loan approval." style="width:100%; height:320px; object-fit:contain; display:block;">
&lt;/figure>
&lt;/div>
&lt;p>And this is precisely what solves our problem. The part of the process that introduces the bias is described by the rules of our program and remains fixed, so the neural network can neither change it nor does it have to learn it. Its only way to explain the observed labels is to predict who can actually repay. At deployment we can then simply evaluate the neural network without the program, and we obtain a predictor that is both more accurate and more fair.&lt;/p>
&lt;h2 id="experiments">Experiments&lt;/h2>
&lt;p>Let&amp;rsquo;s verify our approach with a small experiment. We generate a tabular dataset with three inputs $X_1$, $X_2$, $X_3$ and an input $A$ that we use to introduce bias. The true label $Y$ depends on all four, with some noise added. We then bias the training data: whenever $A$ is true, we set the observed label $\hat Y$ to false with probability $\beta^{\text{label}}_Y$.&lt;/p>
&lt;p>For a range of values of $\beta^{\text{label}}_Y$, we train our model with the correct DeepProbLog program and evaluate the resulting neural network on an unbiased test set. As baselines we take an unbiased model (trained on the data without the bias), a biased model (trained on the data with the bias), and three simple, well-known baselines. Note that those three try to remove every dependence on $A$, while in our setting part of that dependence is correct and should stay. Despite being trained on the biased data, our model comes very close to the unbiased model!&lt;/p>
&lt;p>The left plot shows the accuracy and the right plot shows the gap in average predicted probability between the group with $A = 0$ and the group with $A = 1$. The three simple baselines push this gap to zero, while our method matches the gap of the unbiased model, which is exactly where it should be.&lt;/p>
&lt;div style="display:flex; justify-content:center; align-items:stretch; gap:16px; width:100%;">
&lt;figure style="flex:1; margin:0;">
&lt;img src="bsweep_dependent.jpg" alt="Accuracy and statistical disparity for increasing bias probability" style="width:100%; height:320px; object-fit:contain; display:block;">
&lt;/figure>
&lt;/div>
&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>DeepProbLog programs offer a very flexible way to describe bias and the resulting model trains just like any other. It also works when the input is not tabular but contains image data, and it lets us state whatever assumption about the bias we believe to be correct, whereas other methods are stuck with one fixed assumption that does not always hold.&lt;/p>
&lt;p>So if you find yourself stuck with a biased dataset, consider whether you can describe the bias before going out to collect new data. Our
&lt;a href="https://github.com/ML-KULeuven/PL4Fairness" target="_blank" rel="noopener">code&lt;/a> and the
&lt;a href="https://dl.acm.org/doi/10.1609/aaai.v40i24.39033" target="_blank" rel="noopener">full paper&lt;/a> are available if you want to try it out.&lt;/p></description></item><item><title>DeepLog</title><link>https://dtai.cs.kuleuven.be/stories/post/robin-manhaeve/deeplog/</link><pubDate>Tue, 29 Sep 2026 10:04:27 +0200</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/robin-manhaeve/deeplog/</guid><description>
&lt;div class="card relpub">
&lt;div class="card-body">
&lt;small>
&lt;p>This post is based on the following publications:&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="https://www.ijcai.org/proceedings/2026/980" target="_blank" rel="noopener">DeepLog: A Software Framework for Modular Neurosymbolic AI&lt;/a>. Manhaeve, R., Colamonaco, S., Derkinderen, V., Adriaensen, R., Van Praet, L., De Raedt, L., Marra, G., IJCAI 2026 (Demo Track), pp. 8462–8465.&lt;/li>
&lt;li>
&lt;a href="https://arxiv.org/abs/2508.13697" target="_blank" rel="noopener">The DeepLog Neurosymbolic Machine&lt;/a>. Derkinderen, V., Manhaeve, R., Adriaensen, R., Van Praet, L., De Smet, L., Marra, G., De Raedt, L., arXiv, 2025.&lt;/li>
&lt;/ul>
&lt;p>Software is available on
&lt;a href="https://github.com/ML-KULeuven/deeplog" target="_blank" rel="noopener">GitHub&lt;/a> and
&lt;a href="https://pypi.org/project/pydeeplog/" target="_blank" rel="noopener">PyPI&lt;/a> (&lt;code>pip install pydeeplog&lt;/code>), with
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/" target="_blank" rel="noopener">documentation&lt;/a>.&lt;/p>
&lt;/small>
&lt;/div>
&lt;/div>
&lt;p>In 2020, we wrote on this blog about
&lt;a href="../deepproblog/">DeepProbLog&lt;/a>, which lets a neural network supply the probabilities of the facts in a probabilistic logic program.
Building DeepProbLog meant building everything underneath it: a reasoner to prove the queries, a knowledge compiler to turn the proofs into circuits, and an evaluator to compute those circuits and their gradients.
Every neurosymbolic system since has done the same, each on its own.&lt;/p>
&lt;p>Deep learning stopped working that way a long time ago.
With PyTorch, you describe a model by composing layers, and the framework takes care of the tensors, the gradients and the GPU.
DeepLog does the same for neurosymbolic AI.
You state the logic of a model, as a formula or as a program, and DeepLog turns it into a differentiable PyTorch module that you combine with your networks and train like any other.&lt;/p>
&lt;div style="text-align: center;">
&lt;figure >
&lt;a href="https://github.com/ML-KULeuven/deeplog" target="_blank">
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/robin-manhaeve/deeplog/deeplog_hu3ab0dc21dec6fcce07f8c4b0043d96ad_24523_2000x2000_fit_lanczos_3.png" class="lazyload" alt="DeepLog logo" width="30%" height="756">
&lt;/a>
&lt;/figure>
&lt;p>
&lt;a href="https://github.com/ML-KULeuven/deeplog" target="_blank" rel="noopener">Code&lt;/a>
&lt;i class="fab fa-github pr-1 fa-fw">&lt;/i> ·
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/" target="_blank" rel="noopener">Documentation&lt;/a>
&lt;i class="fas fa-book pr-1 fa-fw">&lt;/i> ·
&lt;a href="https://pypi.org/project/pydeeplog/" target="_blank" rel="noopener">PyPI&lt;/a>
&lt;i class="fab fa-python pr-1 fa-fw">&lt;/i> ·
&lt;a href="https://www.ijcai.org/proceedings/2026/980" target="_blank" rel="noopener">Paper&lt;/a>
&lt;i class="fas fa-file-alt pr-1 fa-fw">&lt;/i>&lt;/p>
&lt;/div>
&lt;h2 id="from-logic-to-a-pytorch-module">From logic to a PyTorch module&lt;/h2>
&lt;p>At the heart of DeepLog is the &lt;em>DeepLog language&lt;/em>, which we introduced in
&lt;a href="https://arxiv.org/abs/2508.13697" target="_blank" rel="noopener">The DeepLog Neurosymbolic Machine&lt;/a>.
It extends first-order logic with neural networks, and every formula in it names the algebra it is evaluated in: boolean, probabilistic, one of many fuzzy logics, or one you define yourself.&lt;/p>
&lt;figure id="figure-every-front-end-produces-a-formula-in-the-deeplog-language-the-compiler-lowers-it-into-one-pytorch-module-with-a-strategy-for-each-part-of-the-formula">
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/robin-manhaeve/deeplog/overview_hu034cd1ffedbb38c65fbb2645ba948730_170024_2000x2000_fit_lanczos_3.png" data-caption="Every front end produces a formula in the DeepLog language. The compiler lowers it into one PyTorch module, with a strategy for each part of the formula.">
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/robin-manhaeve/deeplog/overview_hu034cd1ffedbb38c65fbb2645ba948730_170024_2000x2000_fit_lanczos_3.png" class="lazyload" alt="How DeepLog turns a model into a PyTorch module: front ends such as a DeepProbLog program, a Logic Tensor Network or a semantic-loss constraint produce a DeepLog formula whose parts name their algebras; the compiler lowers the formula with a strategy such as knowledge compilation into an algebraic circuit, enumeration, sampling or one of your own; the result is a PyTorch module that runs on the CPU or GPU with the neural networks inside it." width="100%" height="660">
&lt;/a>
&lt;figcaption>
Every front end produces a formula in the DeepLog language. The compiler lowers it into one PyTorch module, with a strategy for each part of the formula.
&lt;/figcaption>
&lt;/figure>
&lt;p>Whatever you start from, DeepLog takes the same three steps:&lt;/p>
&lt;ol>
&lt;li>A &lt;strong>front end&lt;/strong> turns the model into a formula in the DeepLog language. For DeepProbLog, that is a Prolog engine that proves the queries; for semantic loss, a parser for the constraint. You can also write the formula yourself.&lt;/li>
&lt;li>The &lt;strong>compiler&lt;/strong> lowers the formula: it chooses, for each part, a strategy that turns it into tensor operations. By default, DeepLog computes probabilities exactly by knowledge compilation into &lt;em>algebraic circuits&lt;/em>, graphs of sums and products in the algebras the formula names, because that is the method we know best. But DeepLog is not tied to circuits: enumeration and sampling are strategies too, and other inference methods can be added as new ones.&lt;/li>
&lt;li>The result is one ordinary &lt;code>torch.nn.Module&lt;/code>, with the neural networks inside it. It runs as batched tensor operations on the GPU, next to the networks, instead of on the CPU between them; circuits, for example, are evaluated with
&lt;a href="https://github.com/ML-KULeuven/klay" target="_blank" rel="noopener">KLay&lt;/a>.&lt;/li>
&lt;/ol>
&lt;h2 id="what-to-compute-and-how">What to compute, and how&lt;/h2>
&lt;p>The most direct way to use DeepLog is to write a formula.
The one below asks for the probability of &lt;em>burglary or earthquake&lt;/em>, where a burglary happens with probability 0.8 and an earthquake with probability 0.3:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">deeplog&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">Compiler&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">enumeration&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">parse_formula&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">sampling&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">alarm&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">parse_formula&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;&amp;#34;&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s2">expectation(Burglary, Earthquake;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s2"> p(Burglary,0.8)_probability times p(Earthquake,0.3)_probability):
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s2"> =(Burglary,true)_boolean or =(Earthquake,true)_boolean
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s2">&amp;#34;&amp;#34;&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Compiler&lt;/span>&lt;span class="p">()&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">compile&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">alarm&lt;/span>&lt;span class="p">)()&lt;/span> &lt;span class="c1"># 0.86&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Compiler&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">aggregation_builders&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="s2">&amp;#34;expectation&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="n">enumeration&lt;/span>&lt;span class="p">})&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">compile&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">alarm&lt;/span>&lt;span class="p">)()&lt;/span> &lt;span class="c1"># 0.86&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Compiler&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">aggregation_builders&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="s2">&amp;#34;expectation&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="n">sampling&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="mi">10_000&lt;/span>&lt;span class="p">)})&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">compile&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">alarm&lt;/span>&lt;span class="p">)()&lt;/span> &lt;span class="c1"># ≈ 0.86&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>_boolean&lt;/code> and &lt;code>_probability&lt;/code> annotations are the algebras: the condition is a boolean formula, and its distribution is a product of probabilities.&lt;/p>
&lt;p>As in PyTorch, where you write the forward pass and the framework derives the gradients, the formula says &lt;em>what&lt;/em> to compute and the compiler decides &lt;em>how&lt;/em>.
By default, DeepLog computes an expectation exactly, by knowledge compilation.
It can also enumerate every possible world, or estimate the value by sampling when a formula is too large to compile.
Choosing between them is one argument to the compiler, and a new inference method plugs in the same way.
Each result is a PyTorch module, so the gradients come for free.&lt;/p>
&lt;h2 id="deepproblog-revisited">DeepProbLog, revisited&lt;/h2>
&lt;p>A front end lets you write in a language you already know.
Here is the MNIST-addition program from our 2020 post, in the form DeepLog reads it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-prolog" data-lang="prolog">&lt;span class="line">&lt;span class="cl">&lt;span class="nf">nn&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s">mnist_classifier&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="nv">X&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="nv">Y&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mf">0..9&lt;/span>&lt;span class="p">])&lt;/span> &lt;span class="s">::&lt;/span> &lt;span class="nf">digit&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nv">X&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nv">Y&lt;/span>&lt;span class="p">).&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nf">addition&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nv">X&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nv">Y&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nv">Z&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="p">:-&lt;/span> &lt;span class="nf">digit&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nv">X&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nv">N1&lt;/span>&lt;span class="p">),&lt;/span> &lt;span class="nf">digit&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nv">Y&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nv">N2&lt;/span>&lt;span class="p">),&lt;/span> &lt;span class="o">is&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nv">Z&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s">+&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nv">N1&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nv">N2&lt;/span>&lt;span class="p">)).&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/robin-manhaeve/deeplog/addition_huacc37c9c630a44e61097dd49afdbff98_16162_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/robin-manhaeve/deeplog/addition_huacc37c9c630a44e61097dd49afdbff98_16162_2000x2000_fit_lanczos_3.png" class="lazyload" alt="The query addition of an image of a 3 and an image of a 5, with sum 8" width="40%" height="82">
&lt;/a>
&lt;/figure>
&lt;p>The network &lt;code>mnist_classifier&lt;/code> gives, for each image, a distribution over the digit it shows, and the rule says how digits add up.
DeepLog proves the query &lt;code>addition(i1, i2, Z)&lt;/code> and turns the proofs into a formula like the one above: the expected value, under the network&amp;rsquo;s distributions, of &amp;ldquo;the two digits add up to &lt;em>Z&lt;/em>&amp;rdquo;.
It compiles that formula into a PyTorch module that takes two images and returns a probability for each of the 19 possible sums, with the classifier inside it.
You train it with an ordinary PyTorch training loop, on the sums alone, and the classifier learns to recognise digits without ever seeing a digit label.
The
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/examples/deepproblog.html" target="_blank" rel="noopener">DeepProbLog notebook&lt;/a> does this end to end.&lt;/p>
&lt;p>Because the compiled module is batched tensor code, it is much faster than the original DeepProbLog.
Here is the average time to evaluate the network and the circuit for one query on MNIST addition, where the numbers to add have 1 to 4 digits:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:right">Digits&lt;/th>
&lt;th style="text-align:right">DeepProbLog (CPU)&lt;/th>
&lt;th style="text-align:right">DeepLog (CPU)&lt;/th>
&lt;th style="text-align:right">DeepLog (GPU)&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:right">1&lt;/td>
&lt;td style="text-align:right">6.1 ms&lt;/td>
&lt;td style="text-align:right">11 µs&lt;/td>
&lt;td style="text-align:right">0.56 µs&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:right">2&lt;/td>
&lt;td style="text-align:right">35 ms&lt;/td>
&lt;td style="text-align:right">41 µs&lt;/td>
&lt;td style="text-align:right">1.5 µs&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:right">3&lt;/td>
&lt;td style="text-align:right">132 ms&lt;/td>
&lt;td style="text-align:right">2.4 ms&lt;/td>
&lt;td style="text-align:right">0.15 ms&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:right">4&lt;/td>
&lt;td style="text-align:right">–&lt;/td>
&lt;td style="text-align:right">196 ms&lt;/td>
&lt;td style="text-align:right">54 ms&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>For single-digit addition, DeepLog is over 500 times faster on a CPU, and over 10,000 times faster on a GPU (an NVIDIA L40S).
The original DeepProbLog handles one query at a time; DeepLog evaluates a whole batch at once.&lt;/p>
&lt;h2 id="one-framework-for-the-alphabet-soup">One framework for the alphabet soup&lt;/h2>
&lt;p>Because DeepLog is a framework and not one more system, it can also bring the existing systems together.
Neurosymbolic AI has grown into an alphabet soup: DeepProbLog, DeepStochLog, DeepSoftLog, NeurASP, Scallop, Logic Tensor Networks, semantic loss, and many more.
Each comes with its own language, its own semantics and its own engine, so comparing two of them means comparing two code bases, and an idea that works in one has to be reimplemented before it can be tried in another.&lt;/p>
&lt;p>Look closely, and most of these systems differ along a handful of axes:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>How you write the knowledge.&lt;/strong> A Prolog program in DeepProbLog, first-order formulas in Logic Tensor Networks, a constraint in conjunctive normal form for semantic loss.&lt;/li>
&lt;li>&lt;strong>What the connectives mean.&lt;/strong> In a probabilistic logic, &lt;em>A or B&lt;/em> is the probability that at least one of them holds. In a fuzzy logic, it is a function of the two truth values, such as their maximum.&lt;/li>
&lt;li>&lt;strong>Where the neural network sits.&lt;/strong> Inside the model, where its outputs become the probabilities of facts, or outside it, where the logic becomes a term in the loss.&lt;/li>
&lt;/ul>
&lt;p>In DeepLog, each of these is a choice within one framework: a front end, an algebra, and where the networks go.
ProbLog, DeepProbLog, semantic loss and Logic Tensor Networks are already implemented on DeepLog.
Reading the connectives in a fuzzy logic instead of in probability, for example, gives you Logic Tensor Networks: our
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/examples/ltn.html" target="_blank" rel="noopener">LTN notebook&lt;/a> reproduces part of the LTN tutorial this way.
Comparing two systems becomes comparing two formulas, compiled by the same compiler and run on the same hardware.&lt;/p>
&lt;h2 id="who-is-it-for">Who is it for?&lt;/h2>
&lt;p>We built DeepLog for two kinds of users.&lt;/p>
&lt;p>&lt;strong>Machine learning practitioners.&lt;/strong> A DeepLog module is a PyTorch module, so you can add logic to an existing model without rewriting your training code.
The
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/examples/semantic_loss.html" target="_blank" rel="noopener">semantic loss notebook&lt;/a>, for example, adds a logical constraint to an MNIST classifier as a term in its loss.
Every module declares symbolic shapes for its inputs and outputs, so connecting two modules that don&amp;rsquo;t fit raises an error instead of producing a silent shape bug.&lt;/p>
&lt;p>&lt;strong>Neurosymbolic researchers.&lt;/strong> You no longer have to write a reasoner, a knowledge compiler and a GPU evaluator before you can try an idea.
A new system is built from DeepLog&amp;rsquo;s parts, the way a new architecture is built from PyTorch&amp;rsquo;s layers, and it runs on the same compiler as the systems it is compared with.
A new inference method becomes a lowering strategy, and every front end can use it at once.&lt;/p>
&lt;h2 id="try-it">Try it&lt;/h2>
&lt;div class="codeblock codeblock-inline codeblock-highlighted" id="codeblock-0">&lt;div id="codeblock-0-code" class="codeblock-body">&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">pip install pydeeplog&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/div>&lt;button type="button" class="btn btn-sm codeblock-btn js-codeblock-copy" data-target="codeblock-0-code" aria-label="Copy to clipboard" title="Copy">
&lt;i class="fas fa-copy" aria-hidden="true">&lt;/i>
&lt;span class="codeblock-btn-label">Copy&lt;/span>
&lt;/button>&lt;/div>
&lt;p>The
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/" target="_blank" rel="noopener">documentation&lt;/a> teaches DeepLog through notebooks, from symbolic shapes to MNIST addition, in two reading paths: one
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/ml_practitioner.html" target="_blank" rel="noopener">for ML practitioners&lt;/a> and one
&lt;a href="https://dtai.cs.kuleuven.be/deeplog/nesy_developer.html" target="_blank" rel="noopener">for neurosymbolic developers&lt;/a>. Every notebook opens in Colab.
At IJCAI 2026 in Bremen, we presented DeepLog in the demo track and in a half-day tutorial, whose
&lt;a href="https://dtai.cs.kuleuven.be/tutorials/deeplog/" target="_blank" rel="noopener">materials are online&lt;/a>.
Questions, bug reports and ideas are welcome as
&lt;a href="https://github.com/ML-KULeuven/deeplog/issues" target="_blank" rel="noopener">GitHub issues&lt;/a>.&lt;/p>
&lt;p>DeepLog is developed at DTAI as part of the ERC Advanced Grant project DeepLog (grant agreement No. 101142702).&lt;/p></description></item></channel></rss>