Promptwatch Logo

Retrieval-Augmented Generation (RAG)

Retrieval-augmented generation is a technique that pairs a language model with a retriever, so each answer is written from documents fetched for that query.
Updated October 15, 2026
AI

Definition

Retrieval-augmented generation (RAG) is a technique that connects a language model to an external collection of documents through a retriever, so the model writes each answer conditioned on passages fetched for that specific query instead of relying only on what is stored in its weights. The name comes from a 2020 paper by Patrick Lewis and colleagues at Facebook AI Research, University College London and New York University, which paired a pre-trained sequence-to-sequence model (the 'parametric memory') with a dense vector index of Wikipedia (the 'non-parametric memory') and found the combination produced 'more specific, diverse and factual language' than the model alone (Lewis et al.).

This entry describes the technique. For how ChatGPT, Perplexity and Google's AI features apply it to web search, see RAG.

A RAG system has an offline part and a query-time part. Offline, documents are split into chunks of a few hundred tokens, each chunk is converted into a vector with an embeddings model, and the vectors are stored in an index. Most production systems also build a keyword index so they can run hybrid search. At query time, the system retrieves candidate chunks, reorders them with a reranking model, places the top results into the model's context window, and generates an answer that cites them.

Chunking is where many systems lose accuracy. Anthropic's September 2024 write-up on Contextual Retrieval gives a typical failure: a chunk that says 'the company's revenue grew by 3%' cannot be matched to a question about a named company and quarter, because the name and date sat in an earlier paragraph. Prepending 50 to 100 tokens of chunk-specific context before embedding and keyword indexing cut top-20 retrieval failures by 49% in Anthropic's tests, and by 67% when combined with reranking (Anthropic).

Several variants build on the basic design. Agentic RAG lets the model decide what to search for, read the results and search again, which is how deep research products work. Adaptive retrieval decides per query whether retrieval is needed at all and how much. Graph-based RAG retrieves over a knowledge graph of entities and relationships rather than over loose text chunks.

RAG is often compared with two alternatives. Long context means putting the whole corpus into the prompt; Anthropic noted that a knowledge base under about 200,000 tokens can simply be included, and current Claude models accept 1 million tokens. That works for a manual, not for the web. Fine-tuning changes a model's behavior and style, but it is a poor way to keep facts current, because every update needs another training run.

For content owners, each stage of a RAG pipeline is a filter. A page has to be indexed, chunked into passages that still make sense on their own, matched by both keyword and vector retrieval, and scored highly by a reranker before the model sees it. Retrieval evaluation is how engineering teams test each of those stages, and the same logic explains why some well-ranking pages never appear in AI answers.

Examples of Retrieval-Augmented Generation (RAG)

  • A support team splits 12,000 help-center articles into 400-token chunks, retrieves the top 50 with hybrid search, reranks them down to 8, and has the model answer tickets with links to those articles.
  • A finance assistant keeps failing on 'What did ACME report for Q2 2023?' because the relevant chunk only says 'the company'. Adding the document title and period to every chunk before indexing fixes most of the misses.
  • A product team with a 150-page manual skips RAG entirely and places the whole manual in the prompt, since it fits comfortably in the model's context window.
  • A research agent runs three retrieval rounds on a regulatory question, using gaps in the first set of passages to write narrower follow-up queries.

Terms related to Retrieval-Augmented Generation (RAG)

RAG (Retrieval-Augmented Generation)

RAG is how AI answer engines like ChatGPT search, Perplexity and AI Mode fetch web pages at question time and cite them, deciding which brands appear.

AI

Embeddings

Embeddings are numeric vectors that represent the meaning of text, images or other data, so AI systems can compare content by meaning. They power vector search.

AI

Hybrid Search

Hybrid search runs keyword and vector retrieval together and merges the results, so a system matches exact terms and meaning at once. AI search engines use it.

AI

Reranking

Reranking is the second retrieval stage, where a precise model rescores candidate passages so only the most relevant few reach the LLM that writes the answer.

AI

Content Chunking

Content chunking is splitting text into smaller segments: a step retrieval systems run before indexing, and a writing practice of self-contained sections.

GEO

Context Window

A context window is the maximum number of tokens an LLM can consider at once, covering input and output. Frontier models offered about 1 million tokens in 2026.

AI

Adaptive Retrieval

Adaptive retrieval is when an AI system decides per question whether to retrieve, and how much, instead of always fetching a fixed number of documents.

AI

Retrieval Evaluation

Retrieval evaluation measures whether a search or AI system finds the right documents and passages for a query, before judging the answer written from them.

Analytics

Parametric Knowledge

Parametric knowledge is what a language model learned in training and stores in its weights. It answers without searching, but cannot cite or update itself.

AI

Sub-Document Retrieval

Sub-document retrieval is when AI search systems index and rank passages within pages rather than whole pages, making the passage the unit that gets cited.

GEO

Frequently Asked Questions about Retrieval-Augmented Generation (RAG)

Learn about AI visibility monitoring and how Promptwatch helps your brand succeed in AI search.

The term comes from the 2020 paper 'Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks' by Patrick Lewis and co-authors from Facebook AI Research, University College London and New York University. It combined a generator model with a neural retriever over a vector index of Wikipedia and set the state of the art on three open-domain question answering tasks at the time.

Be the brand AI recommends

Monitor your brand's visibility across ChatGPT, Claude, Perplexity, and Gemini. Get actionable insights and create content that gets cited by AI search engines.

Promptwatch Dashboard