Skip to content
Surfacedd

Retrieval-augmented generation: how AI search reads before it answers

RAG is the reason a page you published last week can appear in an AI answer today. Here's the idea in plain words, how it maps onto ChatGPT search, Perplexity and Gemini, and what it means for the pages you want cited.

By the Surfacedd teamUpdated 4 min readMarkdown

On this page

Short answer

Retrieval-augmented generation (RAG) is a technique where a language model first retrieves relevant documents, then writes its answer from them. It was named in a 2020 paper by Lewis et al. AI search engines use it with web search as the retriever, which is why their answers can cite pages published after the model was trained.

What is retrieval-augmented generation?

Retrieval-augmented generation (RAG) is a way of building AI answers in two steps: retrieve documents relevant to the question, then generate an answer using them as context. The term comes from a 2020 paper by Patrick Lewis and colleagues, which described models that "combine pre-trained parametric and non-parametric memory for language generation" (Lewis et al., arXiv 2005.11401).

Those two kinds of memory are the whole idea, in plain words:

  • Parametric memory is what the model learned in training, stored in its weights. It's fixed at the training cut-off and can't point to where a fact came from.
  • Non-parametric memory is an external store the model can look things up in. In the original paper it was "a dense vector index of Wikipedia", searched with a neural retriever. In AI search it's the web, reached through a search engine.

The paper's motivation still describes the problem today: models that only use their weights have limited ability to "access and precisely manipulate knowledge". Retrieval lets the model work from current, specific text, and lets it say which document it used.

How RAG works in AI search engines

When ChatGPT search, Perplexity, Gemini with grounding or Claude with web search answers a question, the pipeline looks like this:

StepWhat happensWhere your page can drop out
1. DecideThe model decides whether the question needs a searchQuestions about stable facts often skip retrieval entirely
2. Fan outIt writes one or more search queries, often severalYour page doesn't match any of the fan-out queries
3. RetrieveThe search back-end returns results; pages are fetchedThe engine's crawler is blocked, or the page isn't in its index
4. SelectPassages from the results go into the model's contextYour page is fetched but its useful part is buried or missing
5. Generate and citeThe model writes the answer and attaches citationsIt read your page but cited another one

The web-search version of RAG is usually called grounding. Each engine's API exposes parts of this pipeline: the queries it ran, the sources it cited, and for some engines the sources it read without citing.

A worked example: the same question, with and without retrieval

The quickest way to see RAG at work is to ask one question twice: once to a model with no tools, which can only use its parametric memory, and once with web search on. Surfacedd's Brand Audit does exactly this: it asks two prompts (one about information, one about reputation) across six runs, three with web search on and three training-only.

Here is what the comparison tells you, illustrated with a fictional brand that changed its pricing model three months ago:

What you seeTraining-only answerWeb-on (RAG) answerWhat it means
Pricing descriptionOld per-seat pricingNew flat pricing, citing the pricing pageRetrieval has caught up. The model's memory will lag until its next training cycle
Product listMissing the newest productIncludes it, citing a review siteYour own page isn't the one retrieved for this; a third party is
Founding yearCorrectCorrectStable fact, both routes agree
ReputationNeutralMixed, citing a forum threadA live source is shaping the answer. That's the page to look at

The fix differs by column. A wrong training-only answer is slow to change: you influence future training data by keeping facts consistent everywhere, and the LLM SEO guide covers what's realistic there. A wrong web-on answer is fast to change, because it comes from a page that exists today, can be identified from the citation, and can be corrected or out-competed.

What RAG means for the pages you publish

Because retrieval works on passages, not whole sites, a few habits raise your odds of being selected in step 4:

  • Answer the question in the first sentence or two under each heading. Engines lift passages, so a section that only makes sense after reading the three before it is a weak candidate.
  • Put facts in server-rendered HTML. Many AI crawlers don't run JavaScript; a price that only appears after a script runs may never reach the model.
  • State facts with their entity and unit. "Plan X costs Y per month, billed yearly, as of November 2026" survives being lifted out of context. "It's affordable" doesn't.
  • Let the right crawlers in. Blocking an engine's search crawler removes you at step 3, however good the page is. See the OAI-SearchBot and PerplexityBot entries.

None of these makes a citation certain. They remove reasons for your page to drop out.

In Surfacedd

Brand Audit puts the training-only and web-on answers side by side for the same prompts, lists the pages each live answer cited, and scores each cited page for how well it matches your facts (alignment, 0–100) and how quotable it is (citability, 0–100), with a recommended action. That tells you which column of the table above you're dealing with before you spend time on a fix. An audit costs a few cents in API fees, shown before it runs.

Brand Audit showing 5 of 6 AI setups naming the brand, with each model's information and reputation verdict labelled web or training onlyBrand Audit showing 5 of 6 AI setups naming the brand, with each model's information and reputation verdict labelled web or training only
Sample workspace, fictional brand

For ongoing tracking, every answer Surfacedd collects stores the search queries the engine ran and the sources it cited, so you can see steps 2 to 5 for your own prompts. See Brand Audit for the feature, or pricing for the one-time licence.

  • Grounding: RAG with a web search engine as the retriever.
  • AI citation: the link a RAG answer gives the page it used.
  • CCBot: a crawler that feeds training data, the other route into a model.
  • AI hallucination: what retrieval reduces, and what it can't fix when the retrieved page is wrong.

Sources

  1. Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks" (arXiv 2005.11401) arxiv.org · checked
  2. Web search tool (OpenAI API docs) developers.openai.com · checked
  3. Grounding with Google Search (Google AI Studio) aistudio.google.com · checked

How we research, write and correct pages: read our editorial policy.

Keep reading

See who AI recommends instead of you.

Surfacedd asks ChatGPT, Claude, Gemini, Perplexity, Grok, Meta AI and Google's AI answers the questions your buyers ask, shows who gets named and which pages convinced them, and re-checks on a schedule.

Launch price $29, $79 after 23:59 UTC on January 30, 2027.$79 once. One-time licence. No subscription.