# What is RAG? Retrieval-augmented generation explained

> RAG lets a language model look up documents before it answers. How it works, where it came from, and three new examples from AWS, JetBrains and Apple.

URL: https://claudegpt.si/news/what-is-rag-retrieval-augmented-generation  
Published: 2026-11-06T02:54:38.457Z  
Author: ClaudeGPT Si Newsroom  
Section: Research  
Topics: RAG, Retrieval-augmented generation, Amazon Bedrock, JetBrains, Apple, Vector search  
Publisher: ClaudeGPT Si

## Key takeaways

- RAG, from a 2020 paper by Patrick Lewis and colleagues, retrieves passages from a document index and gives them to a language model before it answers.
- A typical pipeline splits documents into chunks, embeds them, stores the vectors, then searches them at question time.
- On November 5, 2026, AWS, JetBrains and Apple each published work on managed web answers, code search and faster retrieval.

RAG, short for retrieval-augmented generation, is a way to make a language model answer from documents it looks up at the moment you ask, instead of from memory alone. Before the model writes anything, a search step pulls the most relevant passages from a data source and pastes them into the prompt. The name comes from a [2020 paper by Patrick Lewis and colleagues](https://arxiv.org/abs/2005.11401), and it is now the default way to connect a model to private or fresh data.

The reason it exists is simple. A model knows only what was in its training data, and it can't tell you where a claim came from. The Lewis paper puts it this way: large pre-trained models store facts in their parameters but struggle to access and manipulate them precisely, which leaves provenance and updating knowledge as open problems. RAG addresses both. You change the documents, not the model, and you can show the passages the answer rests on.

## What is RAG in the original paper

The paper, accepted at NeurIPS 2020, has twelve authors and was first posted on May 22, 2020. It combined two kinds of memory. The parametric memory was a pre-trained sequence-to-sequence model, the part that writes text. The non-parametric memory was a dense vector index of Wikipedia, searched by a pre-trained neural retriever. The retriever is trained together with the generator, so the system learns which passages help.

The authors tested two versions. One conditions the whole answer on the same retrieved passages. The other can draw on different passages for each token it writes. They report the best results to date on three open-domain question answering tasks, and say RAG produced more specific, diverse and factual text than a baseline that relied on its parameters alone.

Most RAG systems today don't train the retriever and generator together. They wire an off-the-shelf search layer to an off-the-shelf model. The idea is the same.

## How RAG works, step by step

AWS describes the pattern in its [Bedrock Knowledge Bases documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-how-it-works.html). It has two phases.

**Preparing the data, done ahead of time:**

1. Convert documents to text and split them into chunks.
2. Run each chunk through an embedding model, which turns text into a list of numbers so that texts with similar meaning end up close together.
3. Store the vectors in a vector index, keeping a link back to the original document.

**Answering a question, done at runtime:**

1. Embed the user's question with the same model.
2. Search the index for the chunks closest to the question.
3. Add those chunks to the prompt and send it to the model.
4. The model writes the answer from the question plus the retrieved text. Many systems also return the source passages as citations.

OpenAI's hosted [file search tool](https://developers.openai.com/api/docs/guides/tools-file-search) packages the same loop. You upload files, put them in a vector store, and pass the store's ID to the model. It combines semantic and keyword search and returns answers with file citations. The docs note that capping the number of results can cut tokens and latency, "but may come at the cost of reduced answer quality."

Anthropic's docs cover the retrieval half. Anthropic [does not offer its own embedding model](https://platform.claude.com/docs/en/build-with-claude/embeddings) and points to Voyage AI, which also sells rerankers, models that re-sort retrieved results by relevance. The docs say to tell the embedding model whether a text is a query or a document, because that gives better retrieval.

## RAG compared with fine-tuning and long context

AWS says a knowledge base removes the need to keep training a model to use your private data. That is the practical case for RAG over fine-tuning: facts change, and updating an index is cheaper than retraining. Retraining is the slow path.

Long context windows are the other alternative. You can paste a whole document into the prompt. That works for one file. It stops working for millions of chunks, and RAG is how you choose which few to include.

## Where RAG is going: three recent examples

Three items published on November 5, 2026 show the range.

**Search as a managed service.** AWS made [Web Answer on Amazon Bedrock AgentCore](https://aws.amazon.com/blogs/machine-learning/getting-started-with-web-answer-on-amazon-bedrock-agentcore/) available. An agent sends a question through an AgentCore Gateway and gets back an answer with citations in one tool call. AWS runs the searching, fact-checking of key pages and writing. The post doesn't use the word RAG, but the pattern of retrieving sources, synthesizing and citing is the same, applied to the live web instead of your own files. It launched in US East (N. Virginia) with a limit of 10 transactions per second per account.

**RAG over code.** JetBrains described how it built [Air Context](https://blog.jetbrains.com/ai/2026/11/building-a-rag-pipeline-for-semantic-code-search-a-developer-diary-and-field-notes-part-2/), a RAG system for searching code. A codebase produces millions of vectors and changes with every commit, so the team uses approximate nearest-neighbor search, which is fast but can miss the true best match, followed by an exact pass over a small candidate set. Permission and repository filters live inside the index. A reranker then reorders candidates, and a search sub-agent can decide when to look further. The lesson for anyone building RAG: retrieval is mostly a storage and filtering problem, and the model is only one part of it.

**Faster retrieval.** Apple researchers published [work on maximum inner product search](https://machinelearning.apple.com/research/faster-retrieval), the step that finds the best-matching vector, and the one that gets slow at millions of passages. They train small networks to route a query to the right part of the index. On Natural Questions, with about 2.6 million passages, Apple reports its SupportNet reaches 95% routing recall about 1.9 times faster than the usual centroid approach (1.74 ms against 3.36 ms). A second model, KeyNet, reaches 99% recall with up to about 8 times less time. These are Apple's own numbers on one dataset, each model needs training for a fixed database and query pattern, and the page doesn't mention released code.

## Where RAG falls short

RAG doesn't make a model right. If retrieval returns the wrong chunks, the model answers from the wrong text. OpenAI's own caution about result limits shows the trade-off between cost and quality. JetBrains found that the approximate search that makes RAG fast can lose relevant results, which is why it adds a second pass. Chunking, filters and ranking all affect quality, and none of them is solved by a better model.

If you are starting out, a managed option such as Bedrock Knowledge Bases or OpenAI's file search gets a first version running without building the pipeline. Build your own when you need control over filters, permissions or ranking, as JetBrains did.

## Frequently asked questions

### What does RAG stand for?

RAG stands for retrieval-augmented generation. The term comes from the 2020 paper by Patrick Lewis and colleagues, which combined a pre-trained text generator with a searchable index of Wikipedia.

### How does RAG work?

Documents are split into chunks, turned into embeddings and stored in a vector index. When a question arrives, it is embedded too, the closest chunks are retrieved, and they are added to the prompt so the model answers from them.

### Is RAG better than fine-tuning?

They solve different problems. AWS says a knowledge base removes the need to keep training a model on your private data, so RAG suits facts that change. Its quality depends on retrieval, which can return the wrong chunks.

### Does Claude have its own embedding model for RAG?

No. As of November 6, 2026, Anthropic's docs say it does not offer its own embedding model and point to Voyage AI, which also offers rerankers.

## Sources

- [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401), arXiv
- [How Amazon Bedrock knowledge bases work](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-how-it-works.html), Amazon Web Services
- [File search](https://developers.openai.com/api/docs/guides/tools-file-search), OpenAI
- [Embeddings](https://platform.claude.com/docs/en/build-with-claude/embeddings), Anthropic
- [Getting started with Web Answer on Amazon Bedrock AgentCore](https://aws.amazon.com/blogs/machine-learning/getting-started-with-web-answer-on-amazon-bedrock-agentcore/), Amazon Web Services
- [Building a RAG Pipeline for Semantic Code Search: A Developer Diary and Field Notes, Part 2](https://blog.jetbrains.com/ai/2026/11/building-a-rag-pipeline-for-semantic-code-search-a-developer-diary-and-field-notes-part-2/), JetBrains
- [Faster Retrieval for Better, More Efficient RAG](https://machinelearning.apple.com/research/faster-retrieval), Apple Machine Learning Research
