Back to explore
AI & MLMental model5 min

Retrieval augmented generation

How retrieval adds relevant context to a language model’s answer.

Process overview

Conceptual illustration for Retrieval augmented generation
  1. Prepare
  2. Ask
  3. Retrieve
  4. Ground
  5. Answer

Steps

5 steps

Make knowledge searchable

Split source documents into useful chunks and build a search index. Embeddings can represent chunks for vector search alongside keyword retrieval.

The user brings a question

The application turns the question into a retrieval query. Keyword and vector search can work together to find relevant information.

Find useful context

The retrieval system selects relevant chunks. Ranking, result limits, and permission filters help determine which context reaches the model.

Add context to the prompt

The application combines the user’s question, selected context, and instructions. This supplies information without retraining the language model.

Generate an answer with provenance

The model uses that context to produce a response. Source references help users inspect the evidence; retrieval does not guarantee a correct answer.

Scope

A classic RAG pattern, simplified. Search quality, access control, evaluation, and citation accuracy determine how useful the system becomes.

Source

Microsoft Learn · Retrieval augmented generation(opens in a new tab)
Saved explanations