Why citations matter beyond cosmetics
An answer without a citation is unverifiable. Users (and you, debugging) need to click through to the source chunk to confirm the model did not invent details. Citations also act as a forcing function — models hallucinate less when prompted to cite.
Two citation styles
- Inline numeric (Wikipedia-style). Easy for the model to produce, easy to render.
'... was released in 2024 [3].' - Inline link. Render the source title or URL inline. Heavier visually but clickable.
The citation contract
Tell the model exactly what citation format you expect, and refuse to render an answer that breaks it. A regex that finds [\d+] tokens and confirms each has a matching candidate is enough to catch most hallucinated citations.