AWS Builder Center
What Is RAG?

What Is RAG?

Retrieval, embeddings, vector databases, and generation explained simply

What problem does RAG solve?
A large language model, or LLM, generates text from patterns learned during training. Its knowledge may be outdated, and it does not automatically know private or specialized information. It can also produce confident answers that are not supported by facts. RAG helps by giving the model relevant information from an approved source before it answers.
What is RAG?
RAG stands for Retrieval-Augmented Generation. The system first retrieves information related to the user’s question. It then augments, or expands, the prompt with that information. Finally, the LLM generates a response using the question, instructions, and retrieved context. RAG adds knowledge at request time without retraining the model.
The two parts of a RAG system
Indexing - Content is prepared before users ask questions. Documents are loaded, split, converted into embeddings, and stored in a searchable index.
Querying - When a question arrives, the system retrieves the best matching content and sends it to the LLM as part of the prompt.
Chunks, embeddings, and vector stores
Chunks - Long documents are divided into smaller, focused sections. A chunk should keep enough surrounding information to remain meaningful.
Embeddings - An embedding model converts text into a vector, which is a list of numbers representing meaning. Related text produces vectors that are mathematically close.
Vector store - A vector store keeps the vectors with their original text and metadata. It finds similar vectors through semantic or similarity search.
How data is prepared
Load - Read content from the selected data sources.
Split - Divide the content into chunks, sometimes with overlap between neighboring chunks.
Embed - Convert every chunk into a vector using an embedding model.
Store - Save and index the vector, original text, and metadata in the vector store. Updated content must be synchronized with the index.
What happens when a question arrives
Retrieve - Convert the question into a vector and find the closest chunks. Metadata filters and reranking can improve the result order.
Augment - Place the retrieved chunks into the prompt with the question and instructions. This extra information becomes the context.
Generate - Send the completed prompt to the LLM. The model writes the response and can return citations connected to the source content.
Building the same flow with Amazon Bedrock
Amazon Bedrock Knowledge Bases can connect to supported data sources, parse and chunk content, create embeddings, and use a supported vector store. At query time, it retrieves relevant content and passes the context to a foundation model in Amazon Bedrock. The application can use retrieval only or combine retrieval and generation in one managed flow.
RAG architectures you can build on AWS
Standard RAG - Runs one retrieval step and gives the matching context to the model. Bedrock Knowledge Bases provides the managed foundation for this pattern.
Agentic RAG - Lets an agent decide what to retrieve, which tools to call, and whether another search is needed. Use Bedrock Agents, AgentCore, or agentic retrieval.
RAG with Memory - Combines retrieved knowledge with conversation history or stored context. Memory can be managed separately through Bedrock Agents or AgentCore Memory.
Self-RAG - Checks whether retrieval and the generated response are good enough, then retries when necessary. Build the review loop with Bedrock Agents, Flows, or Lambda.
Adaptive RAG - Chooses a light or deeper retrieval strategy according to the question. Agentic retrieval or custom Bedrock routing can control the path.
Corrective RAG - Detects weak retrieval, filters or reranks the results, and searches again when needed. Bedrock reranking can support the correction step.
Attention-based RAG - Prioritizes the strongest parts of a large retrieved context. On AWS, combine careful chunking, reranking, context ordering, and model selection.
HybridAI RAG - Combines vector retrieval with graphs, rules, or structured reasoning. Bedrock Knowledge Bases with Neptune Analytics provides an AWS GraphRAG path.
Cost-Constrained RAG - Adjusts retrieval depth, model choice, caching, and retries to meet cost or latency limits. This is a custom operating strategy on AWS.
XAI RAG - Makes answers easier to verify with sources and retrieval details. Bedrock Knowledge Bases can return citations, while traces support monitoring and review.
When RAG is the right choice
RAG is useful when answers must rely on information outside the model’s training data, when that information changes regularly, when retraining would be unnecessary, or when the response should point back to its sources. It is mainly a way to supply knowledge, not a way to change the model’s writing style or behavior.
What RAG does not solve
RAG improves grounding but does not guarantee correctness. Its quality depends on the source data, chunking, embeddings, retrieval settings, prompt, and model. Testing should check both whether the right content was retrieved and whether the model used it accurately. Security and access controls must also apply during retrieval.
Final takeaway
RAG is a connected process: prepare the knowledge source, retrieve the most relevant context, add it to the prompt, and generate the response. Embeddings and a vector store support retrieval; the LLM handles generation. Amazon Bedrock Knowledge Bases can manage these parts as an AWS-native RAG workflow.
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