“The answer sounded completely plausible – it was just wrong.” That is the core problem of any system that lets a language model phrase its answers. That's why, for me, citations in RAG systems aren't an extra feature but a requirement.
Convincing isn't the same as correct
With retrieval-augmented generation (RAG), the system first searches your own documents for relevant passages and hands them to the model as context. The model then writes an answer from them. That works well – as long as the right passages are found.
If they aren't, the model answers anyway. Same tone, same confidence. It fills the gap with what it knows from training or with what sounds statistically plausible. From the outside, you can't tell the difference.
With a source attached to every answer, you see it immediately: does the statement come from the right document, the right section? Or did the model guess?
What makes a good citation
A file name at the end of the answer isn't enough. It becomes useful only when you can verify the passage within seconds:
- Document and section – title, heading, and the page for PDFs.
- A link or a unique ID that opens the original text.
- Attribution per statement, not just a list of all sources at the end. Otherwise it stays unclear which sentence came from where.
- Honesty about gaps: if no matching source was found, the system should say so instead of answering anyway.
Technically this means: every chunk gets metadata at indexing time (document, section, page, ID), the prompt requires answers strictly from the context with references to those IDs, and the application then checks whether the cited IDs actually belong to the retrieved chunks. A cited source that wasn't in the context at all is a warning sign in itself.
The side effect: you see where retrieval fails
Perhaps the biggest benefit shows up when debugging. If an answer is wrong, I look at the sources first:
The right passage is among the sources, but the answer is still wrong: then the problem is the model or the prompt – for example because too much contradictory context was passed in.
The right passage is missing from the sources: this is the more common case. Then the problem almost always sits before the model – in chunking or in search. A stronger model won't help; it will just miss the answer more elegantly.
Common causes of poor retrieval
- Poor chunking: chunks that are too large dilute the content, chunks that are too small tear context apart. Tables and step-by-step instructions suffer most when they're cut in half.
- Missing context in the chunk: a paragraph without its heading often loses its meaning. Carrying headings or the document title into the chunk helps.
- Semantic search only: embeddings find similar meanings but struggle with exact terms – error codes, version numbers, product names. Combining full-text and vector search (hybrid search) catches those.
- Outdated documents in the index: if old and new versions of a guide sit side by side, search may well find the wrong one.
How I test a RAG system
- Build a small list of real questions with a known correct answer and a known source.
- For each question, first check: is the right passage among the retrieved chunks? Only then judge the written answer.
- Ask questions whose answer isn't in the documents. The system should recognise that instead of inventing something.
- Automatically match cited IDs against the retrieved chunks.
- After every change to chunking or search, run the same question list again.
That's why in my own RAG project, LLM-Wiki, citations have been part of every answer from the start. An answer you can't verify is, when in doubt, just a well-phrased guess.