AI Systems Research guide

What is RAG? When AI looks up a source before it answers

A fluent AI answer can still be unsourced. RAG is the method that has to show the page it used.

Night archive aisle, a gloved hand lifting one folder from an open box under a work lamp, identical boxes receding into the dark
Fetch the named passage. Then generate.

You asked an AI chatbot a question about your company. It answered in clean English. You still cannot tell whether it used last year’s handbook, this year’s, or a paragraph it invented that merely sounded like a handbook.

That is the job RAG is supposed to do.

RAG is a method in artificial intelligence. The letters mean retrieval-augmented generation. In order: the system finds a specific passage in a collection you gave it, then it writes the answer from that passage. Retrieval is the product. The sentence is the last mile. If you cannot open the source behind the sentence, you do not have RAG. You have a chat window with extra text pasted in.

What a language model actually does

A language model is the engine behind tools such as ChatGPT. It was trained on a huge pile of public text. It is good at sounding right. It does not have a live copy of your supplier contract, your HR handbook, or last Tuesday’s incident report unless you give it one.

When the model has no source, it still answers. Fluency is cheap. A confident number about notice periods, refunds, or who may sign, written from general internet folklore, is still a guess.

Pasting a PDF into the chat once is not a system. The window fills up. Tomorrow’s question starts from zero. Nobody can later point at which paragraph was used.

Look it up, then write

Picture a warehouse of identical boxes. RAG is the person who pulls one folder, puts it under the lamp, and only then writes. The product is that folder, not the sentence.

In software terms the collection is usually cut into short passages, sometimes called chunks. A chunk is just a piece of a larger file: a clause, a section, a paragraph. The AI has to fetch one you can name, then generate.

Walk a question that actually costs money.

Someone asks: how many days of notice do we need to cancel the supplier contract?

Without retrieval, the model produces a number that sounds like contract law. It may even be a common number. It is still not your clause.

With RAG, the system searches the signed contracts you indexed, finds clause 12.3, and the answer names that clause. You can open the file. If the file is last year’s draft, you will see that too.

The same test holds for a holiday policy, a refund rule, a safety instruction, or a product spec. You can check the sentence against a file. That is the whole advantage.

If you do not build AI for a living

You do not need to buy new software to use this definition. The next time a tool answers from “our docs,” ask to see the paragraph. If nobody can show it, the letters on the slide are decoration. Treat the chatbot as a drafting aid. Keep it off anything that has to match a signed file.

What you were sold

Vendors put RAG on a slide and mean “we connected a search index to a chatbot.” A search index is a filing cabinet. Useful, and not a finished system.

Embeddings, vector stores, and similar parts are furniture in that cabinet. They help the system find candidates. They do not prove that the sentence on screen came from the passage you would accept in a dispute.

The system starts when someone can name the passage. Until then you shipped generation with extras.

The five-line test

Take one bad answer from last week. Fill these lines. Use ordinary language.

  1. Which passage was gathered?
  2. Why did this one rank for this question, and not the older version?
  3. What was assembled around it before the model wrote?
  4. Did anyone inspect a miss, or only the demo that worked?
  5. What would you look up next, or would you refuse to answer?

If those lines are blank, stop arguing about chunk size. You shipped a fluent guess.

GRAIN is the same loop with names: Gather, Rank, Assemble, Inspect, Navigate. RAG names the architecture. GRAIN names the honesty check. This page is the definition. It is not the nine-move expansion.

Evaluate the reasoning, not the fluency is the adjacent test when the sentence is tidy and the source is not.

Demand the passage

The RAG Engineer owns the longer practice. It is available now in English and Dutch paperback, hardcover, and Kindle. You do not need the hardcover to demand the folder under the lamp.

If the team cannot open the passage behind the sentence, do not call it RAG. Call it a prompt with extras. Then take the extras out of any decision that has to survive a dispute.

Terminology

Sources

  1. RAG (glossary)
  2. GRAIN (glossary)
  3. Evaluate the reasoning, not the fluency
  4. The RAG Engineer

Further reading

Markdown for LLMs