Skip to content
Glossary · AI building blocks

RAG (retrieval-augmented generation)

Also called retrieval-augmented generation, grounded generation.

Definition

A pattern that finds relevant passages from your own data and gives them to a language model along with the question, so it answers from your content.

Last updated

What it is.

A RAG system has two parts. Retrieval searches your documents, tickets or records for the passages most relevant to the question, often using embeddings in a vector database, keyword search, or both. Generation sends those passages and the question to an LLM, which writes an answer based on them.

Because the knowledge lives in your data store, not in the model, you can update it any time without retraining, and the answer can cite the exact passages it used.

Why it matters

RAG is the usual way to make an AI assistant answer from company knowledge: policies, product docs, contracts, past cases. It reduces hallucinations on factual questions and lets you enforce permissions by only retrieving what the user is allowed to see.

Watch out

Common mistakes.

  1. 01

    Blaming the model for bad answers when retrieval found the wrong passages. Test retrieval on its own.

  2. 02

    Splitting documents into chunks that cut tables and clauses in half.

  3. 03

    Ignoring permissions, so the assistant can quote documents the user should not see.

Tools

Work it out with a tool.

Related

Related terms.

Building something with this? Ask an engineer.

OceanLab designs and builds production software. Tell us what you are planning and we will reply with how we would approach it.

OceanLab

Enterprise Software Engineering - Human + AI

Languages

Locations

Global Headquarters

21 Merchant Road, 3rd Floor, Singapore 058267

Main corporate office and leadership operations

North America Office

548 Market Street, PMB 12472, San Francisco, CA 94104

Client operations and business development

India Office

402 Shivalik Shilp II, SG Highway, Ahmedabad 380015

Engineering and delivery center

© 2026 - Copyright. All Rights reserved OceanLab