Sub topic 5
Retrieval and grounding: how live sources shape answers
Prerequisites and scope
This chapter assumes you know the basics of how search engines crawl and rank pages, that you have a general idea of what a large language model (LLM) does, and that you can read simple HTML and JSON. It builds on the previous chapters on parametric knowledge versus retrieval, and on brand mentions versus backlinks. It focuses on the retrieval side: what happens when an AI assistant looks things up at the moment you ask a question, and what that means for how your brand appears in the answer.
What retrieval and grounding mean
An LLM has two sources of information. The first is parametric knowledge, which is what the model absorbed during training and stores in its weights. It is fixed at the training cutoff. The second is retrieved content, which is text fetched at question time from a search index, a web crawler, a database or a set of uploaded documents.
Retrieval is the step that fetches that text. Grounding is the practice of giving the model the fetched text and asking it to base its answer on that text. A grounded answer often includes citations, which are links or footnotes pointing to the sources used.
The common implementation is called retrieval-augmented generation (RAG). Many AI search features, such as answer boxes in search engines and chat assistants with a browsing mode, follow a similar pattern, although each product differs in details that are not public.
For a brand, the practical consequence is this. Training data changes slowly and you cannot edit it. Retrieved content changes whenever the live web changes, so it is the part you can influence on a short timescale.
How a grounded answer is built
A typical pipeline has these stages. Real products vary, so treat this as a working model and not a specification.
- Query understanding. The system may rewrite the user's question into one or more search queries. A question like "What are good tools for tracking AI visibility?" can become several narrower queries.
- Retrieval. The queries go to a search index. The index returns candidate pages or passages. Some systems use keyword matching, some use embedding similarity (comparing meaning as numbers), and many combine both.
- Reranking and selection. A second model or scoring step picks the most useful passages. Only a few passages usually survive, because the model's context window (the amount of text it can read at once) is limited.
- Generation. The LLM reads the selected passages along with the question and writes an answer. It may cite the passages it used.
- Post-processing. The system may check citations, filter unsafe content, or format the answer.
Notice that parametric knowledge still feeds the final step. A grounded answer is a blend. If the retrieved passages do not mention your brand, the model may still mention it from memory, or may leave it out.
Where a brand can be lost
Each stage is a place where a brand can drop out. Knowing which stage failed tells you what to fix.
| Stage | Failure | Typical cause |
|---|---|---|
| Query rewriting | The queries never include your category or name | The brand is not tied to the topic in common phrasing |
| Retrieval | Your pages are not returned | Not indexed, blocked by robots rules, slow or JavaScript-only content, weak match to the query |
| Selection | Your page is returned but not chosen | Other sources look more relevant or more authoritative, or your passage is vague |
| Generation | The passage is read but your brand is not named | The text describes a product category without naming you clearly |
| Citation | Your brand is named but not linked | The model paraphrased several sources, or cited a third party instead |
The last row matters for the earlier chapter on mentions versus links. In grounded answers, a brand can be mentioned with no link, linked with no mention, or neither.
What makes a passage easy to use
Retrieval systems work on passages, not whole sites. Passages that are easy to retrieve and quote tend to share some traits. These are practical observations and not guarantees, because the ranking systems are not published.
- The page is accessible. It can be crawled, returns a normal status code, and shows its main text in the HTML without requiring scripts to run. Some AI crawlers do not execute JavaScript.
- The brand name appears in plain text near the claim. A sentence such as "Example Analytics provides dashboard reporting for retail teams" gives a passage that stands alone. A sentence such as "We provide dashboards" depends on a page title or logo that the retriever may not see.
- Facts are stated directly. Pricing, location, founding date, categories and supported integrations are easier to use when written in short declarative sentences or tables.
- Headings match real questions. A heading like "How does Example Analytics compare with spreadsheets?" matches queries more closely than a slogan.
- The content is current. Pages with stale dates or conflicting facts are less safe to quote.
Here is a fragment of HTML that is easy to retrieve and quote, with the name, category and a checkable fact in server-rendered text.
<article>
<h1>Example Analytics: dashboard reporting for retail teams</h1>
<p>
Example Analytics is a reporting platform for retail teams. It was
founded in 2016 and connects to point-of-sale systems and spreadsheets.
</p>
<h2>Which systems does Example Analytics connect to?</h2>
<ul>
<li>Point-of-sale exports (CSV and API)</li>
<li>Spreadsheet files</li>
</ul>
</article>Why third-party sources often win
Grounded answers frequently cite sources that are not the brand's own site. There are two reasons that follow from how retrieval is built.
First, the question often asks for comparison or judgment, such as "best" or "alternatives to". Pages that compare several options match these queries better than a vendor's own page, which describes one option.
Second, systems tend to prefer sources that look independent for claims that could be self-serving. Many designs also reward agreement across sources. If three independent pages state the same fact about your brand, that fact is safer to repeat than a single claim on your site. The later chapter on third-party corroboration covers this in detail.
This means that your own site is necessary but often not sufficient. It is the source for basic facts. Reviews, press coverage, directories and community discussions often supply the comparative context.
Grounding does not guarantee accuracy
Grounding reduces unsupported statements but does not remove them. Several failure modes are well documented.
- Misattribution. The model attaches a claim to the wrong cited source, or cites a page that does not support the sentence.
- Entity confusion. If two companies share a name, retrieved passages about one can be blended into an answer about the other. The earlier chapters on naming and disambiguation address this.
- Stale or conflicting sources. The retrieved set may include an old pricing page and a new one. The model may pick either, or merge them.
- Ignored context. Models sometimes rely on memory even when the retrieved text says something different.
- Variability. The same question can produce different retrieved sets and different answers from one run to the next.
Because of the last point, a single answer is an anecdote. Later chapters cover sampling many answers to estimate rates.
Checking what a retriever can see
You can do a basic accessibility check yourself. The script below fetches a page without running JavaScript and reports whether your brand name and category phrase appear in the raw HTML text. It approximates what a simple crawler sees. It does not reproduce any specific AI product.
import re
import sys
import urllib.request
def fetch(url):
request = urllib.request.Request(
url, headers={"User-Agent": "entity-check/1.0"}
)
with urllib.request.urlopen(request, timeout=15) as response:
status = response.status
body = response.read().decode("utf-8", errors="replace")
return status, body
def visible_text(html):
html = re.sub(r"(?is)<(script|style).*?</\1>", " ", html)
text = re.sub(r"(?s)<[^>]+>", " ", html)
return re.sub(r"\s+", " ", text)
def check(url, brand, phrase):
status, html = fetch(url)
text = visible_text(html).lower()
print("status:", status)
print("brand in raw text:", brand.lower() in text)
print("category phrase in raw text:", phrase.lower() in text)
print("characters of text:", len(text))
if __name__ == "__main__":
if len(sys.argv) != 4:
sys.exit("usage: python check.py URL BRAND PHRASE")
check(sys.argv[1], sys.argv[2], sys.argv[3])Run it as python check.py https://www.example.com/ "Example Analytics" "reporting platform". If the brand appears in a browser but not in this output, the text is probably injected by JavaScript, and some retrievers may not see it. Also check your robots.txt file. Many sites block some crawlers on purpose, and that choice has a cost: a page that a crawler cannot fetch cannot be used as a live source by that system. Whether to allow or block is a business decision, so weigh it against your goals and do not change it only to chase visibility.
Common errors
- Treating retrieval as the same as ranking in classic search. A page that ranks well can still be dropped at selection, and a page with modest rankings can be quoted if its passage answers the question cleanly.
- Optimizing only the home page. Retrieval works on passages from any page. Product, comparison, FAQ and documentation pages often supply the passage that is used.
- Hiding facts in images, PDFs or scripts. Text that is not in the page's HTML may not be read.
- Contradictory facts across pages. Different founding dates, names or prices on different pages weaken the agreement a system looks for.
- Assuming a citation equals influence. A source that is cited may not be the one that shaped the answer, and a source that shaped it may not be cited.
- Promising outcomes. No one outside the vendors knows the exact selection rules. Claims of guaranteed placement in AI answers are not supported by evidence.
Summary of the working model
- AI answers combine memory (parametric knowledge) with fetched passages (retrieval and grounding).
- Retrieval operates on passages, and the model sees only a few of them.
- A brand can be lost at query rewriting, retrieval, selection, generation or citation, and each loss has different causes.
- Accessible, plainly worded, consistent and corroborated facts are easier to retrieve and repeat.
- Third-party sources carry much of the comparative weight.
- Results vary between runs, so measure across many samples.
Exercise
A user asks an AI search tool for "alternatives to Rival Corp". Your page "Example Analytics vs Rival Corp" exists and ranks in classic search, but the AI answer never names Example Analytics. List three stages of the pipeline where it could have been lost, and one check you could run for each.
Show answer
Possible answers: (1) Retrieval: the page may not be returned. Check that it is crawlable, not blocked in robots.txt, and that its text appears in the raw HTML (for example with the check.py script). (2) Selection: the page may have been returned but outranked by other comparison pages. Compare your passage with the cited sources and check whether it states the comparison in direct sentences with the brand name in plain text. (3) Generation or citation: the passage may have been read but the brand not named, or named without a link. Test the exact question several times and record whether the brand appears in the text, in the citations, both or neither. Query rewriting is also acceptable: check whether the system's rewritten queries include your category terms.
Exercise
Why is a single AI answer that includes your brand not good evidence that your retrieval visibility is strong?
Show answer
Retrieval and generation vary between runs, wording, location and time. One answer is a single sample, so it could be an unusually favorable one. A reliable estimate needs many samples of many prompts, with the mention rate compared over time.