← all articles

Making Answers Cite The Passage They Used

The footnote that points somewhere else

A support assistant answers a customer: refunds are available within 30 days of purchase [2]. The customer clicks the citation. It opens a policy document that does mention a 30 day window, for a different product line, and says the product they bought has a 14 day window two paragraphs further down. The answer looked grounded. It had a footnote. The footnote was attached to the right document and the wrong claim.

That’s the specific failure this piece is about. Retrieval found relevant material, the model wrote a fluent answer, and the citation layer made the answer look more trustworthy than it was. A reader who sees a footnote tends to assume someone checked it. In most RAG systems nobody did.

Getting citations right is a separate job from getting retrieval right. If the correct passage never reaches the model, no citation scheme will save the answer, and that side of the problem, retrieval quality, chunking and stale indexes, deserves its own debugging pass. This piece assumes retrieval is working reasonably and asks the next question: when the model says a claim came from a passage, how do you make that true, and how do you check it without a human reading every answer?

The answer has three parts. Structure the input so the model can refer to passages precisely. Structure the output so every claim carries its own reference and, ideally, a quote. Then verify in code, first with cheap deterministic checks and then with a support check that asks whether the cited text actually backs the sentence it’s attached to. Each part is ordinary engineering. Together they turn footnotes from decoration into something you can measure.

What a citation should promise

Before building anything, decide what a citation in your system means. There are several possible promises, and they’re very different in strength.

The weakest is topical: this document is about the same subject as the answer. Most early RAG interfaces made this promise by listing the retrieved documents under the answer. It’s easy and nearly useless, because retrieval returns related material by design. Every result is topically related.

A stronger promise is that the answer used this passage. That’s harder to check, since the model can’t reliably report what it drew on, but it at least narrows the reference to what was in the context window.

The promise worth building toward is support: this specific claim is stated or directly implied by this specific passage. If a reader opens the passage, they’ll find the claim there. That’s what a reader assumes a footnote means, so it’s the only promise that doesn’t mislead.

Support also has a granularity. A citation can point at a whole document, a chunk, or a sentence or span within the chunk. Document-level citations are almost always too coarse for long documents: the reader has to hunt, and the check can’t tell which part was meant. Chunk-level is the practical default. Span-level, where the citation carries the exact quoted text, is the most useful for readers and the easiest to verify, and it’s the level the rest of this piece works toward.

Write the promise down. It determines the output format, the checks you run and what counts as a failure in your metrics.

Give every chunk a handle

The model can only cite what it can name. If you paste five retrieved chunks into the prompt as unlabelled blocks of text, the model has no reliable way to refer back to one of them. It’ll invent a label, cite by document title, or paraphrase the source.

Label each chunk with a short, unique identifier when you build the prompt. Something like [S1] through [S5], or [doc12-c4], placed at the start of each block, with the source title and section heading alongside it. Short identifiers work better than full URLs or file paths: they’re cheaper in tokens, the model reproduces them accurately, and there’s less for it to garble.

Keep the mapping from those short identifiers to the real chunk in your own code. The prompt’s [S3] means nothing outside that single call. Your application knows that [S3] in this request was chunk 4 of the refund policy, version dated last Tuesday, characters 1,200 to 1,850. When the answer comes back, you translate the identifiers into links, and you verify against the exact text that was sent.

Make the underlying chunk identity stable. If your index is rebuilt and every chunk gets a new ID, logged answers from last month can no longer be traced to what they cited. A content hash of the chunk text, stored alongside a document ID and version, gives you an identifier that survives re-indexing and changes only when the text itself changes. That matters when someone disputes an answer weeks later and you need to show what the model was looking at.

Order matters a little too. Models show some tendency to favour passages near the start or end of the context. Randomising chunk order, or ordering by relevance consistently, won’t remove that tendency, but logging the order lets you check later whether citations cluster on position rather than content.

Ask for claims, not paragraphs

The most common output format is a paragraph of prose with bracketed markers scattered through it. It reads naturally, and it’s hard to verify, because it’s unclear which words each marker covers. Does [2] at the end of a sentence support the whole sentence, the last clause, or the sentence before it too?

A more checkable format breaks the answer into claims. Ask the model, through structured output, for a list of statements, where each statement has its text, the identifiers of the passages that support it, and a short verbatim quote from each cited passage. Your application can then render that list as prose with footnotes for the reader, while keeping the structured version for verification.

Something like this, conceptually: a statement “The standard plan allows refunds within 14 days of purchase”, citing S3, with the quote “Standard plan purchases may be refunded within 14 days”. The statement is short enough to check against one passage. The quote tells you exactly where in the passage the support lives.

Tell the model the rules in the prompt. Every factual statement must cite at least one passage. A statement that can’t be supported by any provided passage must not be made, or must be marked as unsupported. Quotes must be copied exactly from the passage, not paraphrased. If passages disagree, say so and cite both.

