Home › Key concepts › Retrieval-augmented generation (RAG)

Key concept · Walk (intermediate) · the same on every platform

Retrieval-augmented generation (RAG)

Find the right passages first, then let the model answer from them, with citations.

What it is

RAG has two steps. Retrieval searches your documents (by meaning, keywords or both) for passages relevant to the question. Generation gives those passages to the model and asks it to answer only from them and cite them.

Questionfrom the userSearchby meaningand keywordsTop passageswith sourcesModelanswers onlyfrom theseAnswerwith citationsif search misses the right passage, no model can save the answer: test retrieval on its own
Retrieval-augmented generation: find first, then answer from what you found.

Why it matters

It lets a model answer from your own, current documents without retraining, and lets people check the source.

An example

'What is my excess for windscreen damage?' retrieves clause 4.2 of the customer's policy, and the answer quotes it.

The common mistake

Blaming the model for wrong answers when retrieval never found the right passage. Measure retrieval separately.

Where you meet it on each platform

The idea stays the same; only the product name changes.

JobAWSAzureGoogle CloudDatabricksOpen source
Vector searchfind passages by meaning, not exact wordsOpenSearch Serverless / Aurora pgvectorAzure AI SearchVertex AI Vector Search / AlloyDBVector Searchpgvector or Qdrant
Model APIcall a large language modelAmazon BedrockAzure OpenAI in Microsoft FoundryGemini on Vertex AIFoundation Model APIsOllama, or a free hosted open model

Related ideas

Where it shows up

Part of the Walk level on these paths: AI Engineering (knowledge) · LLM Engineering (adapting models).