Neurosymbolic AI

Learn about neurosymbolic AI.

We'll cover the following

One of the biggest problems with neural networks today is their utter lack of interpretability. Rules within hidden layers are essentially unknown because they depend on previous layers and computations, which makes the entire algorithm a black box. Combine this idea with some of the more modern neural net architectures that have hundreds of layers and billions of parameters and it becomes clear why interpretability is not possible.

Recent developments in the space have tried to tie neural networks together with symbolic logic, which is a representational way mathematicians think about logic and decisions.

Symbolic logic

One type of logic commonly used in neurosymbolic AI is first-order logic. First-order logic, also known as predicate logic, extends propositional logic by incorporating variables, quantifiers, and predicates to reason about objects and their relationships. It allows for the expression of complex statements and lets us make inferences based on logical rules.

For example, let’s consider the statement,“If Fido is a dog, it has four legs.” Let’s define our events:

  • AA: Fido is a dog.

  • BB: Fido has four legs.

The statement is best represented as the simple expression ABA \rightarrow B, or “A implies B.” With this in place, we can evaluate the truth of BB by simply evaluating the truth of AA. We can also perform operations on this expression, such as the inverse notAnotBnot A \rightarrow not B and the converse BAB \rightarrow A. Note that in this case, the inverse would be, “If Fido is not a dog, then Fido does not have four legs,” and the converse would be, “If Fido has four legs, Fidos is a dog.”

Here’s another simple example to illustrate the use of first-order logic in neurosymbolic ML. Let’s say we have a neurosymbolic ML system designed to answer questions about a zoo. The system is given the following knowledge base:

  1. ∀x Lion(x) ⇒ Mammal(x) (Every lion is a mammal.)

  2. ∀x Lion(x) ⇒ Carnivore(x) (Every lion is a carnivore.)

  3. Lion(Mufasa) ⇒ (Mufasa is a lion.)

Now, if the system is asked the question, “Is Mufasa a mammal?” it can use first-order logic to infer the answer. By applying the logical rules (1) and (3) together, the system can conclude that Mufasa is indeed a mammal.

Neural networks

This integration of symbolic logic with neural networks allows the neurosymbolic ML system to benefit from the logical reasoning capabilities of symbolic approaches while leveraging the learning and pattern recognition capabilities of neural networks.

Let’s consider a quick example of a neurosymbolic algorithm in action. Note that, within this neural network, there are both traditional layers and symbolic layers operating in sequence.

Get hands-on with 1200+ tech skills courses.