What is RAG? How ChatGPT, Perplexity and Google AI Mode find sources before answering

SEO and GEO specialist, SEO Leader at Forza

Published . 7 min read.

When you ask ChatGPT about next week’s flight prices, or ask Google AI Mode something that needs fresh numbers, the model doesn’t answer from memory alone. It searches the web first, reads a few relevant passages, and only then writes an answer with sources attached. This approach is called RAG. This article explains what RAG is, the steps it runs through, how ChatGPT, Perplexity and Google use it, and where a website can drop out along the way.

1. What is RAG?

RAG (Retrieval-Augmented Generation) is a way of having a language model find and read relevant documents first, then write its answer based on those documents. The term comes from a paper by Patrick Lewis and colleagues at Facebook AI Research, University College London and New York University, posted on arXiv on 22 May 2020.

The paper splits a model’s knowledge into two kinds. Parametric memory is what sits inside the model after training. Non-parametric memory is an external document store the model can look things up in; in the original experiments, that store was a vector index of Wikipedia. The easiest way to picture it is two kinds of exam: without RAG it’s closed-book, with RAG it’s open-book.

Model answering from memoryModel using RAG
Where knowledge comes fromTraining dataTraining data plus documents retrieved at question time
How fresh it isStops at the training cut-offAs fresh as the index it searches
Cites sourcesUsually notCan link each claim to a source
When it doesn’t knowProne to guessingHas documents to lean on, but can still misread them

RAG doesn’t make AI error-free. It turns the question “does the model remember correctly?” into two different questions: did the system find the right documents, and did the model read them correctly? For SEO and GEO practitioners that’s good news: the document that gets found can be your page.

2. How does RAG work?

A RAG system runs in two stages: preparing a document store in advance, and retrieving from it when someone asks. Tap “Next step” in the illustration to walk through each step with a sample question.

RAG has two stages. Indexing: collect web pages, split them into chunks, turn each chunk into a vector and store it. Answering: turn the question into a vector, fetch the K closest chunks, add them to the prompt and let the LLM write an answer with citations.

Stage 1: preparing the document store

  1. Collect documents: web pages, PDFs, databases. For AI search engines, this is the web index their bots build.
  2. Split into chunks: each page is divided into short passages, usually by paragraph or section. The system retrieves passages, not whole pages.
  3. Create embeddings: each chunk is turned into a vector, a list of numbers that represents its meaning. Two chunks that say the same thing sit close together, even if they use different words.
  4. Store them: vectors are saved alongside the original text and its URL so they can be cited later.

Stage 2: when someone asks

  1. Process the question: the question is embedded with the same model. Many systems also rewrite it, or split it into several smaller queries (query fan-out).
  2. Retrieve: fetch the K chunks whose vectors are closest to the question. Real search systems usually combine this with keyword matching and a re-ranking step.
  3. Build the prompt: the question and the retrieved chunks are handed to the language model together.
  4. Write the answer: the model writes from those chunks and attaches a source to each claim.

Two things follow from this: what gets selected is a passage, not a whole page, and a passage that doesn’t make the top K has no chance of being cited, however good the page around it is. Searching by meaning rather than by exact words is the same idea as semantic search in SEO.

3. How ChatGPT, Perplexity and Google use RAG

All three search the web before answering, but they query different indexes and rely on different bots. The table only lists what each platform has published in its official documentation.

PlatformWhere it looksBot you need to allowWorth knowing
ChatGPT searchOpenAI’s search systems, sometimes combined with third-party search providers (OpenAI doesn’t publish a full list)OAI-SearchBotYour question is usually rewritten into one or more more specific queries before it is sent out
PerplexityThe index PerplexityBot buildsPerplexityBotPerplexity-User fetches pages on a user’s request and generally ignores robots.txt
Google AI Overviews, AI ModeThe Google Search indexGooglebotMay use query fan-out: several related searches across subtopics and data sources

