Retrieval Augmented Generation
Retrieval Augmented Generation (RAG) is the most widely used way to make generative AI answer from an organisation's own information. This lesson explains how it works, why it is valuable and what it depends on.
Learning outcomes
After completing this lesson, you will be able to:
- Explain the problem RAG solves and how it works.
- Describe the benefits of RAG and what its quality depends on.
- Identify when Amazon Bedrock Knowledge Bases fits a business need.
- Define chunks, embeddings, vector indexes, grounding and citations.
- Identify the common causes of poor RAG answers.
- Describe how retrieval relevance and faithfulness are measured.
The problem RAG solves
A foundation model knows only its training data, which has a cut-off date and excludes private company information such as policies, product manuals, contracts and case histories. Asking it about these topics invites hallucination. Retraining the model whenever the information changes would be slow and expensive. Retrieval Augmented Generation (RAG) solves this by giving the model the right information at the moment it answers.
How RAG works
A RAG system works in two phases. The following steps describe the flow in business terms.
-
Prepare the knowledge
Company documents are split into passages and converted into numerical representations (embeddings) that capture their meaning, then stored in a searchable index, often a vector database.
-
Retrieve
When a user asks a question, the system searches the index for the passages most relevant to the question's meaning.
-
Augment
The retrieved passages are added to the prompt, with an instruction to answer only from them.
-
Generate
The model writes an answer grounded in the passages and can cite the sources it used.
On AWS, Amazon Bedrock Knowledge Bases provides managed RAG: it connects to data sources, handles the splitting, embedding and storage, retrieves relevant passages and returns answers with citations, so organisations do not need to build each step themselves.
The following diagram shows the two phases of a RAG system.

How a RAG answer is produced
Key RAG terms
Discussions of RAG with technical teams use a small set of terms. The following definitions explain them in business language.
- Chunk
- A passage of a document, such as a few paragraphs, that is stored and retrieved as a unit.
- Embedding
- A numerical representation of a chunk's meaning, so that passages about the same topic can be found even when they use different words.
- Vector index
- A searchable store of embeddings that finds the passages closest in meaning to a question.
- Grounding
- Basing an answer on supplied source content rather than on the model's general training.
- Citation
- A reference from the answer to the passage or document it relied on.
Benefits and dependencies
RAG keeps answers current, because updating a document updates future answers without retraining. It makes answers specific to the organisation and traceable through citations, which supports trust and audit. It reduces hallucination, although it does not eliminate it, and it can respect access permissions so that users only receive answers from documents they are entitled to see.
RAG is only as good as its content and retrieval. Outdated, duplicated or contradictory documents produce poor answers, and documents with sensitive information need access controls. Content ownership and quality management are therefore part of every RAG business case.
Where RAG goes wrong
RAG failures usually have recognisable causes. The following list describes the most common, which business owners can often identify from the symptoms.
- Retrieval misses: the relevant passage exists but is not retrieved, for example because the question uses different terms or the passage is buried in a long document.
- Poor chunking: tables, lists or clauses are split across chunks, so the model sees only part of the information.
- Outdated or conflicting content: old and new versions are both retrieved.
- Permission gaps: documents are retrievable by users who should not see them.
- Questions that need aggregation: "How many contracts expire this year?" requires counting across all contracts, which retrieving a few passages cannot do. Such questions need a query against structured data, which some services, including Amazon Bedrock Knowledge Bases, can generate from a natural language question.
Diagnose the assistant
Measuring RAG quality
RAG quality has two parts, and both must be measured: whether the right passages were retrieved, and whether the answer used them faithfully. The following table describes the main measures.
| Measure | Question it answers |
|---|---|
| Retrieval relevance | Did the system find the passages that contain the answer? |
| Faithfulness (groundedness) | Is every statement in the answer supported by the retrieved passages? |
| Answer relevance | Does the answer address the question that was asked? |
| Citation accuracy | Do the citations point to the passages that support the statements? |
These measures are assessed on a test set of real questions with known answers, and some can be checked in production. Amazon Bedrock Guardrails, for example, includes a contextual grounding check that can block responses not supported by the source content.
Which measure failed?
A product support assistant
A manufacturer of industrial pumps wants an assistant that field engineers can ask about installation and troubleshooting. Manuals are updated monthly, and engineers need to verify answers against the source because mistakes could cause equipment damage. Which approach fits?
RAG fits all the requirements. Monthly updates are absorbed by refreshing the knowledge base rather than retraining a model, and citations let engineers check each answer against the manual page. Amazon Bedrock Knowledge Bases could provide this as a managed service. The business case should include an owner for manual content, a process to remove superseded versions, and an instruction for the assistant to say when the manuals do not contain an answer.
An HR assistant that reveals too much
A company connects a RAG assistant to its entire HR document store so that employees can ask about policies. During testing, a junior employee asks about pay ranges and receives an answer that quotes the salaries of named senior managers from a spreadsheet stored in the same location. What went wrong, and what should change before launch?
The assistant retrieved content from a document the employee should never have been able to see. The problem is not the model but the knowledge source and its permissions. Before launch, the company should limit the knowledge base to the content intended for the purpose, such as approved policy documents, use permission-aware retrieval so that each user receives answers only from documents they are entitled to read, and review the HR store's access settings, which had been loose without anyone noticing. Testing with questions designed to find sensitive content should be part of acceptance.
A RAG assistant's answers become outdated. Does the model need retraining?
Show answer
No. RAG answers come from the retrieved content, so updating or replacing the outdated documents in the knowledge base fixes the answers.
Exam Tips
Remember for the exam
- RAG retrieves relevant company content at query time and adds it to the prompt.
- RAG keeps answers current without retraining and supports citations.
- Amazon Bedrock Knowledge Bases provides managed RAG.
- RAG quality depends on content quality and on access controls for sensitive documents.
- Measure both retrieval relevance and faithfulness of the answer to the retrieved passages.
- Questions that count or aggregate across many records need structured queries, not passage retrieval.
- Permission-aware retrieval stops an assistant from exposing documents a user may not see.