# What is RAG (retrieval-augmented generation)?

RAG (retrieval-augmented generation) is a technique where relevant documents are fetched from a knowledge base when you ask a question and passed to the language model with it, so the answer is grounded in that material instead of the model's memory.

## How it works

1. You ask a question.
2. A search step finds the most relevant passages in a set of documents.
3. Those passages go into the model's [context window](https://ai-powered.com/academy/glossary/context-window) together with your question.
4. The model answers from them, and can cite them.

## When it helps

RAG suits up-to-date information, company knowledge and anything that needs sources. Its answers are only as good as what the search step finds. With [MCP](https://ai-powered.com/academy/glossary/mcp), an assistant can do its own retrieval by calling a search tool.

## Sources

Official documentation, checked on 19 November 2026:

- [Glossary (Claude docs)](https://platform.claude.com/docs/en/about-claude/glossary)

## Related terms

- [LLM](https://ai-powered.com/academy/glossary/llm): An LLM (large language model) is an AI model with a very large number of parameters, trained on vast amounts of text, that generates text: it can answer questions, summarise, write and more. AI assistants are built on LLMs that are further trained to be helpful.
- [Context window](https://ai-powered.com/academy/glossary/context-window): The context window is the amount of text a language model can look at while it writes a reply: your messages, files, tool results and its own earlier answers. It is the model's working memory, separate from what it learned in training, and it is measured in tokens.
- [MCP](https://ai-powered.com/academy/glossary/mcp): MCP (Model Context Protocol) is an open standard for connecting AI applications to outside tools and data. An AI app connects to small programs called MCP servers, asks each one what it offers, and calls those tools when a task needs them.
