What is RAG? Website search with a source you can check
Retrieval-augmented generation (RAG) lets a search system look up relevant text before drafting an answer. A delivery question shows why the exact passage matters.
The AI first searches a website’s texts for relevant sections.
Only then is a short answer written – based solely on these sections.
This way, every answer can be checked against a source.
What the three letters mean
RAG stands for ‘Retrieval-Augmented Generation’. In plain terms, this means generating text after looking things up. That sounds complicated, but it describes something very ordinary. A good telephone help desk works the same way: first the manual is checked, then the answer is given.
The exam comparison
Without RAG, a language model – the AI program that writes the text – is like a student sitting an exam without any notes. The model answers from memory. Sometimes that is right, sometimes it only sounds convincing. A language model with RAG, by contrast, sits an open-book exam. It may look things up – and has to stick to what the book says.
Step 1: preparing the texts
First, all public pages of a website are read. Long pages are split into smaller sections, for example along the headings. For each section, a kind of fingerprint of its meaning is calculated. Experts call this an ‘embedding’. Similar content receives similar fingerprints.
Step 2: looking up
When a question comes in, the question also receives such a fingerprint. Then the system looks for the sections whose fingerprints match best. This way, the search also finds sections that use different words from the question. A second program then sorts the results again, more precisely.
Step 3: answering
Only now does the language model come into play. It receives the question and the sections found. Its task is to answer the question briefly, using only these sections. At the end, the sections are shown as sources. If no section fits well enough, there is no answer, just an honest notice.
Why this is better
- Up to date: if a page changes, the answer also changes after the pages are next read.
- Verifiable: every answer comes with a visible source.
- Relevant: the answer is based on the website’s own texts, not on general knowledge from the internet.
- Honest: without a suitable section there is no answer, just a notice.