Skip to content
Back to the blog
Engineering Published 23.11.2026 3 min read

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.

In brief
RAG means looking things up first, then answering.
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.

The three steps of RAG
1. Preparing
reading the website’s texts and splitting them into sections
2. Looking up
finding the relevant sections for a question
3. Answering
writing a short answer using only these sections
Looking things up happens before writing – that is the whole trick.

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.

Illustration: an open book from which three highlighted sections lead into a speech bubble
Looking up first, then answering: the highlighted sections form the basis of the answer.

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.
Worth knowing
Even with RAG, an AI answer can occasionally be off, for example when a section is worded ambiguously. That is why the sources matter so much: with a single click, every answer can be checked against the original.
Try two questions about the same source
A fictional shipping page says that orders placed by noon on Thursday arrive on Friday. Ask when a Thursday morning order arrives. The answer should cite Friday and link to the cutoff. Now ask about Saturday delivery. The text gives no Saturday schedule, so a promise would be unsupported. Open the cited passage and mark the test as failed if it says less than the answer.