Sub topic 12
Citation accuracy: do cited passages support the claims?
Many RAG systems attach citations to their answers, such as [2] or a document ID after a sentence. A citation promises that a specific passage backs up that statement. This chapter shows how to measure whether the promise holds.
It assumes you have read the earlier chapters on faithfulness and claim-level scoring. You should be able to split an answer into claims and check each one against a context. You should also be comfortable reading short Python functions.
Why faithfulness does not cover citations
Claim-level faithfulness asks whether the retrieved context as a whole supports each claim. Citation accuracy asks a narrower question. Does the passage the answer points to support the claim it is attached to?
An answer can be fully faithful and still cite badly. Suppose the context holds three passages and every claim is supported by some passage. If the answer attaches [3] to a claim that only passage 1 supports, faithfulness is perfect and the citation is wrong. A user who clicks [3] to verify the claim finds nothing, and trust drops.
The reverse also happens. A claim can be cited to a passage that really says it, while the claim is wrong in the real world. That case belongs to correctness, not citation accuracy. Citation accuracy is about the link between a claim and its source, not about whether the claim is true.
What can go wrong
Citation errors fall into a few distinct kinds. Keeping them separate makes the metrics easier to interpret.
| Error | Description | Typical cause |
|---|---|---|
| Phantom citation | The cited ID does not exist among the retrieved passages. | The model invents or mis-numbers references. |
| Unsupportive citation | The passage exists but does not support the claim. | The model cites a topically related passage, or an off-by-one index. |
| Partial support | The passage supports part of the claim but not all of it. | A claim merges facts from several places, or adds a detail. |
| Missing citation | A claim that needs a source has none. | The prompt does not require citations for every statement. |
| Over-citation | A claim has many citations and only some support it. | The model hedges by citing everything nearby. |
Phantom and unsupportive citations hurt precision. Missing citations hurt recall. Over-citation sits in between: it lowers precision but may keep recall high.
Two metrics: citation precision and citation recall
These names come from the same logic as precision and recall in retrieval, but the unit being counted is different.
- Citation precision is the fraction of citations that support the claim they are attached to. Count every (claim, cited passage) pair.
- Citation recall is the fraction of claims that have at least one supporting citation. Count claims.
A system that cites nothing has undefined precision and zero recall. A system that cites every passage on every claim has high recall and low precision. Report both. A single number hides which direction the system is failing in.
For recall, decide which claims need a citation. Some claims, such as a greeting or a restatement of the question, do not. A simple rule is to count only claims that the context supports, since those are the ones a good answer could cite. Whichever rule you pick, state it in your report.
The checking procedure
The check for each claim has a fixed order.
The existence check is cheap and deterministic, so run it in code, not with a model. Only the support check needs a verifier, which can be an NLI model or an LLM judge. It is the same kind of function you passed to faithfulness_score, except that the context it sees is a single cited passage and not the whole retrieved set.
Implementation
The function below takes claims with their cited IDs and a dictionary of retrieved passages. It returns precision, recall, and a count of phantom citations. The verifier is passed in, so you can replace the toy judge with a real one.
def citation_scores(claims, passages, is_supported):
"""Score citations for one answer.
claims: list of dicts like {"text": str, "cites": [passage ids]}.
passages: dict mapping passage id -> passage text (what was retrieved).
is_supported: function (claim_text, passage_text) -> bool.
"""
total_cites = 0
good_cites = 0
phantom = 0
claims_with_support = 0
for claim in claims:
has_support = False
for pid in claim["cites"]:
total_cites += 1
if pid not in passages:
phantom += 1
continue
if is_supported(claim["text"], passages[pid]):
good_cites += 1
has_support = True
if has_support:
claims_with_support += 1
precision = good_cites / total_cites if total_cites else None
recall = claims_with_support / len(claims) if claims else None
return {
"precision": precision,
"recall": recall,
"phantom": phantom,
"citations": total_cites,
}
# Toy judge for illustration only: exact substring match.
def toy_judge(claim_text, passage_text):
return claim_text.lower() in passage_text.lower()
passages = {
"p1": "The warranty lasts 24 months.",
"p2": "It covers manufacturing defects.",
"p3": "Shipping is free over 50 dollars.",
}
claims = [
{"text": "the warranty lasts 24 months", "cites": ["p1"]},
{"text": "it covers manufacturing defects", "cites": ["p3"]},
{"text": "shipping is free over 50 dollars", "cites": ["p3", "p9"]},
{"text": "returns take 30 days", "cites": []},
]
print(citation_scores(claims, passages, toy_judge))The output is {'precision': 0.5, 'recall': 0.5, 'phantom': 1, 'citations': 4}. Of four citations, two support their claims. One points at the wrong passage (p3 for the defects claim), and one points at p9, which was never retrieved. Of four claims, two have a supporting citation. The last claim has no citation at all.
Notice that the second claim is supported by p2, which is in the context. Faithfulness would score it as supported. Citation accuracy catches that the answer pointed the reader to the wrong place.
Edge cases that change the numbers
Claims that need several passages
Some claims combine facts: "The warranty lasts 24 months and covers manufacturing defects" needs p1 and p2 together. Checking each cited passage on its own would mark both as unsupportive. Two fixes are common:
- Split the claim into atomic claims first, which your claim extractor should already do.
- Check the claim against the concatenation of all its cited passages for recall, and use a leave-one-out check for precision. A citation counts as useful if removing it makes the support check fail.
Pick one approach and keep it fixed across runs. Changing it between runs changes the scores without any change in the system.
Partial support
A passage that says "24 months" does not support "24 months, including accidental damage." A binary judge may accept this because most of the claim is present. Ask the judge to answer "fully supported" only when every detail in the claim appears in the passage. Spot-check borderline cases by hand, because this is where judges are most lenient.
Citation granularity
Cite at the chunk or sentence level, not at the document level. A citation to a 40-page PDF is almost always "supported" by something inside it, and it is useless for verification. If your system cites whole documents, your precision will look good and tell you little.
Index shifts
Phantom and unsupportive citations often come from numbering. The prompt shows passages as [1] to [5], but the pipeline later reorders or drops some. Before blaming the model, confirm that the IDs in the prompt match the IDs in your evaluation record.
Using citation scores in diagnosis
Citation metrics help locate faults alongside the retrieval and faithfulness numbers.
- High faithfulness, low citation precision: the generator uses the right information but labels it wrongly. Look at the prompt format and the ID scheme.
- Low faithfulness, high citation precision on the claims that are cited: the model cites accurately when it cites, but adds unsupported statements without citations. Tighten the instruction to cite every factual claim.
- Many phantom citations: the model is producing reference numbers without grounding them in the provided list. Use structured output that restricts IDs to the retrieved set.
Report citation accuracy with a confidence interval, as with any per-question metric. Compute per-answer precision and recall, then bootstrap over questions. Answers with no citations have undefined precision, so exclude them from the precision average and say how many you excluded.
Validate the support check
The support verifier is a judge, so it needs the same validation as any other. Sample 50 to 100 (claim, passage) pairs, label them by hand as supports or not, and compare with the verifier's outputs. Include pairs of these kinds:
- Passages that are on the same topic but do not state the claim.
- Passages that contradict the claim.
- Passages that support the claim only in part.
If the verifier agrees with the human labels less often on these hard pairs than on easy ones, your precision numbers are optimistic.
Exercise
An answer has three claims. Claim A cites [1] and [2], and only [1] supports it. Claim B cites [4], but only passages 1 to 3 were retrieved. Claim C has no citation, although passage 3 supports it. Compute citation precision and citation recall, using the definitions in this chapter. Then say which error kinds are present.
Show answer
There are 4 citations: A[1] supports, A[2] does not, B[4] is a phantom, and C has none. Precision is 1/3, since there are 3 citations in total (A[1], A[2], B[4]), of which 1 supports. Recall is 1/3, because only claim A has a supporting citation out of 3 claims. The errors are an unsupportive citation (A[2], also an example of over-citation), a phantom citation (B[4]), and a missing citation (C).