LLMs, GenAI, RAG, agents, evaluation · insight-0614
Validate citation ids in code before showing a cited answer
- Evidence type
- empirical finding
- Difficulty
- easy
- Roles
- Applied AI, ML engineer
- Industries
- healthcare, insurance
Summary: situation, action, reason, boundary
Situation
Your RAG prompt asks the model to cite sources as [doc-id] markers.
Action
Give every context chunk a stable id, parse the citations from the output, reject or flag ids not present in the provided context, and render the cited source text next to the claim.
Reason
Citation markers are generated text like any other. Liu, Zhang and Liang found that only about three quarters of citations in audited generative search engines supported the sentence they were attached to.
Boundary
Any user-facing answer that shows sources, especially in regulated domains.
Symptom or risk
Answers cite ids that were never retrieved, cite the wrong chunk, or leave key sentences uncited, and the interface displays them as if verified.
Exceptions
Internal brainstorming tools where citations are a convenience rather than a control.
Trade-offs
An id check catches fabricated references but not misattributed ones; support still needs sampled review.
Pitfalls
Treating "has a citation" as "is grounded".
Lessons and concepts
Claims and their sources
In a human audit of four generative search engines, about 74.5% of citations supported their associated sentence and about 51.5% of generated sentences were fully supported.