skipyoutube
Library

Search or browse

From AI Engineer

The Neuro-Symbolic Bridge: Why Agentic Systems Need Ontologies

To move beyond the probabilistic limitations of large language models, we must ground autonomous agents in the formal, structured logic of knowledge graphs.

The Convergence of Two Lineages

We are currently witnessing a critical convergence in computer science: the marriage of probabilistic agents and formal ontologies. In the early days of artificial intelligence, pioneers like John McCarthy and Marvin Minsky envisioned a 'society of mind' where agents perceived, decided, and acted. Parallel to this, the concept of the ontology—a term borrowed from Aristotle and modernized by researchers like Tom Gruber—evolved to provide a formal specification of shared conceptualizations. Today, these two lineages are merging into what we call neuro-symbolic AI.

Neuro-symbolic AI represents a way to keep large language models (LLMs) on their guardrails. By nature, LLMs are probabilistic; they are designed to predict the next most likely word. While this allows for a human-like 'hallucination' or imagination that is incredibly useful for creative tasks, it is a liability when precision is required. By tying neural networks to symbolic AI—specifically knowledge graphs and rule-based systems—we can provide agents with a stable map of the universe they are intended to navigate.

The Structure of Knowledge

At its core, an ontology is a representation of entities, their properties, and their relationships to one another. Unlike traditional relational databases, which force data into rigid tables and columns, graph-based ontologies are flexible. If you need to add a new property or a new relationship to a graph database, you simply attach it. This flexibility is essential for modeling complex, evolving domains like customer service, logistics, or scientific research.

When building these systems, developers can choose between top-down and bottom-up approaches. A top-down approach involves gathering domain experts to define the entities—purchase orders, customers, representatives—and their hierarchies. This mirrors the expert systems of the 1980s, which were powerful but failed to scale. Today, we can augment this with a bottom-up approach, using LLMs to ingest customer interactions and suggest new entities or relationships to add to the graph. Furthermore, we don't have to reinvent the wheel; existing taxonomies like Schema.org or DBPedia provide a massive foundation of structured data that agents can leverage immediately.

Inference and the Power of Logic

The true power of an ontology lies in its ability to facilitate inference through auxiliary technologies like RDFS (Resource Description Framework Schema) and OWL (Web Ontology Language). These tools sit alongside the graph and allow the system to 'know' things that weren't explicitly stated. For example, if we define a 'teaches' relationship where the domain is a 'teacher' and the range is a 'student,' the system can automatically infer that if 'Bob teaches Scooter,' Bob is a teacher and Scooter is a student.

OWL introduces even more sophisticated logical constructs, such as transitive and functional properties. A transitive property allows the system to understand that if Sue is the ancestor of Mary, and Mary is the ancestor of Anne, then Sue is the ancestor of Anne. A functional property, such as 'has father,' acts as a constraint: an individual can only have one. If an agent identifies two different names for a father, the system can infer they are actually the same individual or flag a logical error. These derivations don't live in the raw data; they are logical layers that provide the agent with a sense of 'truth' beyond mere word patterns.

The Agentic Loop and Its Dangers

The industry is currently obsessed with 'loops.' In 1966, Böhm and Jacopini proved that any computation could be performed using only three structures: sequence, conditionals, and loops. By adding iteration to LLMs, we have finally made them Turing complete—capable of performing any task a computer can do. However, loops introduce significant risks. They can drift off-course as agents interact, they can fall into infinite cycles, and they can rapidly inflate token costs.

To manage these risks, we must surround the agentic loop with checks. When an LLM decides to use a tool, it is essentially saying, 'I cannot execute this myself, but here are the parameters I think you need.' Before that tool is executed, and certainly before the result is fed back into the loop, the system should validate the action against the ontology. This is the 'neuro-symbolic' moment: the LLM provides the intuition and the parameters, while the ontology provides the validation and the constraints.

Building Robust Guardrails

In practice, this means using tools like Pydantic for type-checking and ontologies for logical checking. Think of Pydantic as the guard at the door and the ontology as the accountant at the ledger. If an agent attempts to issue a second refund on the same order, or sends a payout to a support desk instead of a buyer, the ontology can catch these errors by identifying disjoint properties or functional violations. These are mistakes that are difficult to catch in pure natural language but are trivial to spot in a structured logical framework.

Ultimately, our goal should be to create 'pure' agents—systems that operate without unintended side effects. By running agent actions through a reasoner built on a formal ontology, we can keep the LLM honest and on track. We are revisiting the world of expert systems, but this time, we have the computational power and the probabilistic flexibility to make them work. The path forward for AI is not just more data or larger models, but a more sophisticated marriage of neural intuition and symbolic logic.

Examples from the library

Try one of these

Example queries appear here for new visitors. Returning readers can see recent queries.