AWS Builder Center

What Is RAG? Retrieval-Augmented Generation Explained Simply

A simple explanation of RAG, the technique that lets AI models answer using your own documents, written by a student preparing for the AWS AI Practitioner exam.

Every AI course I take mentions "RAG". The name sounds complicated, but the idea is simple. Here is how I understand it.

The problem

A language model only knows what it learned during training. It doesn't know your company documents, and it can sound confident while being wrong.

The idea: an open-book exam

Imagine two students taking the same test. One answers from memory. The other is allowed to look things up in the textbook first. RAG gives the AI the second option.

How it works (3 steps)

  • Retrieve: the system searches your documents for the pieces most related to the question
  • Augment: those pieces are added to the prompt
  • Generate: the model writes an answer using that information

Why it matters

  • Answers can use up-to-date or private information
  • You don't have to retrain the model
  • It can reduce made-up answers, because the model has real text to rely on

Where AWS fits

Amazon Bedrock has a feature called Knowledge Bases that helps you connect a model to your own data. I haven't built one yet, so I'm learning the concept first.
Features change often, so check the official docs:  https://aws.amazon.com/what-is/retrieval-augmented-generation/ 
Have you tried RAG? What was harder than expected: preparing the documents or getting good answers?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article