There’s a trade-off. Claim-level output is longer and costs more output tokens than a single paragraph, and forcing everything into short atomic claims can make answers read stiffly. For many products, a middle ground works: sentence-level claims, each a normal sentence, each with citations and quotes. The reader sees ordinary prose. The verifier sees a list.

Quotes turn trust into a string match

Requiring a verbatim quote for each citation is the single most useful change you can make, because it converts part of the verification problem into something a computer can check exactly.

If the model claims passage S3 says “Standard plan purchases may be refunded within 14 days”, your code can look up the text of S3 and test whether that string appears in it. If it does, you know the quote is real and you know where it is. If it doesn’t, the citation is wrong, however plausible it looks.

Do the match with some tolerance. Normalise whitespace, quote marks and dashes on both sides before comparing, since models often tidy punctuation. Allow for ellipses if you permit the model to skip part of a sentence. Beyond that, be strict. A fuzzy match that accepts a quote where a few words were changed defeats the purpose, because a changed number or a dropped “not” is precisely the kind of edit that makes a citation misleading.

A quote that matches still doesn’t prove support. The model can quote a real sentence that’s related to the claim without establishing it: quoting “refunds are processed within 5 working days” as support for “refunds are available for 30 days”. The string match catches invented and garbled quotes. It doesn’t catch mismatched ones. That needs the support check covered later.

Quotes have one more benefit. They give the reader something immediate. Showing the quoted sentence on hover, or beside the answer, lets a person judge the support themselves in a second, without opening a document and searching for the relevant part. That’s often worth more to users than any automated score.

Provider citation features

Several model providers now offer citation support built into their APIs. The general shape is that you pass documents as structured inputs rather than pasted text, enable a citations option, and the response comes back with text segments linked to locations in the source documents, sometimes with the cited text included. Some retrieval and search products attach source references to answers in a similar way.

These features are worth trying, for two reasons. The provider handles the mechanics of identifying locations, so you get character ranges or block references without designing your own format. And because the citation is produced as part of the response structure, it’s less likely to be a garbled identifier.

Check your provider’s documentation for the specifics, because they differ in important ways: what granularity the citations have, whether the cited text is returned or only a location, how they interact with structured output modes, whether they work with every model on the platform, and how they’re billed. Some count cited text toward output tokens, and some don’t. Don’t assume the details from one provider carry over to another.

Don’t skip verification because the provider produced the citation. A citation feature makes the reference precise. It tells you where the model says the support is. It doesn’t independently establish that the passage supports the claim, and the documentation for these features generally doesn’t claim that it does. Run the same checks on native citations as on your own format. If you might switch providers later, store citations in your own normalised structure, source ID plus span plus quote, so your verification and your logs don’t depend on one vendor’s response format.

How citations go wrong

It helps to name the failure modes, because each one needs a different check.

Invented references come first. The model cites S7 when only five passages were provided, or cites a document title that doesn’t exist. These are easy to catch and surprisingly common when the prompt doesn’t label passages clearly.

Then there are real references with garbled quotes: the passage exists, but the quoted text was paraphrased or altered. The string match catches these.

Mismatched support is the hard one. The passage is real, the quote is real, and the passage doesn’t back the claim. The refund example at the top is this type. It often happens when two retrieved passages are similar, such as two versions of a policy or two product lines, and the model merges details from both.

Partial support comes next. The passage backs half the claim. “The standard plan costs the same as last year and includes priority support” might cite a passage that only covers price. The claim looks cited, and half of it isn’t.

Citations can also be laundered. The model states something it knows from training, or infers it, and attaches the nearest related passage to make it look grounded. This is especially likely when retrieval returned nothing directly useful and the prompt pressures the model to cite everything.

Finally there’s the uncited claim: a factual sentence with no citation at all, slipped between cited ones. In prose output these are easy to miss. In claim-level output they show up as statements with empty citation lists, which your code can count.

When sources disagree or say nothing

Two situations produce a large share of bad citations, and both are about the retrieved set rather than the model.

The first is conflict. Your index holds last year’s pricing page and this year’s, or a general policy and a regional exception, and both come back for the same question. A model asked to produce one clean answer will often blend them: the price from one, the conditions from the other, with a citation to whichever it mentioned last. Every individual check can look fine, since both passages are real and both quotes match, and the combined answer is still wrong.

Handle this in two places. In the prompt, tell the model that when passages disagree it must say so, state each version, and cite each one separately. In the pipeline, pass document metadata such as the effective date, region or product line alongside each chunk, so the model has the information it needs to pick the right one, and so your checks can notice when a single claim cites two versions of the same document. Better still, stop the conflict at the source by removing superseded versions from the index, or marking them clearly as archived.

