Deep Learning with Logical Constraints

Eleonora Giunchiglia, Mihaela Catalina Stoian, Thomas Lukasiewicz

Introduction: The Neuro-Symbolic Gap

Standard deep learning models are notoriously "data-hungry" and "domain-agnostic." Relying primarily on statistical patterns, these models often overlook fundamental domain knowledge. For instance, an image classifier might identify an object as a "Shark" but fail to recognize it as a "Fish," despite the logical implication. This lack of "common sense" leads to data inefficiency, logical inconsistencies, and safety risks in critical applications like medicine or autonomous driving.

Hierarchical and mutual exclusion constraints: A Shark is logically a Fish, and Shark/Trout are mutually exclusive.

To address these issues, researchers are bridging the gap between connectionism (neural networks) and symbolism (logic). This survey categorizes the "neuro-symbolic" landscape by the complexity of the logic used and the nature of the constraints applied.

Methods: A Hierarchy of Logical Richness

The integration of logic into deep learning can be organized by the "richness" of the logical language:

  • Basic Rules: Simple implications (e.g., $A \to B$) used in Hierarchical Multi-label Classification (HMC).
  • General Rules: Propositional logic involving conjunctions and negations. Early frameworks like KBANN mapped these rules directly to neural topologies, while modern pipelines like DeepProbLog use probabilistic logic to reason over neural outputs.
  • Universally Quantified Formulas ($\forall$): Rules that must hold for all data points, such as physical laws.
  • Existentially Quantified Formulas ($\exists$): Highly expressive logic used in frameworks like Logic Tensor Networks (LTNs), which map logical symbols to tensors and operators to differentiable functions.
Mapping logical rules to neural network architectures using KBANN and CIL$^2$P frameworks.

Key Insights: Guarantees and Differentiability

A critical distinction in this field is between Loss-based methods and Constrained-output methods. Loss-based methods treat logic as a "soft" guide or hint during training. While effective, they do not provide "hard" safety guarantees. In contrast, constrained-output methods use architectural design to ensure rules are never violated—a necessity for safety-critical AI.

The breakthrough enabling this integration was the development of t-norms. These allow logical operators (AND, OR, NOT) to be translated into continuous, differentiable mathematical functions, permitting logic to be optimized via standard backpropagation.

Results and Benchmarks

The survey reviews performance across diverse benchmarks:

  • CIFAR-100: Testing hierarchical constraints through super-class grouping.
  • Biological Data: Gene Ontology and Enzyme Prediction tasks with strict functional hierarchies.
  • Adversarial NLI: Evaluating logical consistency in natural language processing.
  • MNIST Addition: A foundational neuro-symbolic task requiring arithmetic reasoning over image inputs.

Models utilizing basic rules (e.g., C-HMCNN) excel at hierarchical tasks with hard guarantees. Quantified formula models (e.g., Semantic Loss) are particularly effective for semi-supervised learning, acting as a "prior" that reduces the need for labeled data.

Future Directions

Despite significant progress, several challenges remain:

  1. Scalability: Reasoning over thousands of rules in large-scale knowledge bases is computationally intensive.
  2. Engineering Standards: Requirement specification (defining logic) should become a standard part of the ML development lifecycle.
  3. Explainability: There is a need for methods that translate logical constraints into human-readable explanations for model decisions.
  4. Complex Guarantees: Providing 100% satisfaction guarantees for rich, first-order logical languages remains an open technical frontier.

Summary updated

BibTeX
@inproceedings{giunchiglia2022deep,
  author = {Eleonora Giunchiglia and Mihaela Catalina Stoian and Thomas Lukasiewicz},
  title = {{Deep Learning with Logical Constraints}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.24963/ijcai.2022/767},
}
Figure