RAG EngineeringIntermediate14 minModule · Generate

Grounded generation & citations

Keep answers faithful to the sources, prove it with citations, and refuse cleanly when evidence is missing.

See it on the map

Faithfulness means every claim in the answer is supported by the retrieved text. Prompting for it helps, but verify it. Ask for structured output where each claim carries the ids of the passages that support it, then check that those ids exist and that the quoted spans really appear in them.

Citation checking can run as a second pass: a smaller model judges whether each cited passage entails the claim, and unsupported claims are removed or flagged. For high-stakes domains, show the supporting quote next to the answer so the reader can check in seconds.

Design the refusal path on purpose. When retrieval returns weak results, a good system says it did not find the answer and suggests what to try, instead of improvising. Track the rate of refusals and of unsupported claims as first-class metrics.

Key points

  • Require claim-level citations in a structured format and validate them.
  • Verify that cited passages support the claim, not just that ids exist.
  • Show supporting quotes where accuracy matters.
  • Make 'I could not find that' a designed, measured outcome.

Answer these out loud

  1. 1Define a JSON output format for an answer with per-claim citations, and the checks you run on it.
  2. 2Retrieval confidence is low. Decide between answering with a caveat and refusing, and justify the threshold.

Build it

Add claim-level citations to your answer endpoint, implement a verifier that flags uncited or unsupported sentences, and measure how often it fires.

Use this from an agent

Any MCP client, including Grok, can read this lesson. See how to connect.

REST
curl https://engineeros-delta.vercel.app/api/v1/topics/rag-grounding-and-citations

This unlocks