Semantic Strengthening of Neuro-Symbolic Learning

Kareem Ahmed, Kai-Wei Chang, Guy Van den Broeck · DOI

Introduction

Neural networks excel at high-dimensional feature extraction but often struggle to adhere to strict symbolic constraints, such as the logical rules of a game or the structural requirements of a shortest-path algorithm. Neuro-symbolic (NeSy) learning attempts to address this by incorporating a "semantic loss" that penalizes models when their predictions violate logical rules. However, calculating the exact probability that a network satisfies a complex constraint is a #P-hard problem, creating a significant computational bottleneck.

Researchers typically bypass this intractability using two methods: fuzzy logic approximations (t-norms) or sampling. Fuzzy logic is computationally efficient but often distorts the underlying semantics of the rules, leading to conflicting gradients that stall training. Sampling, on the other hand, is often ineffective in high-dimensional spaces where valid solutions are extremely sparse. This paper introduces Semantic Strengthening, a novel approach that bridges the gap between fast, loose approximations and exact but intractable probabilistic reasoning.

The Semantic Strengthening Framework

Semantic Strengthening begins with a simple, tractable assumption and iteratively increases its complexity based on the needs of the neural network. The process follows three core stages:

  1. Initial Independence Assumption: The algorithm starts by assuming all components of a logical constraint are independent. While this makes the initial computation tractable, it ignores the inherent dependencies between rules (e.g., in Sudoku, a value in one cell constrains both its row and its column).
  2. Identifying Conflict via Conditional Mutual Information (CMI): To refine the approximation, the authors use CMI to identify which constraints are most "misaligned." CMI measures the degree to which the gradients of two rules conflict given the current state of the neural network. High CMI indicates that the independence assumption is causing significant errors in the learning signal.
  3. Iterative Strengthening with Tractable Circuits: Every few training epochs, the algorithm identifies the pairs of constraints with the highest CMI and merges them into a single, joint constraint. To maintain efficiency, these constraints are represented using Sentential Decision Diagrams (SDDs)—specialized computational graphs that allow for exact probabilistic calculations in polynomial time, provided the circuit structure remains manageable.

Experimental Evaluation

The authors evaluated Semantic Strengthening against standard ResNet baselines and fuzzy logic (Product t-norm) approaches across three complex benchmarks:

  • Warcraft Shortest Path: Predicting the minimum-cost path on a 12x12 grid from map images.
  • MNIST Perfect Matching: Finding a matching in a 10x10 grid of handwritten digits that minimizes the sum of the digit values.
  • Sudoku: Solving 9x9 puzzles with 10 missing entries, requiring the simultaneous satisfaction of row, column, and block constraints.

Key Results

Semantic Strengthening consistently outperformed both the baseline and fuzzy logic models, achieving higher accuracy with only a marginal increase in computational overhead (approximately 2 to 7 seconds per iteration).

Task Baseline (ResNet) Product t-norm Semantic Strengthening
Warcraft (Exact Path %) 44.80% 50.40% 61.20%
MNIST Matching (Exact %) 9.30% 12.70% 15.50%
Sudoku (Correct Sol. %) 16.80% 22.10% 28.00%

Discussion and Insights

The success of Semantic Strengthening stems from its ability to provide a coherent learning signal. By merging the most dependent constraints, the algorithm eliminates the "gradient conflict" common in fuzzy logic, where different parts of a rule provide contradictory updates to the network. Unlike fuzzy logic, which changes the mathematical meaning of the rules, Semantic Strengthening maintains sound probabilistic semantics, providing a principled relaxation that gets tighter as the computational budget allows.

Furthermore, the method is uniquely network-guided. Rather than merging rules arbitrarily, it uses the network's own "confusion" (via CMI) to determine which symbolic structures require the most refinement. This ensures that computational resources are focused on the most critical dependencies.

Limitations and Future Work

While effective, Semantic Strengthening faces a "constraint budget"; as more rules are merged, the underlying SDDs grow in size, eventually hitting a limit of tractability. Additionally, the current implementation requires constraints to be formatted in Conjunctive Normal Form (CNF). Future research may explore scaling this approach to more expressive frameworks, such as first-order logic, to handle even more complex reasoning tasks.

Summary updated

BibTeX
@inproceedings{ahmed2023semantic,
  author = {Kareem Ahmed and Kai-Wei Chang and Guy Van den Broeck},
  title = {{Semantic Strengthening of Neuro-Symbolic Learning}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2023},
  url = {https://openreview.net/forum?id=VQIKKAWAHE},
}
Figure