VAEL: Bridging Variational Autoencoders and Probabilistic Logic Programming

Eleonora Misino, Giuseppe Marra, Emanuele Sansone

Abstract

We present VAEL, a neuro-symbolic generative model integrating variational autoencoders (VAE) with the reasoning capabilities of probabilistic logic (L) programming. Besides standard latent subsymbolic variables, our model exploits a probabilistic logic program to define a further structured representation, which is used for logical reasoning. The entire process is end-to-end differentiable. Once trained, VAEL can solve new unseen generation tasks by (i) leveraging the previously acquired knowledge encoded in the neural component and (ii) exploiting new logical programs on the structured latent space. Our experiments provide support on the benefits of this neuro-symbolic integration both in terms of task generalization and data efficiency. To the best of our knowledge, this work is the first to propose a general-purpose end-to-end framework integrating probabilistic logic programming into a deep generative model.

Introduction

Deep learning models, specifically generative ones like Variational Autoencoders (VAEs), excel at handling noisy, high-dimensional data such as pixels. However, they are often characterized as "System 1" thinkers—efficient at pattern recognition but struggling with high-level reasoning. For instance, a VAE trained to generate images based on a sum label (e.g., "generate two digits that sum to 7") typically learns a "black-box" mapping. This leads to significant data inefficiency and a lack of generalization; the model cannot easily adapt to a new task, like multiplication, without extensive retraining because it fails to decouple the individual symbols from the specific task logic.

VAEL (Variational Autoencoder with Logic) addresses these challenges by integrating VAEs with Probabilistic Logic Programming (ProbLog). By decoupling the "perception" of symbols from the "reasoning" about their relationships, VAEL can generalize to entirely new tasks without neural retraining.

Methods and Architecture

The core innovation of VAEL lies in its split latent space and the integration of a logic engine into the generative process.

The VAEL architecture: an image $x$ is encoded into subsymbolic $z$ and symbolic $z_{sym}$ latents. $z_{sym}$ informs a ProbLog program to produce logical outputs $y$ and weights $\omega_F$ for reconstruction.

Split Latent Space

The encoder maps an input image $x$ into two distinct latent vectors:

  1. Subsymbolic vector ($z$): Captures continuous style features, such as handwriting thickness or orientation.
  2. Symbolic vector ($z_{sym}$): Represents discrete content, such as the identity of a digit.

The Logic Bridge

The symbolic vector $z_{sym}$ is processed by a Multi-Layer Perceptron (MLP) to produce probabilities for logical facts. These facts are then fed into a ProbLog program. This probabilistic logic engine allows the model to reason about the relationships between symbols (e.g., arithmetic rules).

End-to-End Training

To maintain differentiability, VAEL employs the Reparameterization Trick for continuous variables and the Gumbel-Softmax trick for discrete logical outcomes. This allows the entire system to be trained via backpropagation. The decoder then uses both the style vector $z$ and the logical structure to reconstruct the image $\tilde{x}$.

Comparison of graphical models: (a) M1+M2, (b) CCVAE, and (c) the proposed VAEL model.

Experimental Evaluation

The model was evaluated on two primary benchmarks designed to test combinatorial reasoning and spatial awareness:

  • 2digit MNIST: Images containing two side-by-side digits labeled with their sum.
  • Mario Dataset: A $3 \times 3$ grid world where images show state transitions and labels represent moves (up, down, left, right).

Key Results

  • Predictive Accuracy: On the 2digit MNIST sum task, VAEL achieved approximately 84.8% accuracy, significantly outperforming the state-of-the-art CCVAE, which reached 52.8%.
  • Data Efficiency: VAEL demonstrated remarkable efficiency, with models trained on only 10 images per pair outperforming CCVAE models trained on 100 images per pair. The logical prior acts as a powerful inductive bias.
  • Zero-Shot Task Generalization: Once trained on addition, VAEL could generate images for multiplication, subtraction, and power operations by simply swapping the ProbLog program, requiring zero additional neural training.

Conclusion

VAEL represents a significant step toward integrating symbolic reasoning with deep generative models. By forcing the neural network to learn "pure" symbols through a logical bottleneck, the model achieves superior data efficiency and task transferability. Future work will focus on scaling ProbLog inference to more complex scenes and exploring methods for the automated discovery of logic programs from raw data.

Summary updated

Abstract

We present VAEL, a neuro-symbolic generative model integrating variational autoencoders (VAE) with the reasoning capabilities of probabilistic logic (L) programming. Besides standard latent subsymbolic variables, our model exploits a probabilistic logic program to define a further structured representation, which is used for logical reasoning. The entire process is end-to-end differentiable. Once trained, VAEL can solve new unseen generation tasks by (i) leveraging the previously acquired knowledge encoded in the neural component and (ii) exploiting new logical programs on the structured latent space. Our experiments provide support on the benefits of this neuro-symbolic integration both in terms of task generalization and data efficiency. To the best of our knowledge, this work is the first to propose a general-purpose end-to-end framework integrating probabilistic logic programming into a deep generative model.
BibTeX
@inproceedings{misino2023vael,
  author = {Eleonora Misino and Giuseppe Marra and Emanuele Sansone},
  title = {{VAEL: Bridging Variational Autoencoders and Probabilistic Logic Programming}},
  booktitle = {NeSy},
  year = {2023},
  url = {https://openreview.net/forum?id=ifMNmAFlR7},
}
Figure