Home / Glossary / AI and machine learning

AI and machine learning

Retrieval-augmented generation (RAG)

Also searched as: RAG, retrieval augmented generation

In shortRetrieval-augmented generation, or RAG, is a method where an AI system first retrieves relevant passages from a set of documents or the web, then gives them to a language model to write the answer. It lets the model use current or private information it was not trained on, and it often allows the answer to cite its sources.

By Aditya Aman, working in SEO for almost a decade and hands-on with AEO and GEO as those fields have developed. Updated 25 November 2026.

  • What it isRetrieve passages first, then generate an answer from them.
  • Why it existsModels have a training cutoff and no access to private data.
  • Key partsRetriever, optional reranker, language model.
  • Seen inAI search tools, support bots, internal assistants.
  • Common mistakeAssuming RAG removes errors completely.

What is retrieval-augmented generation?

A language model alone answers from what it learned in training. RAG adds a lookup step. When a question comes in, the system searches a collection, such as web pages or a company knowledge base, picks the most relevant passages and puts them in the model's prompt. The model then writes an answer using that material.

This is how many AI search tools can reflect recent pages and show source links. It is also how a business can build an assistant that answers from its own documents.

How does a RAG system work?

The parts vary by product, but the flow is similar. The collection is split into chunks, which are indexed with embeddings, keywords or both. A query retrieves candidates, a reranker may reorder them, and the language model writes the reply.

  1. Prepare the contentDocuments are cleaned and split into passages.
  2. Index the passagesPassages are stored with embeddings, keyword indexes or both.
  3. Retrieve for the queryThe system finds the closest passages to the question.
  4. Rerank if usedA second model reorders the shortlist.
  5. Generate the answerThe language model writes a reply from the chosen passages and may cite them.

Why does RAG matter for search visibility?

For AI search tools that retrieve live pages, your content has to survive each stage: be crawlable, be retrieved for the question and read as a good passage. A page that is blocked, slow to load or vague may never reach the model.

Nobody can guarantee a citation. Systems differ and results vary by prompt, person and day. What you can do is make pages accessible and specific, with passages that stand on their own.

StageWhat can go wrongWhat helps
Crawl and accessPage blocked or hard to renderOpen access, server-rendered text
RetrievalWording far from the questionNatural terms and clear topic
Passage qualityPadded or vague textDirect answers, specific facts
GenerationModel misreads or adds claimsUnambiguous statements, consistent facts

What are common RAG mistakes?

Building an internal assistant, teams often index messy, outdated documents and then blame the model for wrong answers. The retrieval is only as good as the source material. Another mistake is skipping evaluation: test with real questions and check answers against the source.

Also remember that a cited source does not prove the answer is right. Models can misread a passage. Spot-check citations, especially for numbers and claims about your company.

Need help with Retrieval-augmented generation on your site?

Tell us what is not working. We will check where this affects your search results and what to fix first.

Book a meetingAEO services

Questions people ask

Does RAG stop hallucinations?

It reduces them in many cases because the model has source text to work from, but it does not remove them. The model can still misread or add details. Check answers against the cited source.

Is RAG the same as fine-tuning?

No. RAG supplies relevant text at answer time. Fine-tuning changes the model itself through extra training. RAG is usually easier to update, since you change the documents, not the model.

How can I make my content easier for RAG systems to use?

Keep pages crawlable and render key text in the page itself. Use clear headings, put the direct answer near the start of each section and keep facts consistent. This helps readers too, and no outcome is guaranteed.

Inspect the original evidence