For Google, the eligibility rule is clear: a page must be indexed and eligible to show a snippet in Google Search. Google also says no special schema, files or markup are needed for its AI features. The two features may use different models and techniques, so the links they show differ too. More in What are AI Overviews and AI Mode.

Not everything in an answer comes from a web page with a link. Google says AI Mode also uses facts from the Knowledge Graph, and recent analysis suggests those facts can enter answers with no URL attached, as covered in Knowledge Graph facts go straight into AI Mode answers.

4. How is RAG different from training data?

An AI model can know about your brand in two ways: it learned it from training data, or it finds it through RAG when someone asks. The two routes use different bots, and blocking one doesn’t block the other.

Training dataRAG at answer time
When it happensBefore a model launches, in batchesEvery time a user asks
How fresh it isStops at collection timeAs fresh as the index it searches
Links back to your siteNoYes, if your page is cited
Bots involved (OpenAI example)GPTBotOAI-SearchBot, ChatGPT-User

According to OpenAI’s documentation, disallowing GPTBot only signals that content shouldn’t be used to train models; to appear in ChatGPT search you need to allow OAI-SearchBot. Google separates them too: Google-Extended limits training and grounding in some of Google’s other AI systems, while access for Search is still governed by Googlebot. The full list is in AI bots explained and the new AI training signal in robots.txt.

5. Where can a page drop out?

Following the RAG pipeline, there are five points where a page can fall out of an answer. Each has a different cause, so each is checked differently.

  1. The bot can’t read the page. It’s blocked in robots.txt, blocked by a firewall or CDN, or the content only appears after JavaScript runs.
  2. The page isn’t in the index the platform searches. For Google, that means it isn’t indexed; for ChatGPT, it isn’t in OpenAI’s index or its search providers’. How to read each “not indexed” reason is covered in indexing cleanup.
  3. It’s indexed but doesn’t make the retrieved set. The passage isn’t close enough in meaning to the question, or the answer is spread over several passages so none of them is strong enough.
  4. It’s retrieved but not used. The model receives more passages than it uses. Vague passages, ones missing context, or ones that repeat another source are easy to drop.
  5. It’s used but not linked. The information makes it into the answer without a citation, or the citation goes to another page saying the same thing.

When retrieval picks up an outdated document, or one about a different entity with the same name, the answer goes wrong with it. That’s one of the causes in why AI gets your brand wrong. And because the fifth point leaves no click behind, measuring GEO has to count mentions, not just traffic.

6. What this means for businesses

  • SEO is still the front door. The index is where RAG looks for documents. A page that isn’t crawled and indexed isn’t in any answer.
  • Every passage is read on its own. AI retrieves passages, not pages, so an important point needs to be fully stated within one passage, including the product or brand it is about.
  • No platform fully publishes how it picks sources. Any conclusion about whether a page gets cited needs to be checked by asking repeatedly across several platforms, not from a single test.

For the basics of the concept itself, start with What is GEO.

FAQ

What is RAG?

RAG (Retrieval-Augmented Generation) is a way of having a language model find and read relevant documents first, then write its answer based on them. ChatGPT search, Perplexity and Google AI Mode all search the web before answering in this way.

Is RAG the same as GEO?

No. RAG is the technique AI platforms use to find documents before answering. GEO is the work a business does so its website and brand get found, used and cited by those systems.

Does blocking GPTBot remove my site from ChatGPT search?

According to OpenAI’s documentation, no. GPTBot relates to model training. Appearing in ChatGPT search depends on OAI-SearchBot; sites that block OAI-SearchBot are not shown in ChatGPT search answers.

Do I need schema or llms.txt for Google AI Mode to use my page?

Google says no special schema, files or markup are needed to appear in AI Overviews and AI Mode. The page needs to be indexed and eligible to show a snippet in Google Search. On llms.txt, see What is llms.txt.

References

  • Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks – Lewis et al., arXiv (05/2020)
  • AI features and your website – Google Search Central
  • Overview of OpenAI Crawlers – OpenAI
  • Searching the web with ChatGPT – OpenAI Help Center
  • Perplexity Crawlers – Perplexity