RAG

Learn about retrieval-augmented generation (RAG) and Bedrock Knowledge Bases.

Retrieval-augmented generation (RAG) is a model that combines a retrieval component with a generative model. This means that when an RAG model is prompted to generate text or answer a question, it first retrieves relevant information from a vast database. It then uses this information to provide responses that are created by using specific, real-world data rather than relying solely on pretrained knowledge.

This dynamic approach allows RAG models to produce more accurate, timely, and contextually appropriate outputs, significantly reducing the occurrence of errors and hallucinations that are typical of traditional models.

Press + to interact
How RAG works
How RAG works

There are two main phases of RAG:

  • Retrieval phase: The retrieval model searches an indexed database or knowledge base to find documents relevant to a user’s query. Services like Amazon Kendra, designed for natural language processing, can be used for efficient, context-aware document retrieval.

  • Generation phase: The retrieved information is passed to a generative model, which uses this information to generate a tailored, contextually informed response. In ...