Neural markov logic networks

Giuseppe Marra, Ondrej Kuzelka

Abstract

We introduce neural Markov logic networks (NMLNs), a statistical relational learning system that borrows ideas from Markov logic. Like Markov logic networks (MLNs), NMLNs are an exponential-family model for modelling distributions over possible worlds, but unlike MLNs, they do not rely on explicitly specified first-order logic rules. Instead, NMLNs learn an implicit representation of such rules as a neural network that acts as a potential function on fragments of the relational structure. Similarly to many neural symbolic methods, NMLNs can exploit embeddings of constants but, unlike them, NMLNs work well also in their absence. This is extremely important for predicting in settings other than the transductive one. We showcase the potential of NMLNs on knowledge-base completion, triple classification and on generation of molecular (graph) data.

Introduction

Statistical Relational Learning (SRL) aims to model data where entities exhibit complex, interdependent relationships. Traditionally, Markov Logic Networks (MLNs) have served as the standard for this task, utilizing first-order logic rules to define probability distributions. However, MLNs suffer from a significant bottleneck: the requirement for expert-defined rules or computationally expensive combinatorial searches to discover them.

While recent neural-symbolic hybrids attempt to address these limitations, they often fail to model the joint probability distribution of the entire system, limiting their utility to single-link prediction rather than complex reasoning or generative tasks. Neural Markov Logic Networks (NMLNs) bridge this gap by replacing hand-crafted logical rules with neural networks that act as potential functions, retaining probabilistic rigor while gaining the flexibility of deep learning.

Methodology

NMLNs are formulated as an exponential-family model where the probability of a "possible world" is determined by neural potential functions.

Neural Potentials and Invariance

Instead of explicit logical formulas, NMLNs utilize neural networks to evaluate fragments of a relational structure. To ensure the model is invariant to entity permutations (e.g., swapping "Atom_1" and "Atom_2"), the authors implement Symmetric Fragment Potentials through anonymization. This makes the model invariant to isomorphisms, providing a relational analogue to the spatial invariance of Convolutional Neural Networks.

Parallelized Inference

Modeling joint distributions typically requires computationally intensive Gibbs sampling. NMLNs optimize this process using an edge-coloring algorithm to partition the graph into independent sets. This allows for massive parallelization on GPUs, achieving an $O(n)$ speedup in sampling efficiency.

The edge-coloring scheme enables parallelized Gibbs sampling by partitioning the graph into independent sets.

Experimental Results

The authors evaluated NMLNs on molecule generation, knowledge base completion (KBC), and triple classification.

Molecule Generation and Novelty

Using the ChEMBL database, NMLNs were trained to generate small molecules. The model successfully learned chemical regularities, generating molecules that matched the training distribution across various properties such as bond count and topological polar surface area (TPSA).

NMLNs accurately capture the statistical distributions of chemical properties in the training data, enabling the generation of realistic molecules.

Notably, NMLNs generated novel molecules not present in the training set. A validation against the ChemSpider database revealed that 83 out of 100 sampled novel molecules were chemically valid and existing compounds, demonstrating the model's ability to learn fundamental chemical laws rather than mere memorization. In contrast, traditional MLNs often produced chemically nonsensical structures in the same generative task.

Reasoning and Generalization

On KBC benchmarks like Nations and Kinship, NMLNs outperformed specialized models such as Neural Theorem Provers (NTP) and Conditional Theorem Provers (CTP) by significant margins in Mean Reciprocal Rank (MRR). Furthermore, NMLNs demonstrated strong inductive capabilities; by using symmetric potentials that do not rely on specific entity IDs, the model can generalize to entirely new domains without retraining entity embeddings.

Conclusion

Neural Markov Logic Networks represent a significant step forward in statistical relational learning, combining the interpretability of probabilistic graphical models with the representational power of neural networks. By learning implicit rules through neural potentials and utilizing efficient parallelized inference, NMLNs enable both high-performance reasoning and the generation of complex relational structures. Future work will focus on improving scalability for million-node graphs and handling deterministic constraints more robustly.

Summary updated

BibTeX
@inproceedings{marra2021neural,
  author = {Giuseppe Marra and Ondrej Kuzelka},
  title = {{Neural markov logic networks}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2021},
  url = {https://openreview.net/forum?id=N8NGW9MlH4},
}
Figure