RAG & Retrieval · Ground answers in evidence

How do you generate reliable citations?

MediumcitationsgroundinguxUpdated Oct 2026
Quiz this track

Short answer

Have the model cite stable passage IDs, then map those IDs to human-readable sources in code. Validate the mapping and show enough context for the user to verify the claim.

Asking a model to produce a URL or page number invites invention. A safer pattern is to give every packed passage a short ID, have the model cite the ID, and let the application render the real title, URL and page. The model never needs to know the final display format.

  • Assign IDs at packing time and keep an ID-to-source map.
  • Validate that each cited ID was actually in the prompt.
  • Render citations next to the sentence they support, not only at the end.
  • Link to the exact page or anchor when the source supports it.
A citation can exist and still not support the claim. Spot-check alignment, especially for multi-sentence answers.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1How would you handle an answer that cites the same passage for every claim?
  2. 2What would you show when the source is behind a login?
  3. 3How do you evaluate citation quality at scale?

Say it in the interview

I do not let the model construct URLs. Each packed passage gets a short ID, the model cites the ID, and my code maps that to the real title, link and page. I validate that every cited ID was actually supplied. Then I render the citation next to the sentence it supports, so the user can check the claim directly. Existence of a citation is not enough; it also has to support what was said.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live RAG & Retrieval mock interview and get scored feedback on depth, clarity and confidence.