Primary reference: Understanding Retrieval Augmented Generation
AWS Prescriptive Guidance explains the RAG process and its components. Use its four-step overview to locate ingestion, retrieval, context augmentation, and generation before adding production controls.
Read the AWS RAG overviewRAG is an evidence pipeline, not a truth machine
RAG retrieves permitted evidence, selects context, and asks a model to answer from it. Trust depends on corpus, retrieval controls, and answer policy.
Inspectable RAG lifecycle
Loading diagram...
Choose the information path before choosing a model
Decision matrix
| Need | Prefer | Reason |
|---|---|---|
| Stable general drafting | Prompt-only | No private evidence |
| Exact state or action | Structured API | Authoritative contract |
| Changing unstructured policy | RAG | Retrieved evidence |
| Persistent behaviour | Fine-tuning evaluation | Not live knowledge update |
Search returns documents for a person; RAG additionally selects context and generates. Keep direct search when source inspection is the user task.
Design citations and abstention as behaviour
Answer contract record
Application-owned audit fields, not an AWS response schema.
Click on an annotation to highlight it in the JSON
Test permission-denied, stale, conflicting, and zero-result cases, not only fluent answers.
Turn a use case into an observable contract
- Name the user decision and allowed sources.
- Set retrieval, grounding, citation, latency, cost, and abstention measures.
- Create representative queries before tuning.
- Release only improvements that preserve controls.
Write a retrieval decision record before building
A RAG decision starts with a user decision, not a vector database. State the question the system may answer, the source classes it may use, the authority that remains outside the system, and the consequence of an unsupported answer.
Retrieval decision record
An application-owned design artifact that can be reviewed before implementation.
Click on an annotation to highlight it in the JSON
Treat this record as a change gate. If a request needs a current transaction, entitlement check, or action, route it to an authoritative API or human workflow instead of stretching retrieval into a system of record. AWS distinguishes agentic RAG from a static retrieval step because an agent can decide whether and how to retrieve during a reasoning loop; that extra autonomy needs an equally explicit decision boundary.
Assign failure ownership across the evidence path
Failure ownership map
| Observed failure | Owning control | Verification |
|---|---|---|
| Unapproved source appears | Corpus owner and access policy | Negative retrieval test returns no chunk. |
| Relevant source is absent | Ingestion and retrieval owner | Trace source version, sync state, query, and filters. |
| Answer exceeds evidence | Application answer policy | Reviewer marks each claim supported, qualified, or abstained. |
| Tool action is requested | Authoritative API or human approver | No action occurs from retrieved prose alone. |
Do not assign every failure to the model. AWS identifies connectors, processing, embeddings, retrieval, guardrails, orchestration, user experience, and identity as production RAG components. An actionable incident record therefore preserves the user query, permitted principal, source and chunk versions, retrieval results, answer mode, and reviewer disposition without treating a fluent answer as diagnostic evidence.
Lab: classify the workload and verify the chosen path
Classify three sample requests before choosing a model: “summarise this published handbook section”, “what is my remaining leave balance?”, and “compare two policy clauses and propose questions for HR”. The first is a bounded RAG candidate, the second needs an authoritative system, and the third can use retrieval only if the output is clearly advisory and cites both clauses.
- For each request, write the user decision, permitted evidence, source owner, and a no-evidence response.
- Create one supported query, one zero-result query, one access-denied query, and one conflicting-source query.
- Inspect retrieved chunks before any generated answer. Confirm that every displayed citation resolves to permitted, current source material.
- Accept the workload only when the chosen path produces an observable result for all four cases; otherwise narrow its scope or move it to an API or reviewer.
This lab deliberately avoids a universal score threshold. The useful acceptance test is whether the evidence and fallback behaviour support the specific user decision. Record disagreements between source owners as corpus governance work, not as a prompt tweak.
Build an evidence-budget and abstention test harness
An evidence budget is a reviewable limit on what an answer may claim from the retrieved material. It is not a similarity-score threshold. The harness below makes the system demonstrate a safe response for supported, incomplete, conflicting, and empty retrieval results before a team optimizes prompt wording or model selection.
Evidence-budget test case
Application-owned fixture for a repeatable acceptance suite; score values and document identifiers are illustrative placeholders.
Click on an annotation to highlight it in the JSON
- Run the same fixture through retrieval-only and answer paths, preserving returned source identities.
- Have a reviewer compare material answer sentences with the permitted and prohibited claim lists.
- Fail the case when the answer is fluent but omits a required qualification, source, or escalation.
- Version the fixture with the corpus and answer policy so a source update cannot silently change the safety boundary.
AWS frames the generative AI lifecycle as a continuous process evaluated against the six Well-Architected pillars. This harness supplies evidence for that lifecycle: it turns an abstract grounding expectation into a repeatable integration and continuous-improvement check. It does not prove factual truth outside the permitted corpus.
Use a counterfactual case as well: provide a plausible answer that is not supported by the retrieved evidence and require the application to reject it. This catches a common evaluation gap where a system merely echoes the expected answer because the fixture asks only for a keyword. Keep the expected mode independent from the model provider, so a retriever or prompt change can be compared against the same evidence budget.
Review a retrieval workload through the six-pillar lens
RAG review sheet mapped to Well-Architected pillars
| Pillar | Retrieval review question | Inspectable evidence |
|---|---|---|
| Operational excellence | Can an owner trace a poor answer to corpus, retrieval, or policy? | Versioned query trace and reviewer disposition. |
| Security | Can an unauthorized principal retrieve protected evidence? | Negative authorization retrieval cases. |
| Reliability | What happens when evidence is absent or a dependency fails? | Tested abstention and degraded-mode response. |
| Performance efficiency | Does context selection meet the workload need without unnecessary work? | Representative retrieval and context measurements. |
| Cost optimization | Are retrieval and generation work visible to workload owners? | Per-request usage review without fixed cost claims. |
| Sustainability | Is unnecessary reprocessing or oversized context identified? | Versioned ingestion and context-budget review. |
Use the sheet as a decision record, not a compliance badge. The Agentic AI Lens adapts the six pillars for systems that can reason, invoke tools, and maintain state; a static RAG workload can use the same questions before autonomy is added. A failed row should produce a bounded repair owner and a retest, not a generic request to “improve the model.”
Review the sheet at a real change boundary: adding a new source class, expanding an audience, changing a retrieval filter, or allowing an agent to decide whether to retrieve. Mark whether the change affects a single pillar or creates a trade-off, such as a richer context path that changes operational traceability and performance work together. The review result should name the evidence that will be re-collected after release.
Glossary: terms first introduced here
These are the technical terms introduced in this step. Later modules build on them rather than redefining them from scratch.
New vocabulary for this step
| Term | Plain-language meaning | Why it matters here |
|---|---|---|
| RAG (retrieval-augmented generation) | A pattern that retrieves permitted source material before asking a language model to draft an answer from that evidence. | It makes current organisational knowledge available without treating a model as the system of record. |
| Corpus | The governed collection of documents, records, or other source material a retrieval system is allowed to search. | A RAG answer can be no more trustworthy than the corpus, its permissions, and its freshness. |
| Retrieval | The step that selects candidate evidence for a question before generation. | Inspecting retrieval separately is how a team distinguishes a missing source from a model-writing failure. |
| Citation | A user-visible pointer to the source and location that an answer relies on. | A citation lets a person inspect evidence; its presence alone does not prove the claim is supported. |
Knowledge Check
Test your understanding with this quiz. You need to answer all questions correctly to mark this section as complete.