Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
AI Apps

Citations in AI Answers: Showing Where Information Came From

Last updated:

An answer nobody can check is an answer nobody trusts

An operations manager asks the internal assistant how many days a supplier has to report damaged goods. It says 14. Is that from the current contract, last year's version, or a plausible number the model produced from general knowledge? Without a source, the only safe move is to go and look it up, at which point the assistant saved nothing.

Citations turn an assertion into something checkable. They are also a quality mechanism. A system that has to point to its source is harder to push into inventing things, and when it does get something wrong, the citation shows immediately whether retrieval or generation was at fault.

For assistants over internal documents, policies or regulations, we treat citations as a requirement, not a feature.

Levels of citation, from decorative to useful

LevelWhat the user seesUsefulness
Sources list'Based on: Supplier Terms.pdf, Returns Policy.docx' under the answerLow; says what was retrieved, not what was used
Document per claimA footnote after each sentence naming the documentMedium; still means reading a 40-page PDF
Passage per claimFootnote opens the exact section, highlightedHigh; checking takes seconds
Verified passage per claimAs above, and each citation checked in code before displayHighest; citations are reliable enough to rely on

A sources list is what many products ship because it is easy. It is also slightly misleading, because the model may have ignored those sources entirely and answered from memory.

How to generate citations reliably

  1. Retrieve passages and give each a short ID, such as S1 to S8, with the document title and section
  2. Instruct the model to answer only from those passages and to cite IDs for every factual claim
  3. Use structured output: a list of statements, each with its supporting source IDs and, ideally, a short quoted span
  4. Allow the model to say the sources do not contain the answer, and make that an acceptable outcome
  5. Render the statements with footnotes that open the passage at the right place

Asking for a quoted span alongside each citation is the trick that makes verification practical, because code can then check the quote exists in the cited passage. Several model providers also offer native citation features that return character offsets into supplied documents, which saves work where available.

Verifying citations before users see them

Models sometimes cite the wrong source, cite a source that only mentions the topic, or attach a real citation to an invented detail. Checking catches most of this.

  • Existence check. Every cited ID must be one that was supplied. Trivial, and it catches invented references.
  • Quote check. The quoted span must appear in the cited passage, allowing for whitespace and minor formatting differences.
  • Support check. A smaller model judges whether the passage actually supports the statement. Worth it for high-stakes content.
  • Coverage check. Flag answers where factual sentences carry no citation at all.

When a check fails, strip the unsupported statement, regenerate, or show the answer with a visible warning. What you should not do is display a citation you know is wrong. Our piece on reducing AI hallucination covers the related grounding techniques.

Interface choices that build trust

  • Show citations inline, next to the sentence they support, not in a block at the bottom
  • Open the source at the cited section with the passage highlighted
  • Show the document date or version, so users spot outdated sources
  • Distinguish clearly between 'from your documents' and anything the model adds as general explanation
  • Make 'the documents do not cover this' a normal, visible response rather than an error
The most trustworthy thing an assistant can say is: I could not find this in your documents.

Where citations are harder than they look

Some answers combine several passages, such as a policy clause plus an exception in an appendix, and deserve multiple citations per sentence. Tables and scanned PDFs need page and cell positions to be captured at indexing time, or the highlight will land in the wrong place. Answers that aggregate, like 'most of our contracts renew annually', cannot be meaningfully cited to a passage and usually belong in a database query instead.

Conflicting sources cause a subtler problem. If the handbook says one thing and a newer policy memo says another, a model will often cite both and blend them into an answer neither supports. Storing document dates and status, and telling the model which source takes precedence, avoids most of this. Where genuine conflicts remain, the honest answer is to show both and say they disagree, which is also useful feedback for whoever owns the documents.

Citations also add a little latency and output length. For a casual drafting tool that is not worth it. For compliance, legal, HR, clinical or technical support content it plainly is.

How SpiderHunts builds cited answers

When SpiderHunts builds a knowledge assistant, passage-level citations and the verification step are in the first version. We capture page numbers, headings and offsets during ingestion, which is far cheaper than retrofitting them. We also track the share of answers with fully verified citations as a standing quality metric, alongside user feedback.

If you are planning something similar, AI for internal knowledge search covers the wider design, and our AI chatbot development service builds cited assistants over your own content.

Frequently asked questions

How do I stop an AI from inventing citations?

Give it a fixed set of numbered sources, require citations to those IDs in structured output, and check in code that every cited ID exists and any quoted text appears in that passage. Discard or regenerate anything that fails.

Do citations reduce hallucination?

They help. Requiring a source for each claim discourages answers from general knowledge, and verification catches many unsupported statements. They do not remove hallucination entirely, so high-stakes content still needs a support check or human review.

Should citations link to the document or the exact passage?

The exact passage wherever possible. A link to a long document means users rarely check, which defeats the purpose. Capturing page and section positions during indexing makes passage links practical.

Can citations work with scanned PDFs?

Yes, if the OCR step keeps page numbers and text positions. Without positional data you can still cite the page, but highlighting the exact passage needs coordinates captured at ingestion.

Keep reading

Do people trust your assistant's answers?

Show us a few answers your team doubted. We will look at whether citations would help, and what it would take to make them accurate rather than decorative.

Book a free 30-minute call Get a project estimate WhatsApp us

Related services

What we build for problems like this one

AI AgentsCustom Software DevelopmentSaaS Development