SaveMyToken logoSaveMyToken.Coding Plan
All knowledge base guides

BEGINNER LESSON 02 OF 6

RAG Citations Need Both a Valid Source and Support for the Claim

Carry source IDs through search and generation, then validate each citation against the passage.

About 7 min to follow along · By West Mao and Alex George · Documentation reviewed 2026-10-05 · Build in your own stack · Updated

TL;DR

Keep document and passage identifiers through ingestion, retrieval and answer generation so each citation leads back to inspectable evidence. Then check that the cited passage supports the claim, using more than one question. A source link alone is insufficient: the right document can still be cited for a statement it does not support.

WHAT YOU WILL MAKE

A printer answer whose citation opens the correct source passage.

Before you start

  • The practice file and search function from lesson 1.
Previous lesson: A One-File Keyword Retriever Is Enough to Start Learning RAG

Fictional practice files. Expected answers below come from these files; actual model responses may differ.

STEP 01

Keep provenance at ingestion

OpenYour passage records

A useful record contains more than text.

  1. Store a stable document ID, version, title, source location, and passage ID with each chunk.
  2. Keep these fields attached to results returned by search.
  3. For private files, enforce the user's access scope before results reach the model.
You should see

Every result can be traced back to a specific document version.

If it does not work

If IDs change on every request, assign them during indexing instead of generation.

STEP 02

Validate a claim and citation

OpenYour answer view

The practice FAQ gives a precise printer location.

  1. Ask: "Where is the Harbor Studio printer?"
  2. Confirm the answer says second floor, beside the blue cabinet.
  3. Open the cited passage and confirm it contains both details. Reject or flag IDs that were not in the retrieved set.
Question to test
Where is the Harbor Studio printer?

You should see

The citation resolves to the printer paragraph in version 1 and supports the full claim.

If it does not work

If the wrong passage is cited, inspect the result list and the model output separately.

STEP 03

Check another fact

OpenYour evaluation notes

A single correct citation is insufficient.

  1. Repeat with the 60-minute booking question.
  2. Check that both the answer and the passage agree on the number.
  3. Record any unsupported answer as a failure even if a citation badge is present.
You should see

Both sample answers have source support.

If it does not work

Do not synthesize a source link from the model's free-form filename; use verified IDs.

CONTINUE WITH LESSON 3RAG Needs an Explicit Unknown Path for Questions Without Evidence

Add a no-evidence path and test it beside a covered question.