Retrieval augmented generation, abbreviated as RAG, is a technique that connects a generative model to an external document source: before producing the answer, the system retrieves the documents relevant to the request and provides them to the model as context to use. Generation therefore starts from material consulted at that moment, not only from the knowledge fixed during training.

The approach was created to address a specific limitation of language models: their internal knowledge is frozen at the training period and cannot be traced back to identifiable documents. By connecting the model to an up-to-date archive, it becomes possible to answer about recent or organization-confidential information, and above all to indicate which document the statement came from.

RAG and content visibility

Many AI-based searches work like this: the system retrieves pages and passages from the web, passes them to the model, and builds the answer citing the sources. For content publishers, this means a page can be cited only if it is retrieved, and it is retrieved more easily if each section is clear, self-contained, and verifiable. That is why GEO works on structure, clear definitions, and sources. Further reading: paragraph-level retrieval and query fan-out.

Retrieval and generation: two distinct tasks

The mechanism separates two responsibilities: retrieval, which identifies the relevant texts, and generation, which turns them into a readable answer. The model does not need to remember the content, but it must be able to read and synthesize it correctly.

How documents become searchable

Documents are split into manageable-sized chunks and converted into numerical representations that describe their meaning. These representations are stored in an archive that allows quickly finding texts semantically close to a question, even when they do not contain the same words used in the request.

From question to document-based answer

When the question is received, the system converts it into the same numerical format, selects the most similar document chunks, and inserts them into the context along with the original request. The model then receives an instruction that includes both the question and the material to base the answer on, and produces the answer working from that material.

From document collection to final answer

  1. Collect the documents to make available and normalize their format.
  2. Split them into coherent chunks, avoiding cuts that break meaning.
  3. Compute the numerical representations of each chunk and store them.
  4. Retrieve the most relevant chunks for each question.
  5. Compose the context to pass to the model along with the request.
  6. Generate the answer and link it to the documents actually used.

What RAG solves and what it leaves out

Problem Effect of RAG
Outdated knowledge Solved: documents are consulted at request time
No citable sources Solved: the answer can point to the retrieved documents
Confidential or internal information Solved without retraining the model
Inaccurate statements Reduced but not eliminated: depends on retrieval quality
Incorrect source documents Not solved: the error is carried into the answer

Limitations of retrieval augmented generation

If retrieval does not find the right document

Overall quality depends decisively on the retrieval phase. If the selected chunks do not contain the necessary information, the model tends to produce an answer anyway, filling the gap with its own internal knowledge: the result appears grounded in documents while partly it is not. How texts are split also matters, because chunks that are too short lose context and chunks that are too long introduce irrelevant material.

Outdated documents and archive maintenance

A second limitation concerns the archive: an outdated or inaccurate document is treated as reliable. Maintaining the source is therefore an integral part of the system, not an accessory activity. The original formulation of the technique is described in the study Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, which introduced the name.

Evaluate retrieval and generation separately

Since the two phases can fail independently, evaluation must be conducted separately. For retrieval, you check whether the returned chunks actually contain the requested information: an archive can hold the right document and still fail to select it, for example when the question uses different vocabulary from the text. For generation, you check whether the answer stays anchored to the provided material or introduces elements that do not appear in the documents.

This distinction leads to a useful practice: keep track of the chunks used for each answer. The link between statement and document allows reconstructing the origin of an error and determining whether to fix the archive, the text splitting, or the selection criterion. Without this traceability, the system remains hard to improve, because every wrong answer appears indistinctly as a model defect.

Frequently asked questions about retrieval augmented generation

Is RAG an alternative to fine-tuning the model?

It addresses different needs. Fine-tuning changes the model’s behavior, RAG provides it with information; to add up-to-date knowledge, the latter is generally more suitable and cost-effective.

Does RAG eliminate made-up answers?

No. It reduces them, but if retrieval does not return the useful document, the model can still produce a statement not supported by the cited sources.

Do you need a very large archive?

Not necessarily. What matters is the relevance of documents to expected questions: a small but curated archive produces better results than a large and uneven collection.

Why are documents split into chunks?

Because the model’s context has limited capacity and because retrieval is more precise on short, thematically coherent units than on whole documents.

Does RAG require retraining the model when data changes?

No. It is enough to update the document archive and its numerical representations, while the model remains unchanged.

From glossary to projectDo language models cite your site as a source?Optimization for language models (LLMs) is about getting the brand cited in Google AI Overview answers and in the main LLMs.Discover LLM optimization

Related entries:

Information Retrieval Paragraph-level retrieval Generative artificial intelligence Large language model Web template