Search⌘ K
AI Features

Retrieval-Augmented Generation (RAG) and Knowledge Bases

Explore how Retrieval-Augmented Generation (RAG) resolves generative AI hallucination by integrating external knowledge sources at inference time. This lesson covers Amazon Bedrock Knowledge Bases, a managed RAG service that automates document ingestion, chunking, embedding, and retrieval. Understand the trade-offs between using Bedrock’s managed approach and building a custom RAG architecture with services like AWS Lambda and Amazon OpenSearch. Gain insights into architectural decisions vital for deploying grounded, accurate machine learning models in production on AWS.

Foundation models generate text based on patterns learned during training, but their training data has a cutoff date and rarely includes an organization's proprietary documents. When a user asks a domain-specific question, the model may confidently produce an answer that sounds plausible but is factually wrong. This failure mode is known as hallucination. Retrieval-augmented generation (RAG) addresses this problem by fetching relevant context from an external knowledge source and injecting it into the model's prompt at inference time. Rather than relying solely on the model's parametric memory, RAG grounds each response in authoritative, up-to-date data. Amazon Bedrock is AWS's fully managed service for deploying foundation models, and Amazon Bedrock Knowledge BasesA managed RAG feature within Amazon Bedrock that automates document ingestion, chunking, embedding, and retrieval so developers can build grounded generative AI applications without custom pipeline code. is the managed RAG solution in this ecosystem. The exam frequently presents scenarios that require candidates to choose between managed RAG with Bedrock Knowledge Bases and a custom RAG architecture that orchestrates multiple services, such as using AWS Lambda for document chunking, Amazon OpenSearch for vector storage and retrieval, and direct API calls for model inference. Understanding the trade-offs between these two paths is essential for both the deployment ...