Implement generative AI and agentic solutions 2.1 Build generative applications by using Foundry
Which description best matches the retrieval-augmented generation (RAG) pattern?
Study guide skill: Implement retrieval-augmented generation (RAG) in an application
Question B1-015
Which description best matches the retrieval-augmented generation (RAG) pattern?
Select one answer.
Answer: C
RAG combines search with an LLM: relevant content is retrieved (often through an index) and provided to the model as grounding data. Fine-tuning changes model weights, which is a different technique, and stuffing all data into the prompt or using only the public web doesn't ground answers in your own content.
Deep dive
How it works
Retrieval augmented generation (RAG) combines search with large language models so responses are grounded in your data. LLMs are trained on public data available at training time, which might not be enough when you need answers from private documents or up-to-date information. RAG follows a three-step flow:
- Retrieve: when a user asks a question, your app queries an index or data store for relevant content.
- Augment: the app combines the question and the retrieved content (the grounding data) into a prompt.
- Generate: the model answers from the augmented prompt, which reduces inaccuracies and enables accurate citations.
An index organizes content for fast, consistent retrieval, and many RAG solutions support keyword, semantic, vector or hybrid search. Azure AI Search is a recommended index store, and an index can also store fields such as titles and URLs that improve citations. Agentic retrieval goes further: a model breaks a complex input into focused subqueries, runs them in parallel and returns structured grounding data.
The other options, and when you'd use them
- Fine-tune the model on your documents: Fine-tuning adjusts the model's weights through additional training. The docs say to use it when you need to change model behavior, style or task performance rather than add fresh knowledge, and it doesn't replace retrieval for current information.
- Let the model browse the public web: Public data might not be enough when you need answers from private documents. RAG retrieves from your own data so responses are grounded in it.
- Increase the context window to read the whole data store: RAG works by retrieving the relevant content and including it in the model input. An index exists so that retrieval is fast and consistent.
Exam tip
"Private or frequently changing data" means RAG. "Change tone, format or task behavior" means fine-tuning. And remember that RAG security starts at retrieval: apply access control when you retrieve, for example with security filters in Azure AI Search.
References
Last reviewed: