Neuro-Symbolic Entropy Regularization

Kareem Ahmed, Eric Wang, Kai-Wei Chang, Guy Van den Broeck

In the world of structured prediction—where we want a model to output complex objects like paths in a graph or entity-relation triples—the search space is enormous. Training these models usually requires mountains of labeled data. To get around this, researchers often turn to two distinct strategies: entropy regularization, which encourages models to be confident on unlabeled data, and neuro-symbolic learning, which uses logical constraints to ensure outputs are "valid."

A new paper from UCLA, "Neuro-Symbolic Entropy Regularization," argues that these two approaches shouldn't just coexist—they should be unified. By restricting entropy minimization to only the "valid" parts of the output space, the authors create models that are not just confident, but confident in the right things.

TL;DR

This paper introduces Neuro-Symbolic (NeSy) Entropy Regularization, a novel loss function that minimizes the entropy of a model’s predictive distribution conditioned on a logical constraint. By leveraging tractable logic circuits, the authors provide an efficient way to guide neural networks toward making highly confident, logically consistent predictions, significantly improving performance in both semi-supervised and fully-supervised settings.

What Problem Does This Paper Address?

Structured prediction is difficult because the number of possible outputs is often exponential. Standard entropy regularization helps by pushing decision boundaries into low-density regions of the input space, effectively "clustering" unlabeled data. However, it is structure-agnostic: it might push a model to be very confident in an output that is logically impossible (e.g., a "path" in a graph that has a gap in the middle).

On the other hand, neuro-symbolic methods (like semantic loss) use logical formulas to penalize invalid structures. While this steers the model toward validity, it doesn't necessarily encourage the model to be informative or confident within that valid space.

The authors identify a gap: standard entropy regularization can be detrimental if it guides a model toward "confident yet invalid" predictions. The goal is to find a middle ground where the network "knows" the right structure among the valid structures.

Figure 1: A network’s predictive distribution can be uncertain or cer- tain (↔), and it can allow or disallow invalid predictions under the constraint α (↕). Entropy regularization steers the network towards confident, possibly invalid predictions (b). Neuro-symbolic learning steers the network towards valid predictions without necessarily be- ing confident (c). Neuro-symbolic entropy-regularization guides the network to valid and confident predictions (d).

Methods

The core contribution is the Neuro-Symbolic Entropy Loss, defined as $H(Y|\alpha)$, where $Y$ is the output and $\alpha$ is a logical constraint. Instead of minimizing the entropy of the entire distribution, they minimize the entropy of the distribution restricted to the models that satisfy $\alpha$.

The Computational Challenge

Computing entropy over a constrained space is generally #P-hard (a class of problems even harder than NP-complete, involving counting solutions). To make this practical for deep learning, the authors utilize tractable logic circuits (specifically those that are smooth, deterministic, and decomposable).

The Algorithm

The authors provide a linear-time algorithm (relative to the circuit size) to compute this loss:

  1. Circuit Compilation: The logical constraint is compiled into a directed acyclic graph (DAG) of AND/OR gates.
  2. Bottom-Up Pass: The network's output probabilities are fed into the leaves. The circuit computes the probability of the constraint being satisfied.
  3. Entropy Decomposition: Because the circuit is "deterministic" (OR gates represent mutually exclusive choices) and "decomposable" (AND gates represent independent sub-problems), the entropy can be computed recursively. The entropy of an OR node is the sum of the weighted entropies of its children plus the entropy of the choice itself.
Figure 2: For a given data point, the network (middle) outputs a dis- tribution over classes A, B and C, highlighted in blue, green and red, respectively. The circuit encodes the constraint (a ∧b) =⇒c. For each leaf node l, we plug in Pr(l) and 1−Pr(l) for positive and negative literals, respectively. The computation proceeds bottom- up, taking products at AND gates and summations at OR gates. The value accumulated at the root of the circuit (left) is the probability allocated by the network to the constraint. The weights accumu- lated on edges from OR gates to their children are of special signifi- cance: OR nodes induce a partitioning of the distribution’s support, and the weights correspond to the mass allocated by the network to each mutually-exclusive event. Complemented with a second up- ward pass, where the entropy of an OR node is the entropy of the distribution over it’s children plus the expected entropy of its chil- dren, and the entropy of an AND node is the product of its children’s entropies, we get the entropy of the distribution over the constraint’s models – the neuro-symbolic entropy regularization loss (right).

Datasets

The authors evaluated their approach across several structured prediction tasks:

  • Entity-Relation Extraction: ACE 2005 and SciERC datasets. These involve identifying entities in text and the valid relations between them (e.g., a "Physician" can have an "Employment" relation with a "Hospital").
  • Grid Path Prediction: Finding the shortest path in a 4x4 grid.
  • Preference Learning: Predicting a user's full ranking of sushi types based on a partial ranking (using the PREFLIB sushi dataset).
  • Warcraft Shortest Path: Predicting the minimum-cost path across a 12x12 terrain map from Warcraft II.

Key Insights and Ideas

  • Conditional Clustering: Just as standard entropy regularization acts as a clustering mechanism, NeSy entropy acts as a clustering mechanism within the manifold of valid solutions.
  • Unification: The loss seamlessly integrates with existing neuro-symbolic losses (like semantic loss). While semantic loss "eliminates" invalid structures, NeSy entropy "sharpens" the distribution over the remaining valid ones.
  • Efficiency via Structure: The paper demonstrates that the "hardness" of logic can be bypassed if the constraints have enough internal structure to be represented as tractable circuits.

Key Results

The experiments showed that NeSy Entropy consistently outperformed both purely supervised baselines and structure-agnostic entropy regularization:

  • Semi-Supervised Learning: On the ACE05 dataset with only 3 labels per relation, NeSy Entropy achieved 14.72% accuracy compared to the baseline's 4.92% and standard semantic loss's 12.00%.
  • Constraint Satisfaction: In preference learning, NeSy Entropy led to models where 96.0% of predictions satisfied the logical constraints, compared to only 69.8% for standard semantic loss.
  • Warcraft Shortest Path: The method improved "Coherent" accuracy (predicting the exact optimal path) from 44.8% (baseline) to 55.0%, outperforming "Full Entropy" regularization (51.5%).

Limitations and Future Work

  • Compilation Overhead: While the loss is efficient to compute once the circuit is built, compiling complex logical formulas into tractable circuits can be computationally expensive (exponential in the worst case).
  • Boolean Constraints: The current framework is designed for Boolean variables. Extending this to continuous constraints or more complex probabilistic graphical models is a natural next step.
  • Scaling: While 12x12 grids were successful, scaling to much larger output spaces (like high-resolution image segmentation with complex topological constraints) remains a challenge.

In summary, this work provides a mathematically rigorous and computationally efficient bridge between the "black-box" confidence of neural networks and the "hard-coded" rules of symbolic logic.

Summary updated

BibTeX
@inproceedings{ahmed2022neuro,
  author = {Kareem Ahmed and Eric Wang and Kai-Wei Chang and Guy Van den Broeck},
  title = {{Neuro-Symbolic Entropy Regularization}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2022},
  url = {https://openreview.net/forum?id=rlbz4_Io5g9},
}
Figure