Skip to the content
searchboar.

AI search and visibility

What is RAG? Retrieval-augmented generation

RAG, or retrieval-augmented generation, is an AI design pattern that first retrieves relevant information from an external source and then supplies it for answer generation. Sources can include document collections, databases or search results. Retrieval and generation are distinct steps, and both affect quality.

Also known as: retrieval-augmented generation

At a glance

  • RAG supplements the current response input with external information.
  • It differs from retraining a model and from a complete search product.
  • Useful answers require appropriate retrieval, correct interpretation and verification.
On this page
Source excerpts selected for a question enter the input used to generate its answer.
RAG supplements generation with retrieved material; retrieval and writing are separate steps.

What do the letters mean?

RAG stands for retrieval-augmented generation. It combines finding information with generating a response, allowing the system to use external material selected at task time rather than relying only on learned patterns.

Google Cloud's overview describes documents and other external data. RAG is a technical pattern, not a brand or finished product. Two RAG applications can use very different sources and processes.

What does a simple workflow involve?

The system locates information related to the question, then supplies selected details to a large language model. The product may attach references or other ways to check the resulting answer.

StepMain question
RetrievalWas the necessary material found?
SelectionWas the right version and passage chosen?
GenerationDoes the answer use it correctly?
VerificationCan claims be traced to evidence?

Fluent prose cannot repair retrieval of the wrong document. Diagnose failure in the relevant stage.

How does it differ from training?

RAG can supply current information while preparing an answer without changing model weights. Updating a source document need not require retraining the language model.

Supplied material must also fit the context window. The entire document collection may not enter at once. Selecting relevant portions is essential and can omit important evidence.

Example: a repair company's knowledge base

Imagine documentation for several machine models. A support employee asks about replacing one model's filter. Retrieval must select the correct model and document version before the answer summarizes the relevant information.

A similar-looking model's guide can produce an incorrect answer even when summarized faithfully. Missing documentation should be acknowledged instead of borrowing assumptions from another product. This is a workflow illustration, not maintenance advice.

Clear identification, versioning and organization directly affect usefulness. RAG does not remove dependence on source quality.

How does grounding relate?

Grounding describes connecting answers to verifiable information. RAG is one possible implementation. A source link or manually supplied short document does not by itself describe an equivalent retrieval system.

AI search describes an information-seeking process that may combine techniques. Distinguish user purpose, the grounding principle and implementation pattern.

Which failures should be tested?

Check relevance, currency and fidelity. Hallucinations can still fill missing details or turn a conditional statement into a firm promise.

Include questions unanswered by the sources and cases requiring selection among similar documents. Recognizing missing evidence is part of success, not merely producing polished answers when all information is easy to find.

Retrieved material can also contain prompt injection: text that attempts to redirect the assistant rather than supply evidence. A relevant-looking document is not automatically an authorized source of instructions. Test whether the application keeps retrieved text separate from task authority and restricts consequential actions; adding retrieval does not itself create that protection.

Sources

  1. Google Cloud: retrieval-augmented generation
  2. Google Cloud: grounding overview
  3. Google Cloud: long context and context windows