RAG and Knowledge Engineering
Citation and Grounding — Patterns
Citation and grounding › Patterns
Attribute after generation, with an independent checker
Problem. A model asked to cite as it writes produces markers that are part of the generated text and share its failure modes. They are usually right, occasionally invented, and the difference is invisible in the output.
Approach. Let the generator write freely, then run a separate step that, for each claim-bearing sentence, selects the supporting passages from the set actually provided and judges whether they entail the sentence. The citation shown to the reader comes from that step, not from the generator's text, and the judgement is recorded with the answer.
Trade-off. An extra pass over every answer, with latency that either delays the response or arrives after the reader has started reading. The checker also has its own errors, and a sentence it wrongly judges unsupported is a correct statement the product declines to stand behind.
Durable citation targets independent of segmentation
Problem. Citations stored in conversation history, tickets or audit records must resolve long after the corpus has been re-segmented and re-encoded several times. Pointing at a unit identifier guarantees they will not.
Approach. Make the stored citation a document identity plus a character or element range in the extracted text, with the unit identifier retained only as a hint. Resolving a citation maps the range onto whatever units currently exist, and a range that no longer exists resolves to the document with an explicit note that the passage changed. The reference survives every pipeline change that preserves the document.
Trade-off. The extracted text now has to be retained and versioned, which is a storage commitment, and a document that was genuinely rewritten will produce a resolution that is technically correct and substantively wrong. Ranges also do not survive a parser change that alters the extracted text, which is exactly the upgrade teams most want to make.
Entailment, not similarity, as the support test
Problem. The cheapest verifier compares the sentence to the passage and reports how alike they are. Topical similarity is close to maximal when a passage discusses the same subject and asserts the opposite, so the check passes precisely the errors that matter.
Approach. Frame the check as inference: does this passage, taken as a premise, support this sentence as a conclusion. Include a negation and contradiction test in the evaluation of the verifier itself, with examples drawn from your corpus where the topical overlap is high and the support is absent. Treat "the passage mentions this but does not state it" as a distinct outcome from "unsupported", because it indicates retrieval found the right area and the claim overreached.
Trade-off. Entailment judgement is more expensive and less reliable on long passages than similarity scoring, and it is strict in ways users find pedantic — a sentence that combines two clearly supported halves can be judged unsupported as a whole. Calibrating that strictness is a product decision.
Mark derived text as derived, everywhere it travels
Problem. Transcriptions, generated captions and summaries of graph regions are retrievable text that does not appear in any document. Cited like a quotation, they send a reader to a source where the sentence does not exist, which reads as a fabrication even when the underlying content is right.
Approach. Carry a provenance kind on every unit — original text, transcribed, generated — from the stage that created it through to the answer, and render citations differently by kind: derived material is attributed to the artifact and the process that produced it, and the reader is pointed at the original region rather than at a sentence. Answers may be restricted to quoting only original text.
Trade-off. Every downstream component must understand and propagate the marker, and one that drops it silently reintroduces the problem with no symptom. Distinguishing the kinds in the interface also makes the product look less authoritative than one that simply presents everything as a source.