The second is absence. Retrieval returned passages, and none of them contains the answer. This is where laundered citations come from. If the prompt insists that every statement be cited, and nothing in context supports the obvious answer, the model is squeezed between two instructions and often resolves it by attaching the nearest related passage to something it already believed.

Give it permission to say it doesn’t know. Tell it that when no provided passage supports an answer, the correct response is to say the sources don’t cover it, and treat that response as a success in your evals rather than a failure. Include a few such questions in your test set. A system that correctly says “the documents I have don’t cover this” is far more trustworthy than one that always produces a footnote.

The deterministic checks

Run the cheap checks first, on every answer, before anything reaches the user. They cost almost nothing and they catch a meaningful share of problems.

Check every cited identifier exists in the set of passages sent with that request. An identifier that doesn’t map to a passage is an automatic failure for that claim.

Check every quote appears in the passage it’s attributed to, after normalisation. A quote that isn’t found is a failure. Sometimes the quote exists in a different passage from the one cited, which is worth logging separately, because it usually means the model mixed up two identifiers rather than invented anything, and it points at passages that look alike.

Check every factual statement has at least one citation. Deciding what counts as factual is fuzzy, so in practice you check the structured output: any statement object with an empty citation list is flagged, unless it’s been explicitly marked as a caveat or an “I couldn’t find this” line.

Check numbers. If a statement contains a figure, such as a price, a date, a duration or a percentage, check that the same figure appears in the quoted text or at least in the cited passage. This is a crude check, and it’s very effective at catching the most damaging kind of error, where the answer states a number the source doesn’t contain. It’ll produce some false alarms when a figure is written differently, like “two weeks” against “14 days”, and you can decide whether to normalise those or accept the noise.

Log every failure with the request, the passages and the raw output. These logs are what you’ll use to tune prompts, chunking and retrieval.

Checking that the passage supports the claim

The deterministic checks confirm the citation is real. The remaining question is whether the passage actually says what the claim says. That’s a judgement about meaning, and it needs a model.

The standard framing comes from natural language inference: given a premise, the passage, and a hypothesis, the claim, decide whether the premise entails the hypothesis, contradicts it, or neither. There are small, fast models trained specifically for this task, and you can also use a general LLM as the judge with a prompt that asks for one of three labels: supported, contradicted, or not enough information.

Run the check per claim, against only the passages cited for that claim. Checking against every retrieved passage answers a different question, whether anything in context supports it, which is useful for spotting mis-citations but not for validating the citation the reader will see. Feeding the judge just the claim and its cited text also keeps each call small and cheap.

Three labels are better than two. Contradicted is a serious failure: the source says something different. Not enough information is the common failure: the passage is related but doesn’t establish the claim. Treating both as a single “unsupported” loses a distinction you’ll want when deciding what to do about them.

For claims with several parts, split them before judging, or ask the judge to evaluate each part. A long compound sentence tends to get marked supported if most of it is, and partial support is exactly the case you’re trying to catch. Asking the answering model to produce shorter claims in the first place makes this step much easier.

Expect the judge to be imperfect. It will miss some mismatches and flag some correct citations. That’s acceptable as long as you know roughly how often it does each, which is the next step.

Calibrating the judge

An automated support check is only useful if you know how far to trust it. Before relying on it, measure it against human judgement on your own content.

Take a sample of claims from real answers, with their cited passages. A couple of hundred is a reasonable start. Have a person label each one with the same three labels the judge uses. Then run the judge on the same sample and compare. How often does it agree? When it disagrees, which way does it lean?

LLM judges are often lenient on support. They see a passage on the same topic with overlapping terms and call the claim supported, even when a key detail differs. If your sample shows that, tighten the judge prompt: tell it that any difference in numbers, dates, product names, conditions or negation means the claim is not supported, and include a couple of examples of near misses in the prompt. Then re-measure.

Look at the disagreements by type. A judge that misses number mismatches can be backed up by your deterministic number check. A judge that struggles with passages full of tables may need those passages formatted differently. A judge that fails on long passages may need the cited span rather than the whole chunk.

Consider using a different model for judging than for answering. It won’t eliminate shared blind spots, but it reduces the chance that the judge accepts an error precisely because it would have made the same one.

Keep the labelled sample and rerun it whenever you change the judge prompt or model. Like any eval set, it’s worth far more if it stays fixed and you add to it rather than editing it.

What to do with an unsupported claim

Once you can detect unsupported claims, you need a policy for them. The options range from silent to strict, and the right one depends on what a wrong answer costs in your product.

The strictest is to drop unsupported claims from the answer entirely and tell the reader that some information couldn’t be verified from the available sources. This works well for policy, legal, medical or financial content, where an ungrounded sentence is worse than a shorter answer.

