Lesson 1 of 7 Retrieval Augmented Generation

Selecting a RAG Architecture Pattern

This lesson explains how Retrieval Augmented Generation (RAG) gives a foundation model relevant information at query time, the patterns that exist, and how to select one for a use case.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the basic RAG pattern.
  • Identify advanced patterns such as hybrid search, reranking and agentic RAG.
  • Select a pattern from use-case signals.

Basic RAG

In the basic pattern, documents are chunked, embedded and stored in a vector index during ingestion. At query time, the question is embedded, the most similar chunks are retrieved, and the model generates an answer from a prompt containing the question and the chunks, usually with citations. RAG gives current, private and citable knowledge without retraining and reduces hallucination, because the model is instructed to answer from the provided context.

The following diagram shows the ingestion and query paths of basic RAG.

The two paths of basic RAG. During ingestion, documents are chunked, embedded and stored in a vector index. At query time, the question is embedded with the same model, the most similar chunks are retrieved, and the model answers from a prompt that contains the question and those chunks, with citations.
Both paths must use the same embedding model.

Advanced patterns

Hybrid search combines vector similarity with keyword (BM25) matching, which helps with product codes, names and rare terms. Reranking retrieves a larger candidate set and reorders it with a cross-encoder model for precision. Query reformulation rewrites vague questions or decomposes multi-part questions into sub-queries. Hierarchical (parent-child) retrieval matches small chunks and returns their larger parents. Metadata-filtered retrieval restricts results by attributes such as department or date.

GraphRAG builds a graph of entities and relationships (Bedrock Knowledge Bases with Amazon Neptune Analytics) so retrieval can follow connections for multi-hop questions. Structured data retrieval converts natural-language questions into SQL against a data warehouse such as Amazon Redshift, for questions answered by tables rather than documents. Agentic RAG lets an agent decide whether, where and how many times to retrieve, combining several knowledge sources and tools.

Match the pairs

Advanced RAG patterns

Exam skills 2.1.5

Match each advanced RAG pattern with the problem it solves.

Log in to try this activity Interactive activities are free with an account.

Selecting a pattern

The following table maps use-case signals to the pattern that fits.

Use-case signalPattern
General questions over a document setBasic RAG (managed knowledge base)
Exact codes, part numbers or names in questionsHybrid search
Correct document retrieved but ranked lowReranking
Questions with several partsQuery decomposition
Answers need surrounding section contextHierarchical chunking and retrieval
Questions about relationships across entitiesGraphRAG (Neptune Analytics)
Questions about numbers in tables of a warehouseStructured data retrieval (text to SQL)
Multi-source, multi-step information needsAgentic RAG

The following diagram matches three assistants, each answering a different kind of question, to a retrieval pattern for each.

Three assistants, three retrieval patterns. Questions about error code E-4471 need hybrid search with a product filter; questions about suppliers of parts with quality incidents need GraphRAG to follow relationships; and questions about Q3 returns by region need structured data retrieval against Redshift.
The scenario is illustrative.
Scenario questions

Choose the pattern

Exam skills 2.1.5

Choose the RAG pattern that suits each assistant.

Log in to try this activity Interactive activities are free with an account.
Worked example

Three assistants

A manufacturer plans three assistants.

AssistantPatternReason
Field technicians ask about error code E-4471Hybrid search with metadata filter by productExact code matching plus product scope
Analysts ask "which suppliers of parts used in model X had quality incidents?"GraphRAGMulti-hop relationships between parts, suppliers and incidents
Managers ask "what were Q3 returns by region?"Structured data retrieval on RedshiftAnswer lives in tables, not documents

Using basic vector RAG for all three would fail the second and third: embedding similarity cannot follow relationships or compute aggregates.

Check yourself

Which pattern suits multi-hop questions about relationships?

Show answer

GraphRAG with Amazon Neptune Analytics.

Exam Tips

Remember for the exam

  • RAG adds current, private knowledge with citations without retraining.
  • Exact identifiers: hybrid search.
  • Multi-hop relationship questions: GraphRAG with Neptune Analytics.
  • Answers in warehouse tables: structured data retrieval (text to SQL).
  • Agent decides when and where to retrieve: agentic RAG.