Skip to main content

What is the difference between RAG, a semantic layer, a knowledge graph, and an ontology?

Summary

  • RAG (retrieval-augmented generation) is a technique that combines a large language model with real-time data retrieval: retrieve supporting data, augment the prompt, then generate a response.
  • A semantic layer is a business-aligned view of data that abstracts away underlying complexity and gives applications and agents a consistent, governed understanding of the business.
  • A knowledge graph represents entities and the relationships between them as a graph, capturing how concepts connect.
  • An ontology is a unified context layer that combines human-modeled semantic definitions with automatically inferred context from data assets and usage.
  • On Databricks these come together in the Genie context layer, Unity Catalog metric views, Databricks AI Search for RAG, and the Unity Catalog Glossary.

What is the difference between RAG, a semantic layer, a knowledge graph, and an ontology?

These are four distinct concepts that are often used together to give AI systems accurate, business-aware context. RAG is a retrieval technique, a semantic layer is a governed business view of data, a knowledge graph captures how entities relate, and an ontology is a unified context layer that models meaning. The sections below define each and then show how Databricks brings them together.

RAG (retrieval-augmented generation)

Retrieval-augmented generation combines large language models with real-time data retrieval to generate accurate, contextually relevant responses. It works in three stages: (1) retrieval, querying an external knowledge base such as a vector store, keyword search, or SQL database to get supporting data; (2) augmentation, combining that data with the user's request into a formatted prompt; and (3) generation, passing the augmented prompt to an LLM to produce the response. RAG is especially valuable for proprietary, frequently changing, or domain-specific information. See production-quality RAG applications.

Semantic layer

A semantic layer provides a real-time, business-aligned view of data that abstracts away underlying complexity and enriches data with business context. It acts as a bridge between raw data and application or agent comprehension, ensuring they operate on a consistent, governed, and understandable view of the business. A semantic layer includes both product semantics (object-oriented views of core business entities) and analytical semantics (consistent KPI definitions sourced from curated metric views). See the semantic and knowledge layers.

Knowledge graph

A knowledge graph represents entities and the relationships between them as a graph, capturing how concepts connect to one another. Knowledge graphs are typically purpose-built semantic structures, and they can be integrated alongside other context layers to enrich how an AI system understands a domain.

Ontology

An ontology is a unified context layer that combines human-modeled semantic definitions with automatically inferred context from data assets and usage patterns. On Databricks, the Genie ontology consists of two parts: explicitly governed business context defined through Unity Catalog semantics (metric views, domains, pages, and certification), and automatically extracted knowledge snippets mined from lineage, query history, and user interactions. It is a living semantic model that continuously updates.

How Databricks brings these concepts together

  • Genie and its context layer. Genie is the Databricks AI agent that consults a living semantic model, its knowledge store, to answer questions. Its context layer combines human-modeled Unity Catalog semantics with knowledge mined from lineage, query history, and chat interactions.
  • Unity Catalog metric views. Metric views are reusable SQL objects that define and govern business KPIs as Unity Catalog securable objects. They provide deterministic KPI definitions authored once and applied wherever referenced, forming the analytical semantic layer so agents report metrics using the same definitions as established BI tools.
  • Databricks AI Search for RAG. Databricks AI Search is a managed vector index supporting hybrid dense and sparse retrieval. It syncs from any Unity Catalog table with auto-refresh, supports Databricks-managed or bring-your-own embeddings, and is governed end to end by Unity Catalog permissions. RAG pipelines are MLflow-traced for end-to-end debuggability. See what is a vector database.
  • Unity Catalog Glossary. The Unity Catalog Glossary is a governed wiki where admins can see, audit, and publish knowledge that improves the context layer's view of the business, serving as a customer-managed way to influence the ontology.

Getting started

FAQs

Is RAG the same as a semantic layer?

No. RAG is a retrieval-and-generation technique for LLMs, while a semantic layer is a governed, business-aligned view of data. RAG can retrieve from sources that a semantic layer helps define, but they solve different problems.

How is an ontology different from a knowledge graph?

A knowledge graph represents entities and their relationships as a graph. An ontology is a broader unified context layer that models the meaning of the business, combining human-defined semantics with automatically inferred context; it can incorporate graph-based structures.

How does Databricks implement a semantic layer?

Through Unity Catalog semantics, most notably metric views that define governed KPIs once and apply them consistently, plus the Genie context layer and the Unity Catalog Glossary.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.