# Retrieval-augmented generation (RAG)

> Canonical: https://skillalmanac.com/glossary/retrieval-augmented-generation | Last verified: 2026-11-24 | Index status: index-eligible

Retrieval-augmented generation (RAG) is a method that retrieves relevant information from a knowledge base and adds it to the prompt of a generative model. The original paper paired a pretrained generator with a Wikipedia index.

Also called: RAG, retrieval augmented generation.

## In plain language

An AI application can search a collection of documents for relevant information and add it to the prompt it sends to a model. Retrieval can fail to find the relevant information. In the original paper, the information in the search index could be updated when the system was run, while models that keep all their knowledge in their trained settings needed further training.

## Technical definition

The original RAG paper combines a pretrained seq2seq generator with a dense vector index of Wikipedia accessed through a pretrained neural retriever, and describes a fine-tuning recipe in which retriever and generator are trained jointly. Anthropic describes a pipeline that breaks a knowledge base into chunks and adds the most relevant chunks to the prompt sent to the generative model; retrieval there combines embeddings and BM25.

## How it shows up when you use agents

Consider a hypothetical knowledge base containing two passages: the library closes at 18:00, and the museum closes at 20:00. For a question about the library, retrieval selects the library passage and generation answers 18:00 using that passage. This illustration assumes successful retrieval and faithful generation; it is not a measured model result.

Replacing the library passage with a new closing time changes the system's available external evidence. It does not by itself change the generator's parameters. The original paper's index-updating experiment illustrates that distinction with different Wikipedia indexes.

## Common confusions

- **RAG versus a vector database.** A vector database can supply storage and search for a RAG pipeline. RAG also conditions generation on the retrieved information. The cited Anthropic pipeline combines vector search with lexical BM25 retrieval.
- **RAG versus fine-tuning.** The original paper jointly fine-tunes a query encoder and generator and shows that its external retrieval index can be replaced at test time. Updating that index differs from changing knowledge encoded in model parameters. RAG and fine-tuning can be combined.
- **Retrieval versus a correct result.** Anthropic notes that a RAG system can fail to retrieve the relevant information from the knowledge base.

## Worked examples in this catalogue

### [What Is RAG? Retrieval-Augmented Generation Explained](https://skillalmanac.com/learn/what-is-rag)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The guide includes a worked example on chunking and describes retrieving the closest chunks and placing them in the prompt.

Why it exercises the concept: A related guide in this almanac.

### [rag-chunking-planner](https://skillalmanac.com/skills/skill-almanac/rag-chunking-planner)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The catalog describes the skill as chunking documents by three strategies and measuring defects and offline recall.

Why it exercises the concept: A related tool, described by its catalog one-liner.

### [cited-deep-research](https://skillalmanac.com/skills/skill-almanac/cited-deep-research)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The catalog describes the skill as running research so that every claim traces to a logged source and quote.

Why it exercises the concept: A related tool, described by its catalog one-liner.

## Related terms

- [Large language model (LLM)](https://skillalmanac.com/glossary/large-language-model.md)
- [Embedding](https://skillalmanac.com/glossary/embedding.md)
- [Context window](https://skillalmanac.com/glossary/context-window.md)
- [AI hallucination](https://skillalmanac.com/glossary/hallucination.md)
- [Prompt](https://skillalmanac.com/glossary/prompt.md)

## Sources

- [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks — Lewis et al.; first submitted 2020, arXiv v4, 2021](https://arxiv.org/abs/2005.11401v4), arXiv (accessed 2026-11-24)
- [Introducing Contextual Retrieval — 19 September 2024](https://www.anthropic.com/research/contextual-retrieval), Anthropic (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
