RAG (retrieval-augmented generation)
RAG is a method where an AI system first searches for relevant pages or documents, then writes its answer from what it found. ChatGPT search and Perplexity work this way, so your page has to be found and read in that search step before it can shape the answer.
What is RAG?
RAG, or retrieval-augmented generation, is a way of building AI answers in two steps. First, the system searches a set of documents, like the web or a help center, and pulls out the passages that look relevant. Then a large language model writes the answer using those passages, often with links to where they came from.
The name comes from a 2020 paper by Patrick Lewis and colleagues at Facebook AI Research, University College London and New York University. Today, almost every AI search tool works some version of this way, including ChatGPT search, Perplexity and Google's AI Overviews.
Let's say you sell a background check API for HR platforms. A product manager asks Perplexity: "which background check APIs support continuous monitoring and have a sandbox?" Perplexity searches the web, pulls passages from a few vendor docs pages and a comparison post, and writes an answer from them. If your docs page states that you offer continuous monitoring and a free sandbox, it can be one of those passages. If that fact is buried in a PDF, it probably won't be.
Why RAG matters for B2B SaaS
RAG is why a page you publish today can show up in an AI answer next week. The model doesn't need to have learned about you in training. It needs to find your page in the search step and pull a useful passage from it.
That changes what a good page looks like. Here's what I think matters most:
- Retrieval comes first: If the AI's search step never finds your page, nothing else counts. Being crawlable and ranking in the search systems these tools use is the entry ticket.
- Passages beat pages: RAG systems usually split pages into chunks and pick the best ones. A section that answers one question on its own is easier to pick than an answer spread across five paragraphs.
- Facts get reused as written: The model writes from what it retrieved. If your page says "pricing starts at $49 a month for 3 users", that's what it can repeat. If it says "affordable plans for every team", it has nothing to say.
- Your product may use it too: Many SaaS support bots, like Intercom's Fin, answer customers from your help center articles. The same writing habits help your buyers and your own AI agent.
How to write for RAG
Writing for RAG is mostly writing plainly for a busy reader. Here's my process:
- Answer first in every section: Open each H2 with one or two sentences that answer its question directly. Then add the detail and examples.
- Make sections stand alone: Repeat the product name instead of "it" at the start of a section, and don't lean on "as mentioned above". A retrieved chunk often arrives without the rest of the page.
- State facts with numbers and dates: Prices, limits, supported tools, certifications and the date you last checked them. Specific facts are what an answer can quote.
- Keep facts the same everywhere: If your pricing page, docs and G2 profile disagree, the model has to pick one. Fix the conflicts before you write anything new.
- Put text in HTML: Key facts in images, PDFs or tabs that load only with JavaScript are harder for crawlers to read. Plain page text is the safest format.
- Let the right crawlers in: OpenAI uses GPTBot for training and OAI-SearchBot for ChatGPT search, and blocking one doesn't block the other. Check your robots.txt and CDN rules so the search bots you want can reach your pages.
A RAG example
Here's how the background check question could move through a RAG system, and what a hypothetical API company would need at each step:
| Step | What the AI does | What your page needs |
|---|---|---|
| Search | Turns the question into one or more web searches | To be crawlable and to rank for "background check API continuous monitoring" |
| Retrieve | Pulls the most relevant passages from the top pages | A section titled "Continuous monitoring" that answers in its first two lines |
| Generate | Writes the answer from those passages | Plain facts, like "sandbox included on every plan", that it can repeat as they are |
| Cite | Links the sources it used | A clear page title and URL that a buyer will want to click |
The step most teams skip is the second one. The page ranks, but the answer is spread across a long intro and a feature grid, so the system picks a rival's cleaner passage instead. We cover how we write pages for AI search in our AI SEO methodology.
How to measure RAG
You can't see inside a RAG system, so measure what goes in and what comes out. Here's what I track:
- AI crawler visits: In your server logs or CDN analytics, count visits from OAI-SearchBot, PerplexityBot and other AI crawlers, and note which pages they read. A key page with no visits has a crawl problem.
- Citations: Run your buyer prompts through ChatGPT, Perplexity and Google AI Mode, and count how often your pages appear as sources. A prompt tracking tool can do this every week.
- What gets quoted: Read the answers that cite you and find the passage they used. That shows you which sections are working and which format to repeat.
- Referral sessions: In GA4, look at sessions from chatgpt.com and perplexity.ai by landing page. The numbers are small, but they show which pages earn clicks from answers.
- Accuracy: Check whether answers describe your product correctly. A wrong fact usually traces back to an old page, a third-party listing or a conflict between your own pages.
Common RAG mistakes
- Burying the answer: A section that opens with a story and reaches the point in paragraph four is hard to retrieve. Put the answer in the first lines.
- Blocking search bots by accident: Some teams block every AI bot to stop training and lose their place in AI search too. Decide bot by bot, using each company's own documentation.
- Relying on training data: Assuming the model "knows" your product from training leads to stale answers. Publish current facts where the search step can find them.
- Keeping facts in gated files: A security whitepaper behind a form can't be retrieved. Write the key facts on an open page and keep the full file gated if you need to.
- Leaving old pages live: An old pricing page that still ranks can be retrieved as easily as the new one. Redirect or update pages when the facts change.
Here's a quick test for this week. Take the one fact you most want buyers to know about your product, and search your site for it. Is it written in plain text in the first lines of a section, or is it hiding somewhere a crawler can't reach?
Read more
FAQ
What does RAG stand for?
RAG stands for retrieval-augmented generation. The AI retrieves relevant documents first, then generates its answer using them, which lets it work with newer facts than its training data holds.
Who invented RAG?
The name comes from a 2020 paper by Patrick Lewis and colleagues at Facebook AI Research, University College London and New York University. The idea of pairing search with a language model has since spread to almost every AI search tool.
Is RAG the same as training data?
No. Training data is what a model learned before release, and it can't change until the next version. RAG pulls in pages at the moment someone asks, so a page you publish today can show up in an answer this week.
How do I know if AI tools are retrieving my pages?
Check your server logs or CDN for visits from AI search crawlers like OAI-SearchBot and PerplexityBot. Then run your buyer prompts and see whether your pages show up as cited sources.


