---
title: "Retrieval-augmented generation (RAG)"
canonical: https://replypen.com/glossary/retrieval-augmented-generation
description: "Retrieval-augmented generation, or RAG, is a way of building AI answers in two steps: look up the passages in your own documents that match the question, then write the answer from them."
question: "What is retrieval-augmented generation (RAG)?"
author: "ReplyPen team"
published: 2026-09-30
operator: ProBackup BV (Hasselt, Belgium)
---

# What is retrieval-augmented generation (RAG)?

Retrieval-augmented generation, or RAG, is a way of building AI answers in two steps: look up the passages in your own documents that match the question, then write the answer from them. It is the most common technique behind grounded AI answers, and its quality depends on what the lookup finds.

In plain terms: look it up, then write. The "retrieval" step searches a collection, such as help
articles, website pages or past emails, for the pieces most related to the question. The "generation"
step hands those pieces to the model together with the question, so it writes from them instead of
from memory.

## Why it matters

RAG is why an AI tool can answer questions about your business without being trained on it. It also
explains most of its failures. If the search step finds the wrong article, or nothing, the model
writes from whatever it got. So answer quality depends as much on the quality and freshness of your
sources as on the model.

Many tools add more than one lookup, or let the system search again when the first results do not
answer the question. The principle stays the same.

## An example

A customer asks how long a refund takes. Retrieval finds the refunds article and a past reply that
mentions bank processing times. The model writes a reply that combines the two and can point to
both.

The broader idea is [grounding](https://replypen.com/glossary/grounding.md).

## Related

- [Grounding](https://replypen.com/glossary/grounding.md): Grounding means an AI system bases its answer on specific source material, such as your help articles, website pages, past replies or records, instead of on what it absorbed during training.
- [Knowledge base](https://replypen.com/glossary/knowledge-base.md): A knowledge base is a collection of information a business keeps so answers can be looked up instead of remembered: policies, product details, how-to steps, known problems and their fixes.
- [Hallucination](https://replypen.com/glossary/hallucination.md): An AI hallucination is a confident statement from an AI model that is false or made up: a policy that does not exist, a wrong price, an invented feature or a link that leads nowhere.
