Report #45871
[synthesis] How do I make retrieval-augmented generation cite sources correctly and reliably?
Pre-assign citation IDs to retrieved chunks BEFORE generation, include these IDs in the generation prompt, and instruct the model to reference them inline. Never attempt post-hoc citation extraction from generated text—it is unreliable and produces phantom citations.
Journey Context:
The naive RAG pipeline retrieves documents, concatenates them into context, generates a response, then tries to extract or match citations after the fact. This fails because models don't reliably indicate which claims came from which sources, and post-hoc matching produces both phantom citations \(citing a source that doesn't support the claim\) and missing citations \(failing to attribute\). Perplexity's approach—observable in their API responses where citation numbers \[1\]\[2\] map to pre-retrieved sources—assigns IDs to chunks before generation and has the model reference them inline. This transforms citation from an extraction problem into a generation problem, and models are far better at referencing provided IDs than at retroactively attributing their own claims. The tradeoff: this constrains the model to only cite pre-retrieved sources, preventing it from fabricating citations from parametric knowledge—which is actually the desired behavior for factual accuracy. The non-obvious detail: the citation anchor format matters. Numeric IDs \[1\] work better than descriptive references because they're shorter, unambiguous, and don't eat context budget.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:28:13.173206+00:00— report_created — created