Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

AI glossary

Retrieval-augmented generation (RAG)

Retrieval-augmented generation is answering a question by first finding relevant passages in your own documents and then giving them to a language model to answer from.

A RAG system has two halves. Retrieval finds the few chunks most likely to hold the answer, often by vector search; generation puts those chunks in the prompt and asks the model to answer from them and cite them.

It lets a model answer about documents it was never trained on, such as this week's policy, without changing the model at all. Updating the answers means updating the documents.

Most failures are retrieval failures: the right passage was never found, so the model answered from nothing. Measure whether retrieval finds the right chunk before tuning the prompt.

Learn it hands-on

These free lessons teach it with commands to run in a lab and checked tasks. Read them whole with no account.

← All AI terms