Skip to content

Glossary · AI and automation

RAGRetrieval-augmented generation

RAG (retrieval-augmented generation) is a technique in which, before answering, the system looks up the relevant documents and hands them to the language model along with the question. The answer then rests on your data, not only on what the model learned in training.

RAG: the details

The name comes from a 2020 research paper. The process has three steps: documents are split into chunks and indexed, usually as vectors that represent their meaning; when a question arrives, the most similar chunks are retrieved; and the model writes the answer citing those chunks. Quality depends more on retrieval than on the model: if the right chunk doesn’t arrive, the answer will be plausible and wrong.

RAG isn’t the only way to give a model context. When the data lives in a system with good search or an API, giving the model a tool to query it usually works better. And when the corpus is small, it fits in the context whole. RAG pays off with many documents that change often and when you need to show the source of every statement.

RAG in a project

Before building a RAG system we measure with real questions: what share retrieves the right chunk and how many answers cite a source that supports them. We respect the permissions of the source—nobody gets through the assistant what they can’t open by hand—and every answer links to the document it comes from.

On this site

Where we apply it

All services

Glossary

Related terms

See the whole glossary

Get started

Does this come up in your project?

Tell us which system you have and what is still done by hand. We’ll tell you where we would start and whether it fits.

Before you write, see how we price a project or our solutions by department.

Fig. 07Morse keyH · E · L · L · O