Back to the index
40/ 55

AGENTS & TOOLS

RAG.

Retrieval-augmented generation

Giving a model retrieved information to help ground the answer it generates.

In plain words

Retrieval-augmented generation combines an information-retrieval step with a generative model. The system finds relevant material and supplies it as context for the model’s response.

A closer look

A typical pipeline prepares documents, searches them for passages relevant to a query, and includes selected passages in the prompt. Retrieval may use keyword search, embeddings, or a combination. More advanced systems can rerank results or perform additional searches when information is missing.

RAG can make private or current information available without changing the model’s weights. Its quality depends on the documents, retrieval method, and the model’s use of the evidence. A missing document, poor search result, or incorrect interpretation can still produce a bad answer.

In practice

AN EXAMPLE

An employee asks about travel reimbursement. The system retrieves the relevant section of the company’s current policy and asks the model to answer from it, citing the passage.

A useful distinction

Retrieval does not automatically make an answer true. The source can be wrong or outdated, and the model can go beyond what it supports. A citation is useful only when it actually backs the associated claim.

Watch & learn

Sources & further reading

Lewis et al. — Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (opens in a new tab)