NVIDIA AutoOntology: A Semantic Layer for AI Agents Over Corporate DatabasesArticle · digest for November 10
Three-dimensional spatial model of a semantic relationship graph linking corporate database tables
Article4 sections≈ 7 min

NVIDIA AutoOntology: A Semantic Layer for AI Agents Over Corporate Databases

Have you ever hooked a language model up to a live database and asked it to calculate a simple business metric—say, quarterly revenue? On the surface, everything looks spotless: in a second, the agent writes a query with JOIN, GROUP BY, and date filters, the PostgreSQL parser executes it without a single error, and it returns a neat total. Only when the CFO opens that report does it turn out the number is off by 50%.

The issue here is not that the LLM struggles with SQL syntax—modern models have that down cold. The trouble is that the model has no idea what your tables mean in business terms. In a mature corporate database, orders, invoices, payments, and refunds live side by side. To stop analytical bots from blindly guessing joins, NVIDIA engineers open-sourced the NVIDIA AutoOntology framework under the Apache 2.0 license, spotted by the SQL Portal channel. The system builds a verified semantic layer of concepts on top of the database and serves it to AI agents over MCP.

The Illusion of Valid SQL: Why a Correct Query Returns Wrong Numbers

When we connect an LLM straight to a database for Text-to-SQL, we implicitly expect the model to read minds. All the model sees are technical column names and data types: amount, status, created_at. Hidden behind them are years of historical accretion and internal accounting rules that are nowhere to be found in INFORMATION_SCHEMA.

Imagine hiring a translator with flawless grammar, walking them into a massive wholesale warehouse with no signs, and asking them to tally the value of all goods shipped this quarter in five minutes. Hangar one holds draft orders (orders), hangar two holds issued bills (invoices), hangar three holds actual payments (payments), and hangar four holds returns (refunds). Without the warehouse handbook, the translator will write a grammatically perfect report, while casually summing amounts from the first ledger they grab—canceled orders included.

An AI agent falls into that exact trap when calculating quarterly revenue:

  • it does not know whether the company recognizes revenue by order date in orders, by bill date in invoices, or only after payment in payments;
  • it forgets to subtract amounts from refunds and filter out test statuses;
  • when joining four tables, it easily creates a Cartesian product, double-counting totals on partial payments.

You might reasonably ask: "Why not put the accounting rules in a vector database and hook up standard RAG?" Text search across a wiki pulls up scattered paragraphs from finance manuals, without a hard binding to foreign keys and database tables. I covered how quickly a bot loses track when its prompt is flooded with unstructured text in autonomous AI agent architecture and context management. For relational databases, an agent needs a strict, machine-readable data map.

Scanning and Ontology: How AutoOntology Extracts Structure and Maps Relationships

Instead of forcing the LLM to re-solve the schema puzzle on every question, AutoOntology inserts an ontology (a semantic layer) between the database and the agent. Simply put, it is a glossary of the database where business concepts are rigidly bound to physical columns and calculation formulas.

Building that glossary starts with the Discovery and Grounding stages:

  1. Metadata collection. An ingestion worker connects to the database and reads primary and foreign keys, indexes, data types, and column comments.
  2. Concept graph construction. Using NVIDIA NIM models, the system generates business terms ("Customer", "Order", "Net Revenue"), table join rules, and SQL calculation templates.
  3. Vectorization. Terms and column descriptions are turned into embeddings and stored in a PostgreSQL catalog with the pgvector extension.

To run the pipeline, you configure NVIDIA NIM models for reasoning, embeddings, and reranking in .env:

# Base endpoint and access key
DEFAULT_MODELS_ENDPOINT="https://integrate.api.nvidia.com/v1"
DEFAULT_MODELS_API_KEY="nvapi-..."
DEFAULT_MODELS_MODEL="nvidia/nemotron-3.5-lightning-30b-a3b"

# Embedding and reranking models for ontology search
EMBED_MODEL="nvidia/nemotron-3-embed-1b"
RERANK_MODEL="nvidia/llama-nemotron-rerank-vl-1b-v2"

Here DEFAULT_MODELS_MODEL wires up the nemotron-3.5-lightning-30b-a3b reasoning model, which builds the ontology graph and generates SQL queries. EMBED_MODEL handles vectorizing terms into pgvector, and RERANK_MODEL ranks tables when searching JOIN chains. After copying .env.example to .env and running docker compose up -d, the background worker scans the connected database and builds a draft concept graph.

Metric Certification: Human Confirmation of Formulas and Enforcement of Guardrails

AutoOntology's core principle is that an automatically generated ontology is only a draft. No matter how strong a model is, it cannot guess a specific company's financial policy. That is why the third stage is Certification (Human-in-the-Loop).

A data analyst opens the web UI at http://localhost:3000, goes to the Data Catalog tab, and inspects the links between orders, invoices, payments, and refunds. The expert refines descriptions, locks in the exact quarterly revenue formula (paid bills from payments with a closed status in invoices minus confirmed returns from refunds), and certifies the metric.

Two Strict Production Rules

Never let an agent run financial reports against an auto-generated schema without manual formula certification by an analyst: without human verification, the framework does not protect against LLM hallucinations. Also, the EMBED_MODEL used during schema ingestion must strictly match the model used at query time.

The certified formula is saved in PostgreSQL as the single source of truth: from then on, the agent must use the approved SQL expression rather than its own guesses. And for measuring Text-to-SQL accuracy on the academic BIRD benchmark using Execution Accuracy, NVIDIA released the auto-ontology-eval package, complementing general auto-verification and evaluation practices for AI agents.

Integration Architecture: PostgreSQL, pgvector, FastAPI, and Serving Context Over MCP

Four components power the AutoOntology stack: a Next.js 16 web UI (port 3000, React 19, TypeScript, Tailwind CSS 4, Better Auth, Prisma), a main FastAPI backend with Python 3.12+ and LangChain (port 3001), a FastAPI ingestion worker (port 3002), and PostgreSQL with pgvector (port 5432).

The fourth pipeline stage—Context Serving—exposes verified context to external agents (Claude Desktop, LangChain, AutoGen, CrewAI) through a Model Context Protocol (MCP) server. You add the MCP server endpoint http://localhost:3001/mcp and its semantic-layer tools to the agent's configuration:

{
  "mcpServers": {
    "auto-ontology": {
      "url": "http://localhost:3001/mcp",
      "tools": [
        "get_certified_metric",
        "resolve_table_joins",
        "execute_grounded_query"
      ]
    }
  }
}

When asked about quarterly revenue, the agent calls get_certified_metric and receives the verified formula accounting for refunds. The resolve_table_joins tool returns a safe join graph for orders, invoices, and payments with no cyclic or Cartesian joins. Then execute_grounded_query runs the query in an isolated database context and returns the answer along with provenance / data lineage—the exact SQL code and table chain. If asked about a metric that does not exist in the database (such as ad spend), the agent checks ontology coverage and honestly reports the missing data instead of fabricating numbers.

Just keep one caveat in mind: although the project is open-sourced under Apache 2.0, NVIDIA currently develops it internally and does not accept external Pull Requests. Otherwise, AutoOntology gives teams a ready-made way to connect AI analysts to corporate PostgreSQL. And if you asked three analysts from different departments in your company right now—without any LLMs—to write the "net quarterly revenue" formula from your tables, would their refund deduction rules even agree on the first try?

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 2