Independent technical demonstration · synthetic data

RAG Citation Reliability: Reranking & Context Packing

A RAG assistant retrieves the relevant passage but attributes its answer to the wrong document after reranking.

Before · Citation provenance pass rate0%
After · Citation provenance pass rate100%

These results were measured only on 3 controlled passage groups. They are not client results, live production improvements, or evidence of a formal security audit.

Reproduced root cause

Citation labels were assigned in sorted order while their source lookup was created using the original candidate order. Raw character truncation could split a passage.

Focused correction

Create source/citation bindings after reranking and pack complete chunks within the context budget. Test citation provenance and expected evidence presence.

Regression evidence

5 tests: original bug; source bindings; whole chunks; deterministic order; low-budget behavior.

All listed tests executed and passed on November 12, 2026. Source fixtures, baseline code, corrected code, and test scripts are available in the downloadable project package.

Limits and responsible interpretation

This tests mapping and assembly, not whether generated answers are semantically true. No model call is involved.

Download runnable code and testsBack to portfolio