- https://github.com/NVIDIA/auto-ontology
- Type: article
- Source: NVIDIA (Apache-2.0) · November 2026
TL;DR
Auto Ontology generates an enterprise semantic layer from database metadata — concepts, column mappings, joins, metric SQL, lineage and certification — then exposes it to any agent over MCP so text-to-SQL stops guessing what “revenue” means.
The problem it names
Agents can reach data but cannot answer reliably: “a revenue metric answered faster is worth nothing if the number is wrong.” What is missing is not SQL skill but context — what a business concept means, where it lives, how it connects, how to calculate it, where it came from, and whether to trust it. An ontology is exactly that map. The honest scoping line in the README: with one well-modelled source and a fixed set of questions, plain SQL is enough; the ontology pays off when questions are open-ended, sources disagree, and meaning must be shared across runs and agents.
The six questions, one element each
| Question | Element | What it stores |
|---|---|---|
| What does it mean? | Concept | A term (Customer, Invoice Line) with description and synonyms |
| Where is it? | Mapping | Column attributes tying the term to tables and columns |
| What’s connected? | Relationship | Joins including bridge tables: declared keys plus inferred links confirmed against the data |
| How do I calculate it? | Metric | Reviewed SQL under a term, reused so every answer computes the measure identically |
| Where does it come from? | Lineage | Each term and attribute links to its source columns; each answer returns its SQL |
| Should I use it? | Certification | Experts certify names, descriptions and attributes; certified elements are marked reviewed |
How it is built
Generate. Catalog ingest reads tables, columns, keys, views and query history (PII tagging optional) and embeds them in pgvector. Per table it profiles values with SQL, finds foreign-key candidates and junction tables, and writes descriptions. Across tables it groups copies of a schema into term families and keeps an inferred foreign key only when the data confirms it. Output is an ontology in Postgres as Ossie YAML — Apache’s open format for exchanging semantic models, so the thing is portable and not NVIDIA lock-in. A pilot compilation of Wide World Importers produced 31 terms.
Answer. A reasoning model loops over three tools: retrieve (semantic + name search across concepts, column meanings and named calculations), run_sql (run a draft, with table and column names validated against the catalog first), submit (final query + explanation, re-run, errors fed back). The answer always ships with its SQL and the steps taken.
Expose. A read-only MCP server (FastMCP, port 3003) with check_readiness, search_terms, get_term, get_term_columns, get_term_sql_attributes, describe_table, check_answerable and ask_question.
The idea worth stealing: check_answerable
Before answering, the agent asks the ontology whether the question is covered. Asked for return on ad spend on a dataset with no advertising table, it reports coverage 0.5; no term covers "ad spend" and asks a clarifying question instead of inventing joins. Arguing from silence — answering as if the data said zero when it actually says nothing — is the failure mode this blocks, and it is the one that makes agent analytics untrustworthy. Benchmarks claimed: leads on BIRD-Interact (interactive text-to-SQL with ambiguous input) and BEAVER (large, messy schemas).
Key takeaways
- The ontology is six small elements — concept, mapping, relationship, metric, lineage, certification — and each answers one question an agent otherwise guesses.
- Inferred joins are kept only when the data confirms them; that single rule is what separates a semantic layer from a pile of guessed foreign keys.
check_answerablebefore answering is the most transferable idea: report coverage and ask, instead of answering as if missing data were zero.- Certification is a human step by design — the model drafts, the expert certifies, and certifications survive the next compilation.
- Portability through Ossie YAML means the semantic model is not trapped in the vendor’s database.
When to use
- When agents query several sources with overlapping or contradictory definitions.
- When users ask in business terms and need routing to the right table and grain.
- When the number has to be explainable: every answer ships with its SQL and steps.
- Not for one well-modelled source with a fixed question set — plain SQL is enough there, and the README says so.
Stack and cost of adoption
Docker Compose with Next.js (3000) + FastAPI backend (3001) + ingestion (3002) + MCP (3003) + Postgres 17 with pgvector, ten source connectors, and model endpoints via NVIDIA NIM or any OpenAI-compatible API (reasoning, non-reasoning, embed, rerank models are separate roles). Needs an nvapi- key for the demo. Operational trap documented in the README: ports 3001/3002 must stay on a private network, because FastAPI trusts the x-auto-ontology-user-id header the frontend forwards and the ingestion endpoints (ingest, delete, reset, compile) have no authentication of their own.
Caveats
- The heavy lifting is model-generated and then human-certified: the quality of the ontology is the quality of the reviewer, and every compilation re-selects which semantic foreign key each join uses.
- Benchmarks are self-reported, on standard public datasets; the production claim (“enterprise metadata”) is not evidenced at that scale.
- Real dependency on NVIDIA or OpenAI-compatible endpoints; the demo assumes a paid key.
- It solves structured data. Nothing here reads documents, notes or a wiki.
Related: Data Engineering SQL Knowledge Graph MCP AI Agents RAG PostgreSQL