Retrieval-Augmented Generation (RAG)

What is Retrieval-Augmented Generation (RAG)?

Retrieval-augmented generation (RAG) is a technique in which an AI system retrieves relevant information from external sources, such as documents or databases, and gives it to a language model to ground its answer.

Updated November 2026 · 2 min read


Retrieval-augmented generation (RAG) is how most AI assistants answer questions about an organization's own content. Before the model responds, the system looks up relevant passages, such as policies, product documentation or contracts, and adds them to the prompt, so the answer rests on those sources rather than on what the model memorized in training. It needs no retraining, and answers can cite where they came from.

The term comes from a 2020 research paper by Patrick Lewis and colleagues at Facebook AI Research, now Meta, which combined a retrieval system with a generative model to improve performance on knowledge-intensive tasks.

How RAG works

  1. Prepare: documents are split into chunks, and each chunk is converted into an embedding, a numerical representation of its meaning, and stored, often in a vector database.
  2. Retrieve: when a question arrives, the system finds the most relevant chunks, often combining meaning-based and keyword search.
  3. Rerank: a second model may reorder results so the best ones come first.
  4. Generate: the retrieved chunks are added to the prompt, and the model answers using them, ideally with citations.

RAG vs. fine-tuning

RAGFine-tuning
Best forFacts and knowledge that changeStyle, format and specialized behavior
UpdatingAdd or change documentsRetrain the model
CitationsNatural, since sources are knownDifficult
Access controlCan respect each user's permissionsKnowledge is baked into the model for everyone

RAG limitations

  • Poor chunking that splits key facts across pieces.
  • Questions that need many documents, such as "what are the main themes across all customer complaints?"
  • Relationships between facts, such as which teams depend on which systems. See GraphRAG.
  • Precise numbers, which are better answered by querying structured data.
  • Outdated or conflicting sources.

An example

Consider a hypothetical engineering firm with 40,000 pages of standards and project specifications. Engineers spend hours searching for requirements. It builds a RAG assistant that indexes the documents with their project, version and discipline, filters by the engineer's project and returns answers with links to the exact clauses. Early tests show the assistant often cites superseded versions, so the team adds version metadata and excludes superseded documents from retrieval. Search time for typical questions drops from about 30 minutes to two.

RAG is the most widely used technique for AI grounding and a central part of context engineering.

Frequently asked questions

How is RAG different from fine-tuning?

RAG supplies facts at question time by retrieving documents, so knowledge changes when documents are added or edited, answers can cite sources and access can follow each user's permissions. Fine-tuning retrains the model and suits style, format or specialized behavior, but the knowledge it bakes in is hard to update or cite and is shared by every user.

What are the steps in a RAG pipeline?

A RAG pipeline usually has four steps. Documents are split into chunks, converted into embeddings and stored, often in a vector database. When a question arrives, the system retrieves the most relevant chunks, often mixing meaning-based and keyword search. A reranking model may reorder them. Finally the chunks are added to the prompt and the model answers from them, ideally with citations.

When does RAG give poor answers?

RAG struggles when chunking splits key facts across pieces, when a question needs themes from many documents, and when the answer depends on relationships between facts, which GraphRAG addresses. It is also weak on precise numbers, which structured data answers better, and it will repeat outdated or conflicting sources unless superseded versions are kept out of retrieval.

Book a demo