Retrieval & grounding

What Is RAG?

The single most common pattern in production AI applications, explained from first principles.

Vijay Gurunathan·7 min read·Updated 2026

Retrieval-Augmented Generation, or RAG, is a technique that finds relevant information from a knowledge source and feeds it to a language model before it answers, instead of relying purely on what the model memorized during training.

RAG is popular because it directly fixes two of the biggest LLM weaknesses: outdated knowledge and hallucination on specific facts, by grounding the model in real, current, and often private data.

Key takeaways

RAG retrieves relevant information first, then generates an answer grounded in that information.
It solves outdated knowledge and reduces hallucination by anchoring answers in real source data.
A basic RAG pipeline has three parts: embedding, retrieval, and generation.
RAG is usually the first architecture to reach for before considering fine-tuning or complex agents.

The problem RAG solves

An LLM only knows what it learned during training, up to a fixed cutoff date, and it has no access to your private documents, databases, or recent events by default. Asked about something outside that knowledge, it will often guess — sometimes confidently and incorrectly.

RAG solves this by fetching relevant, current information at the moment of the question and handing it to the model as context, so the model answers from real material instead of memory alone.

How a basic RAG pipeline works

Documents are broken into chunks and converted into embeddings — numerical representations of meaning — and stored in a vector database. When a question arrives, it is also embedded and compared against stored chunks to find the most relevant ones.

Those relevant chunks are inserted into the prompt alongside the question, and the model generates an answer using that supplied context rather than guessing from training data alone.

Where RAG shines, and where it does not

RAG is excellent for question-answering over documents, support knowledge bases, internal wikis, and any scenario where facts change or are private. It is a poor fit for tasks that need a specific writing style, tone, or format baked deeply into the model — that is closer to a fine-tuning problem.

Most production teams reach for RAG first because it is faster to build, easier to update, and more transparent than training a custom model.

Put this into practice

Build this skill inside a mentor-led AI Engineering program.

Explore the AI Engineering course

Frequently asked

Common questions on this topic.

No. RAG supplies relevant information at request time without changing the model itself; fine-tuning permanently adjusts the model’s internal weights on new training examples.

Foundations

Related articles.

Back to the RAG guide