A middle option is to regenerate. Send the failing claims back to the model with the judge’s verdict and the passages, and ask it to either correct the claim to match a passage or remove it. This costs another call, adds latency, and usually fixes a good share of mismatches, especially the ones caused by merging similar passages. Cap it at one retry, then fall back to dropping.

A lighter option is to flag. Keep the claim, but mark it visibly as unverified, or leave it without a citation instead of attaching a misleading one. That’s honest and cheap. It relies on readers noticing the flag, which they often won’t.

Contradicted claims deserve stricter handling than not-enough-information ones. A claim that the source directly contradicts should never reach the user with a citation to that source.

Whatever policy you pick, the rule that matters most is: never show a citation that failed the checks. An uncited sentence is a known unknown. A sentence with a footnote that doesn’t support it actively misleads, and it trains users to trust footnotes that haven’t earned it.

Chunk boundaries shape citation quality

The way you chunk documents affects citations as much as it affects retrieval, and the two pull in different directions.

Large chunks help the model understand context, and they make citations vague. If a chunk is a full page covering three products, a citation to it tells the reader little, and the support check has to find the relevant sentence among many. Large chunks also make mismatched support more likely, because the passage contains the right words for several different claims.

Small chunks make citations precise and support checks easier, and they can strip away the context that makes a sentence true. A chunk reading “the window is 14 days” means nothing without the heading above it that says which product and which kind of window.

A few approaches help. Prepend the document title and section heading to each chunk, both in the index and in the prompt, so a small chunk carries its context. Retrieve at one size and cite at another: retrieve paragraph-sized chunks for the model to read, and ask it to quote the specific sentence within the chunk, so the citation is precise even though the context is wide. Keep tables with their headers, since a row of numbers without column names is uncitable.

If you use a reranker, it tends to push the most relevant chunks to the top, which also concentrates citations on fewer, better passages. That’s a good effect, and worth measuring separately from retrieval metrics.

When you change chunking, rerun your citation checks as well as your retrieval evals. A chunking change that improves retrieval recall can make citations worse, and you won’t notice unless you look.

Measuring citation quality over time

Two numbers summarise citation quality reasonably well, and both come straight out of the checks you’re already running.

Citation precision asks: of the citations you showed, how many actually support their claim? It’s the share of cited claims that pass the deterministic checks and the support judge. This is the number users feel. When it’s low, footnotes lie.

Citation recall asks: of the factual claims in your answers, how many carry a valid citation? It’s the share of claims that are both cited and supported. When it’s low, answers contain unsupported material even if every visible footnote is fine.

Track the share of answers with at least one contradicted claim as a separate number. It’s rarer and more serious, and averaging it into a general score hides it.

Compute these on production traffic by sampling, and on a fixed test set of questions whose correct answers and supporting passages you’ve identified by hand. The test set tells you whether a change helped. The production sample tells you whether real users’ questions behave like the test set. Both matter, because users ask things your test set didn’t anticipate.

Break the numbers down by document source. Citation problems cluster. A particular set of documents, often ones with near-duplicate versions, repeated boilerplate or dense tables, tends to produce most of the mismatches. Fixing those documents, removing stale versions from the index or chunking them differently usually does more than changing the prompt.

Cost, latency and a start this week

Verification isn’t free. Claim-level output with quotes increases output tokens. A support judge adds one call per answer, or several if you judge claims separately, and a regeneration step adds another round trip for answers that fail. For a chat product, that latency is noticeable.

You can control it. Deterministic checks are nearly free, so always run them. Use a small, fast model or a dedicated inference model for the support check, since it’s a narrow task on short inputs. Run the judge in parallel across claims. For latency-sensitive products, stream the answer, run checks as claims complete, and adjust or flag citations once verified, or run full verification asynchronously on a sample and use the results to improve the system rather than to gate every answer.

Decide by stakes. For an internal search tool, sampling and offline measurement may be enough. For anything customer-facing that states policies, prices or obligations, verify every answer before it’s shown.

To start: label every chunk in the prompt with a short identifier and keep the mapping in code, with stable underlying IDs. Switch the output to structured claims with citations and verbatim quotes. Add the deterministic checks for identifiers, quotes, missing citations and numbers, and never display a citation that fails them. Label a couple of hundred claims by hand, build a support judge, and measure how often it agrees with you. Then pick a policy for unsupported claims, start tracking citation precision and recall, and look at which documents produce the failures.

For more breakdowns of how AI tools behave on real workloads, and what they cost once they’re running, head back to the AI Tool Gazette homepage.

for builders
Running agents or scrapers at scale?

AI pipelines that crawl, research, or automate the web hit rate limits and geo-blocks fast. Singapore Mobile Proxy runs real 4G/5G mobile IPs that carriers still trust.

see plans →
read on
More from the Gazette

Tool reviews, model and pricing news, and build guides for people shipping real things with AI.

browse all articles →