People who query a relational database day to day can write accurate SQL because they understand the data: what each table holds, what its columns mean, and how the tables relate. They either designed the schema themselves, or learned it from the people and documentation that describe it. Much of this understanding is tacit knowledge: it lives in people’s heads, or in documents outside the database.
An AI agent that autonomously translates a natural-language question into SQL has none of that understanding. All it has is the raw schema and the data, with no one and nothing telling it what they mean. Its LLM knows what a word like “backorder” usually means, but not what the word means in this business, or which column holds that information. So when the LLM maps a question to SQL, it often comes up with a query that runs but is wrong.
A real example
The example database used throughout this series, Microsoft’s Wide World Importers, has an orders table with two backorder columns.
isundersupplybackordered sounds like “this order was backordered”. Microsoft’s documentation describes it as “If items cannot be supplied are they backordered?”: a setting, not an event. In the data, it is true on all 73,595 orders.
backorderorderid sounds like a link to a backorder. Microsoft’s documentation says “If this order is a backorder, this column holds the original order number”. In the data, it is set on 7,538 orders.
Ask “How many customers had backorders?” and an LLM going by names may well filter on the flag. Filtering on the flag counts every customer in the database (663), not the customers whose orders were actually involved in a backorder (660). The two numbers happen to be close here, but the first number answers a different question. Microsoft wrote descriptions for almost every column in the original database, but the copy used in this series carries none of those descriptions, so an agent querying this copy never sees them.
What is an ontology?
An ontology closes that gap. An ontology captures people’s understanding of the data (what the entities in the schema mean, how they relate, and what the content represents) and writes that understanding down so that agents and LLMs can use it.
An ontology is a shared description of the entities in a business (such as Customer or Order), their attributes, and the relationships between them, written in a form that both people and software can understand.
Ontologies are used well beyond databases: to describe web content (schema.org), to standardize terms in healthcare and finance, and to organize knowledge graphs and information extracted from documents. This series is about ontologies for relational databases, where the ontology is also grounded in the database: each entity and attribute is mapped to the tables and columns that hold it, and key business metrics are defined as calculations.
The term comes from knowledge engineering. Stanford’s widely used guide, Ontology Development 101, describes an ontology as defining “a common vocabulary” for a domain, with “machine-interpretable definitions of basic concepts in the domain and relations among them.”
How it differs from a schema
A schema defines how data is stored: tables, columns, data types, and the keys that say which columns join. It rarely explains what the data means, what each connection represents in business terms, or how the people who own the data use it to answer questions. An ontology captures that business understanding, including how measures are calculated. If you’ve worked with a business glossary, a data dictionary or a semantic layer, an ontology covers the same ground in one model.
What’s in an ontology
NVIDIA describes six parts, and this series uses that breakdown:
A concept says what an entity is: Customer, with a description and synonyms.
A mapping says where it is stored. It is the link between a concept and its physical location: Customer maps to the table
sales.customers, and each attribute to a column.A relationship says how entities are related: an Invoice has a buying Customer and a billed Customer. Each relationship is implemented as a join.
A metric says how a measure is calculated: Revenue as a reviewed SQL expression, so every answer calculates it the same way.
Lineage says where it comes from: each concept and attribute links to its source tables and columns.
Certification says whether it can be trusted: an expert marks a definition as reviewed.
Text-to-SQL without and with an ontology
In both cases an LLM receives a natural-language question and translates the question into SQL. What differs is the context the LLM receives alongside the question. The raw schema tells the LLM what exists; an ontology adds what the data means. Either way, the LLM does the interpreting.
An ontology increases the chance that the generated query is accurate, but doesn’t guarantee accuracy. The ontology’s descriptions can be wrong, and the LLM can still make mistakes.
NVIDIA Auto Ontology
NVIDIA Auto Ontology is an open-source Python framework from NVIDIA, licensed under Apache-2.0. NVIDIA describes it as a framework for building semantic, graph-based reasoning layers over data, with the aim of more deterministic query generation, better context retrieval and more explainable AI in LLM and agent workflows. In practice, it builds an ontology automatically from a database’s metadata and sampled data, and makes that ontology available to agents through MCP, a command-line interface and an API.
Why it exists
Creating and maintaining an ontology by hand is expensive. Subject matter experts and data engineers have to describe every entity, attribute, relationship and metric, and keep those descriptions up to date as the data changes. NVIDIA Auto Ontology aims to cut that human effort. It generates an ontology in three high-level steps:
Generate the ontology draft. An LLM reads the database’s table and column names, data types, declared keys and sampled values. From these, it writes column descriptions, names the entities, and proposes relationships between tables.
Confirm inferred relationships in the draft. Relationships the database already declares as foreign keys are used as they are. For a relationship the LLM proposed, Auto Ontology joins the two columns in SQL and keeps the relationship only if the join returns data. Descriptions and names get no such check.
Human experts review and certify the ontology draft (optional). Reviewers check individual entries, such as an entity’s name, a column description or a calculation. They correct what is wrong and mark each correct entry as certified. Agents can use the draft before any review.
In Part 2 of this series, I will break these three steps into six detailed stages.
Auto Ontology also includes its own agent: a text-to-SQL agent, built by NVIDIA, that answers questions from the ontology and shows the SQL behind each answer. You reach it through the web app’s Chat, a REST API, or the ask_question tool on Auto Ontology’s MCP server. Other agents can also read the ontology directly through that MCP server.
Which models it uses
The models are not fixed. Auto Ontology uses four model roles, each set separately in Auto Ontology’s .env file. By default, all four are NVIDIA models, hosted on NVIDIA’s servers.
The reasoning role, nvidia/nemotron-3.5-lightning-30b-a3b, builds the ontology and answers questions. The non-reasoning role uses the same model, to rewrite follow-up questions and plan charts. The embedding role, nvidia/nemotron-3.5-embed-1b, does search by meaning. The reranking role, nvidia/nemotron-3.5-rerank-8b, is used in one ontology-building step, for bridge tables.
Any role can point to a self-hosted NVIDIA model or to any OpenAI-compatible endpoint, through its <ROLE>_ENDPOINT, <ROLE>_API_KEY and <ROLE>_MODEL settings. NVIDIA’s requirements: the model must support structured output, and the embedding model must stay the same for building the ontology and for answering questions.
When an ontology is worth it
An ontology is likely a good fit when the questions are varied and open-ended, so an agent must interpret each new one. It also fits when the data is spread across many sources, where the same thing, such as a customer, is stored differently or defined in conflicting ways, and when definitions are shared across teams or agents, such as one agreed meaning of revenue.
An ontology may not be needed when the questions are fixed and known in advance, such as the queries behind a dashboard, so someone can write the SQL once by hand. The same goes for data in one well-designed database, and for definitions used by one team, in one place.
This follows NVIDIA’s guidance: with one well-modelled database and a fixed set of questions, direct SQL may be enough.
Raw schema provides the structural context. Ontology provides the semantics. Together, they give the LLM both, and increase the chance of generating accurate SQL that answers the user’s natural language query.
In Part 2, I walk through how NVIDIA Auto Ontology builds an ontology, what each model does, and how its agent answers a question without and with an ontology.
This series is independent and not affiliated with NVIDIA.




