Retrieval-augmented generation (RAG) is a way of making an AI answer from documents it looks up at the moment you ask. Anthropic describes it as a method that retrieves relevant information from a knowledge base and appends it to the user’s prompt. Many AI search tools work this way. For a website, it means one thing: the passage the system pulls from your page has to be clear, current and true on its own.
What is RAG? #
A large language model on its own only knows its training data, up to its knowledge cutoff. RAG adds a lookup step. Before the model writes, a retriever finds passages that match the question and places them in the model’s context window. The model then writes its answer from those passages. When the passages come from the live web, this is a form of grounding: tying an answer to sources it can name.
Where did the idea come from? #
The name comes from a research paper by Patrick Lewis and colleagues, submitted on 22 May 2020. It describes models that combine “parametric” memory (what the model learned) with “non-parametric” memory: a dense vector index of Wikipedia, read by a neural retriever. That second memory can be updated without retraining the model. The same idea now sits behind AI search, help-desk chatbots and many shop assistants.
Why does it matter for search? #
Google says its AI Overviews and AI Mode may use query fan-out: several related searches across subtopics, to find a wider set of supporting links. Your page is only a candidate if it is indexed and eligible to be shown with a snippet. Google says there are no extra requirements and no special optimisation for this. So normal technical SEO is the entry ticket: a page that cannot be crawled or indexed cannot be retrieved.
Why does it matter for AI answers? #
RAG is the moment an AI system reads you. A model cannot quote a page its retriever never found, and it cannot quote a fact the passage does not contain. That is why AI visibility depends on plain, self-contained passages. A clear passage is easier to retrieve, easier to quote and easier to give a citation for. A vague or contradicting one raises the risk of an AI hallucination about your business.
How does it work, step by step? #
- Collect. A crawler reads pages. For AI search this is a search crawler such as OAI-SearchBot or PerplexityBot.
- Chunk. Documents are split into chunks, which Anthropic says are usually no more than a few hundred tokens. See AI tokens.
- Index. Each chunk is turned into embeddings for vector search, and often also indexed for exact word matches with BM25.
- Retrieve. The question is matched against the index. Anthropic says embeddings capture meaning well but can miss exact matches, which BM25 finds. This is semantic search plus keyword search.
- Rerank and write. The best chunks are put in the prompt, and the model writes the answer.
Live fetching: RAG at question time #
Some systems fetch a page only when a person asks. OpenAI says ChatGPT-User visits pages when a user asks ChatGPT a question and does not crawl the web automatically. Anthropic says Claude-User fetches pages when a Claude user asks a question that needs it. These are live fetchers, such as ChatGPT-User. They show in your server logs, never in browser analytics.
A worked example #
A bike shop’s help page says: “We are open 10am to 4pm on Sundays.” An old news post on the same site says: “We are now closed on Sundays.” Someone asks an AI search tool whether the shop opens on Sunday. The system retrieves both passages, adds them to the prompt, and the model has to choose. It may pick wrongly.
The fix is on the website, not in the AI: one current statement of opening hours, and the old post updated or marked with its date. Write passages that name their subject. “Our Sunday hours at the York shop are 10am to 4pm” still makes sense when it is lifted out alone. “We open at 10 then” does not.
Why do passages fail on their own? #
Anthropic’s own example shows it. The chunk “The company’s revenue grew by 3% over the previous quarter” does not say which company or which quarter. Its Contextual Retrieval method adds that missing context to each chunk before it is stored. In Anthropic’s tests, published on 19 September 2024, this cut the top-20 retrieval failure rate by 49% (from 5.7% to 2.9%), and by 67% (to 1.9%) when a reranking step was added.
| Passage on your page | Lifted out alone, does it still work? |
|---|---|
| “Delivery is free over £50 to UK addresses.” | Yes: subject, number and place are all there |
| “As mentioned above, it’s free over that.” | No: what is free, over what? |
| “Prices from £19 a month (checked November 2026).” | Yes, and the date tells the reader how fresh it is |
| “See the table for details.” | No: the table may not be retrieved with it |
Does a small site need RAG at all? #
Not always. Anthropic notes that if a knowledge base is smaller than 200,000 tokens (about 500 pages of material), you can put all of it in the prompt with no need for RAG. That matters if you run your own chatbot on a small site. For public AI search, you do not choose: the AI company’s system decides how it retrieves, so your job is to make each page easy to read and quote.
What are the common mistakes? #
- Facts only in PDFs, images or pop-ups, so there is no plain text passage to retrieve.
- Facts that appear only after JavaScript runs. Many crawlers do not run scripts. See JavaScript SEO.
- Passages that lean on the rest of the page, such as “see above” or “as mentioned”.
- Old pages that contradict new ones, left live with no date.
- Blocking the search crawler by accident. Blocking a training crawler and a search crawler are different choices. Read blocking AI crawlers first.
- Snippet controls set too tight. Google lists nosnippet, data-nosnippet, max-snippet and noindex as ways to limit what is shown from your pages, so they limit AI features too.
- Trusting retrieved text blindly in your own chatbot. Text from other sites can carry planted instructions: see prompt injection.
How to check it #
- Check the doors are open. The Robots.txt Checker tests your robots.txt, and the AI Bot Checker shows which AI search crawlers and training crawlers your rules let in. Remember Google-Extended: Google says it also covers grounding in Gemini, where Search index content is given to the model at prompt time.
- Check the page answers in plain text. Open view source and find the key facts in the HTML. The AI Readiness Checker scores what an AI system can read. The JavaScript SEO Checker will show what bots that do not run scripts miss.
- Preview your chunks. Our RAG chunk previewer shows how a page might be split into passages, so you can spot ones that fail alone.
- Check the headers and status. The HTTP Header Checker shows the status code and any X-Robots-Tag that blocks snippets or indexing. The Meta Tag Checker shows the title and the meta tags in the page head, where a robots tag would sit.
- Give machines a clean map. The llms.txt Checker tests your llms.txt. The Schema Markup Checker tests your schema markup, so key facts are stated twice in the same words. The XML Sitemap Checker confirms crawlers can find every page.
- Check the facts agree. The AI Consistency Checker will compare page, schema, llms.txt and feeds. Stable heading links help AI point to the exact passage: see citation anchor and the Citation Anchor Checker.
- Check a fetch is real. Verify an AI Bot checks an address against the company’s published list, as in verified bots.
- Compare with a page that is cited. Compare Two Websites sets our checks side by side.
- Watch it over time. In URSY Pro, opening in stages: What AI reads, Pages AI never reads, Stale facts finder and AI citation tracker.
What URSY.com counts #
We count each AI fetch as a request, sorted by the bot’s name into training, search or fetch-for-a-person, and checked against the company’s published IP list as real, fake or unknown. Because we read the edge log, we also see fetches the cache answers, which a normal plugin never sees. A bot reading the same page 10 times is 10 requests. Read our methodology.
Questions #
Is RAG the same as training? #
No. Training changes what the model has learned. RAG gives the model fresh passages for one answer. Blocking a training crawler does not by itself remove you from retrieval, and the reverse is also true.
Is RAG the same as fine-tuning? #
No. Fine-tuning trains a model further on chosen examples. RAG leaves the model as it is and changes what it reads at question time.
Does RAG stop hallucinations? #
It reduces the guessing, because the model has passages to work from. It cannot fix a passage that is wrong, out of date or missing its subject.
Can I see when an AI retrieved my page? #
Partly. Crawls and live fetches show in server and edge logs by bot name. What the model then wrote is not in your logs: you have to ask the question and read the answer.
Do I need special markup for AI Overviews? #
Google says no: no extra requirements and no special optimisation. The page must be indexed and eligible to show with a snippet.
Related words #
- Grounding
- Vector search
- Embeddings
- Query fan-out
- Context window
- Live fetcher
- AI Overview
- ChatGPT search
- Answer engine optimisation
Sources #
- Anthropic: Introducing Contextual Retrieval (19 September 2024), checked 24 November 2026
- Lewis et al.: Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (arXiv, 22 May 2020), checked 24 November 2026
- Google Search Central: AI features and your website, checked 24 November 2026
- Google: Google’s common crawlers (Google-Extended), checked 24 November 2026
- OpenAI: Overview of OpenAI Crawlers, checked 24 November 2026
- Anthropic: Does Anthropic crawl data from the web, and how can site owners block the crawler?, checked 24 November 2026
Updated 24 November 2026 by URSY.com.
Cite this page: Retrieval-augmented generation (RAG). URSY. Updated 26 November 2026. https://ursy.com/wiki/retrieval-augmented-generation/ · Section links
Tools for this
- LiveAI Readiness Checkeris your site ready for ChatGPT, Gemini, Claude? Score + fixesRun the check →
- LiveAI Bot Checkerwhich AI bots your robots.txt lets inRun the check →
- LiveRobots.txt Checker + Generatortest any address against your rules, or write new onesRun the check →
- LiveSchema Markup CheckerRun the check →
- ProMarkdown copy coverageWhich pages have a clean .md copy for AIIn URSY Pro →
- ProIndex coverage monitorPages Google has or hasn't indexedIn URSY Pro →