Embedding Symbolic Knowledge into Deep Networks

Yaqi Xie, Ziwei Xu, Mohan Kankanhalli, Kuldeep S. Meel, Harold Soh · DOI

Abstract: In this work, we aim to leverage prior symbolic knowledge to improve the performance of deep models. We propose a graph embedding network that projects propositional formulae (and assignments) onto a manifold via an augmented Graph Convolutional Network (GCN). To generate semantically-faithful embeddings, we develop techniques to recognize node heterogeneity, and semantic regularization that incorporate structural constraints into the embedding. Experiments show that our approach improves the performance of models trained to perform entailment checking and visual relation prediction. Interestingly, we observe a connection between the tractability of the propositional theory representation and the ease of embedding. Future exploration of this connection may elucidate the relationship between knowledge compilation and vector representation learning.

Introduction

While deep neural networks excel at pattern recognition, they often require massive amounts of labeled data to learn concepts that human experts could describe with a few simple rules. Conversely, symbolic logic is excellent at representing structured rules but lacks the flexibility of continuous, gradient-based learning. This research introduces LENSR (Logic Embedding Network with Semantic Regularization), a framework designed to bridge this gap by injecting symbolic knowledge directly into deep learning models.

Previous attempts to integrate logic often treated formulas as simple sequences or added logic-based loss functions during training, frequently ignoring the internal structural semantics of the logic itself. LENSR addresses this by representing logical rules as graphs and embedding them into a continuous manifold where geometric distances reflect logical satisfaction.

Methodology: The LENSR Framework

LENSR treats logical formulas as Directed Acyclic Graphs (DAGs) and processes them using an augmented Graph Convolutional Network (GCN). The framework incorporates several key innovations to ensure the resulting embeddings are semantically meaningful.

The LENSR architecture, showing semantic regularization for AND/OR nodes and the resulting learned embedding space.

Semantic Regularization and Node Heterogeneity

Unlike standard GCNs, LENSR recognizes node heterogeneity by using distinct weights for different logical gates (AND, OR, Implies). To ensure the embeddings are "semantically faithful," the authors introduce structural constraints based on the properties of the logical gates:

  • AND Semantic Regularization: Children of an AND gate are forced toward orthogonal embeddings, reflecting the property of "decomposability."
  • OR Semantic Regularization: Children of an OR gate are constrained to sum to a unit vector, reflecting "determinism."

The embedder is trained using a triplet loss, ensuring that "satisfying assignments" (truth values that make a rule true) are positioned close to the formula's embedding in vector space, while "unsatisfying assignments" are pushed away.

The Role of Tractable Representations

A significant finding of this work is the connection between the tractability of a logic representation and the efficiency of the embedding process. Instead of standard Conjunctive Normal Form (CNF), LENSR utilizes deterministic Decomposable Negation Normal Form (d-DNNF).

Comparison of different logical representations: (a) General Form, (b) CNF, (c) d-DNNF, and (d) d-DNNF DAG.

Because d-DNNF has stricter structural properties than CNF, the GCN finds it easier to learn a representation that accurately captures the underlying logic. This suggests that the process of "knowledge compilation" in symbolic logic has a direct parallel in the ease of vector representation learning.

Experimental Results

The authors evaluated LENSR on two primary benchmarks:

  1. Synthetic Model-Checking: On formulas of varying complexity, LENSR with d-DNNF and semantic regularization significantly outperformed standard CNF-based embeddings.
  2. Visual Relationship Detection (VRD): In the task of Visual Relation Prediction (e.g., identifying if a "person wears glasses"), LENSR achieved a Top-5 accuracy of 92.77%. This is a substantial improvement over the 84.30% baseline (no logic) and previous state-of-the-art TreeLSTM methods (85.76%).

Qualitatively, the model successfully used embedded spatial logic to correct nonsensical predictions, such as preventing a model from predicting "person skate on truck" by enforcing rules regarding spatial overlap and relative positioning.

Conclusion

LENSR demonstrates that enforcing geometric constraints—turning logical properties into orthogonality and unit-sum constraints—allows neural networks to "reason" via distance calculations in an embedding space. While the compilation of formulas into d-DNNF introduces some overhead, the gains in data efficiency and model accuracy are significant. Future work will explore extending this framework to more complex logics, such as First-Order Logic, and investigating end-to-end training of the embedder within target tasks.

Summary updated

BibTeX
@inproceedings{xie2019embedding,
  author = {Yaqi Xie and Ziwei Xu and Mohan Kankanhalli and Kuldeep S. Meel and Harold Soh},
  title = {{Embedding Symbolic Knowledge into Deep Networks}},
  booktitle = {NeurIPS},
  year = {2019},
  url = {https://openreview.net/forum?id=PsYRxujYTJw},
}
Figure