RAG in plain English: how AI looks things up before it answers
Retrieval-augmented generation is the most common way to connect AI to an organization’s own documents. How it works, why it reduces made-up answers, and where it still goes wrong.
Priya Natarajan
3 min read

If you have used a chatbot that answers questions about a company’s help center, searches your files or cites the web pages it used, you have probably used retrieval-augmented generation, or RAG. It is the most common technique for connecting AI models to information they were not trained on, and once you understand how it works, you will understand a lot about why these systems succeed and fail.
The problem RAG solves
A language model knows only what was in its training data, and that knowledge stops at a cutoff date. It has never seen your internal policies, last week’s sales figures or the manual for the product you launched yesterday. Retraining the model every time something changes would be slow and expensive. RAG offers a shortcut: instead of teaching the model new facts, you look them up and hand them over at the moment of the question.
The approach was named in a 2020 paper led by researchers at Facebook AI Research, and it has since become a standard pattern.
How it works, step by step
- Prepare the documents. Your source material is split into chunks, often a few paragraphs each.
- Turn chunks into embeddings. Each chunk is converted into an embedding, a list of numbers that captures its meaning. Chunks about similar topics end up with similar numbers, even if they use different words.
- Store them in an index. The embeddings go into a database built to find similar vectors quickly.
- Search at question time. When someone asks a question, the question is turned into an embedding too, and the system retrieves the chunks closest to it in meaning.
- Answer with the evidence. The retrieved chunks are placed in the model’s prompt along with the question and an instruction such as “answer using only the sources below, and cite them.”
The model is still doing what it always does, predicting text, but now it is predicting from relevant evidence sitting right in front of it rather than from hazy memory.
Why it helps
- Fewer made-up answers. Grounding a model in real documents substantially reduces hallucination, especially for specific facts.
- Fresh information. Update the documents and the answers update with them. No retraining required.
- Citations. Because the system knows which chunks it used, it can show you where an answer came from, so you can check it.
- Access control. A well-built system retrieves only the documents the person asking is allowed to see.
Where it goes wrong
Most RAG failures are search failures. If the right passage is never retrieved, the model cannot use it, and it may fill the gap with a plausible guess. Common culprits include:
- Bad chunking. Splitting a document in the wrong place can separate a question from its answer, or a table from its headings.
- Meaning-only search. Embedding search is good at concepts but can miss exact terms like product codes or names. Many systems combine it with old-fashioned keyword search, an approach called hybrid search.
- Too much or too little context. Retrieve too few chunks and the answer is incomplete. Retrieve too many and the important one gets lost among the rest.
- Untrusted content. If retrieved documents contain hidden instructions, a model may follow them. This attack, called prompt injection, is a real security concern for systems that read web pages or emails.
Does long context make RAG obsolete?
As context windows have grown to hundreds of thousands of tokens and beyond, some have predicted the end of RAG. Why search when you can paste in everything? For a single long document, that often works well. But most organizations have far more text than any context window can hold, and paying to process all of it for every question is slow and expensive. In practice the two approaches complement each other: retrieval finds the relevant material, and a long context window lets the model consider more of it at once.
Questions to ask about any RAG system
- Does it show its sources, and do the sources actually support the answer?
- What happens when it cannot find anything relevant? A good system says so.
- How fresh is the index, and how quickly do changes appear?
- Has anyone measured how often it retrieves the right material, not just how fluent the answers sound?
RAG is not glamorous, but it is often the difference between an AI that sounds knowledgeable and one that can show its work.


