What is RAG (retrieval-augmented generation), in plain English?

By José Antonio Mijares | 2026-11-27 | 6 min read

RAG, retrieval-augmented generation, makes an AI model look things up in your own documents before it answers, so it quotes your facts instead of guessing. How it works, when you need it, and where it goes wrong.

RAG (retrieval-augmented generation) makes an AI model look things up before it answers. When someone asks a question, the system first searches your own documents for the relevant passages, then hands those passages to the model and asks it to answer from them. The model quotes your return policy instead of guessing one.

Why it exists

A language model only knows what was in its training data, up to a cutoff date. It has never seen your price list, your contracts or last week's policy change. Ask it anyway and it will often produce a confident, plausible and wrong answer, what people call a hallucination.

There are two ways to give a model your knowledge:

RAG Fine-tuning
What it does Looks up your documents at question time Trains the model further on your examples
Good for Facts that change: prices, policies, stock, docs A tone, a format, a narrow skill
Update it by Editing the document Training again
Shows its source Yes, it can link the passage No
Typical cost to start Low Higher

For most businesses, the question is "what does our policy say?", not "write like us". That's RAG.

The name comes from a 2020 paper by researchers at Facebook AI Research, University College London and New York University, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, presented at NeurIPS 2020 (arXiv 2005.11401).

How it works

A flow plate titled "Look it up, then answer." Five steps: a question from a customer; search your own documents; pick the best passages, three to ten; the model answers using only those, highlighted; show the source with a link to check. Source: Lewis et al., NeurIPS 2020, and JAMAK, November 2026.
Search first, write second.
  1. Prepare the documents. Your help articles, PDFs and policies are split into short passages, and each passage is turned into an embedding: numbers that capture its meaning. They go into a search index, often a vector database.
  2. Search at question time. The customer's question is turned into an embedding too, and the index returns the passages closest in meaning, even if they use different words ("send it back" finds "returns").
  3. Answer from the passages. The model gets the question plus those passages, with an instruction like "answer only from these; say so if the answer isn't here".
  4. Show the source. A good RAG system links the passage it used, so a person can check.
A sequence diagram titled "The model only sees what search found." A customer asks your app "Can I return this?". The app searches your documents for the returns policy and gets the top three passages back. It sends the question plus passages to the model, which answers from the passages, and the app returns the answer with a link to the policy.
If search finds the wrong page, the model answers from the wrong page.

Where RAG goes wrong

The model can only be as right as what search found. Most RAG failures are search failures:

  • Old or duplicate documents. If last year's price list is still in the index, it gets quoted. Clean the source before you build.
  • Passages cut in the wrong place. A table split in half, or a policy separated from its exceptions, gives the model half a fact.
  • No "I don't know". Without an instruction to admit gaps, the model fills them. Tell it to say when the documents don't cover a question, and test that it does.
  • Private data in the index. Whatever you index, the chatbot can repeat. Keep payroll out of the help-desk bot.
The R01 titanium rabbit holds a blank ivory card with a thin cyan thread running back to the open drawer of a graphite card cabinet it came from.
Every answer tied to where it came from.

Do you need it?

Use RAG when people ask questions your documents already answer and the answers change: support, internal policies, product specs, onboarding. It's how most "chat with our docs" and customer-support chatbots are built.

You don't need it to draft emails or brainstorm, and you may not need to build it at all: ChatGPT, Claude and Gemini let you attach files or connect a knowledge base, which is RAG under the hood. Build your own when you need it on your website, inside your product, or with permissions per user. An agent can also use RAG as one of its tools, often connected through MCP.

Frequently Asked Questions

Q: What does RAG stand for?

Retrieval-augmented generation. "Retrieval" is the search step that finds relevant passages in your documents; "generation" is the language model writing the answer from them.

Q: What is the difference between RAG and fine-tuning?

RAG looks up your documents every time someone asks, so updating it means editing a document. Fine-tuning trains the model further on examples, which suits a tone or format but needs retraining to change facts. For facts that change, use RAG.

Q: Does RAG stop AI hallucinations?

It reduces them, it doesn't end them. The model can still misread a passage, and if search returns the wrong document, the answer will be wrong too. Show sources, keep the documents clean, and instruct the model to say when it doesn't know.

Q: Do I need a vector database for RAG?

Not always. Small document sets can work with ordinary keyword search or the file features in ChatGPT, Claude or Gemini. Vector databases help when you have many documents and people phrase questions in different words from the text.

Q: Who invented RAG?

The term comes from a 2020 paper by researchers at Facebook AI Research, University College London and New York University, presented at NeurIPS 2020. The idea of feeding search results to a model is now standard across AI products.

Key Takeaways

  • RAG means look it up, then answer: search your documents first, then let the model write from what it found
  • It's for facts that change: prices, policies, specs, support answers
  • Update it by editing documents: no retraining needed, unlike fine-tuning
  • Search quality is answer quality: old, duplicate or badly split documents produce wrong answers
  • Always show the source: a link to the passage lets people check

Want a chatbot that answers from your real documents, with sources? See how we build AI agents or talk to us.