CHAPTER 05 · GENERATIVE AI

What is RAG, and why does AI read documents?

RAG means the system looks up relevant information before answering and adds it to the context.

What is it?

RAG (retrieval-augmented generation) means the system looks up relevant documents before answering and adds them to the model’s context. The model then answers from the sources it found, not only from memory. That allows fresh information and cited sources.

An everyday example

You ask about a company policy. The system finds the relevant clause, the model explains it and adds a link to the source.

Why does it matter?

RAG reduces made-up answers and lets internal or up-to-date information be used without retraining the model.

A common misconception

That an answer with a source is automatically correct. The document found can be wrong, outdated or even malicious, and the model can summarise it badly.

In more detail

How does it work?

The system finds passages in a database or in documents, and the model then writes an answer based on them.

Does the model learn something new in the process?

Not necessarily. It receives the outside material while in use; its parameters can stay the same.

Does RAG stop made-up answers?

Not entirely. It can make answers easier to trace, if the documents are good and are correctly selected and used.

What is vector search?

A method that represents content as lists of numbers (vectors) and finds items that are similar in meaning.

Remember: A retrieved document can be wrong, out of date or malicious.

Reliable sources

Last reviewed 1 November 2026. An explainer, not professional, legal or medical advice. For rules and figures that change, check the official version.