RAG (Retrieval-Augmented Generation)
What is RAG?
RAG (Retrieval-Augmented Generation) is an AI architecture that combines information retrieval with answer generation. Instead of relying solely on knowledge stored within the model, a RAG system first retrieves matching documents from a knowledge base or an index and then generates an answer based on them, often pointing to its sources.
AI search engines such as Perplexity, ChatGPT with search and Google's AI Overviews follow a similar pattern: retrieve first, then answer with sources. Companies describe this step differently, not all of them publicly call it RAG, and they do not disclose the details of how sources are selected. Understanding RAG is crucial for effective GEO.
Why does it matter?
- Sources next to the answer — the RAG pattern makes it possible to show which documents the information comes from
- Freshness — an answer can draw on documents retrieved at query time, not only on the model's training data
- Fewer fabrications — grounding the answer in documents reduces, though does not eliminate, the risk of hallucinations
- Relevance for GEO — a page the system cannot find or fetch has no chance of making it into an answer
How does RAG work?
1. Retrieval
The system searches an index for documents matching the user's query (vector search, full-text search or both).
2. Passage selection
From the retrieved documents, the system selects the passages that best match the query. AI search engines do not publicly describe the criteria for this selection in detail.
3. Generation
The language model generates an answer based on the selected passages, often with links to the sources.
Good practices (for GEO)
- An answer under the heading — a definition, list or table from which a self-contained passage is easy to extract (citability)
- Answer questions — retrieval matches passages to queries
- Schema.org — describes content in a machine-readable form
- Current dates and facts — outdated content risks an answer repeating outdated information
- Do not block AI bots — if robots.txt blocks GPTBot, ClaudeBot or PerplexityBot, bots that respect robots.txt (as their operators state they do) will not fetch the page
Whether the system cites a particular page is decided by the system, not by the site owner.
More in the guide how AI is changing search.
Related terms
- GEO — optimization for AI engines
- AI Overviews — AI answers in Google
- Citability — content citability
- Knowledge Graph — Google's knowledge base
- LLMs.txt — informational file for AI