How to Verify RAG Citations: Exact Quotes, Spans and Unsupported Claims
Generative AI course · Build with Gen AI (APIs, RAG) · Estimated reading time: 22 minutes, plus the lab
Your chatbot says, “Reference books can be borrowed,” and attaches a real library-policy citation. You open the cited chunk. It says, “Reference books cannot be borrowed.” The source exists. The citation looks professional. The answer is still wrong. Today we will stop treating a source badge as a correctness badge.
The RAG chapter checks numbers against cited pages. The evaluation chapter compares retrieval, format and quality across versions. This lesson adds a narrower skill: tie each proposed claim to an exact retrieved passage, check its location mechanically, and separately decide whether that passage actually supports the claim.
What you will learn in this chapter
- You will distinguish provenance, quote integrity, support and truth.
- You will attach a chunk ID, version and exact source span to an evidence excerpt.
- You will catch invented quotations, wrong offsets and stale versions in Python.
- You will recognise negation, swapped relationships and cherry-picked quotations that simple number checks miss.
- You will practise refusing an unsupported answer without pretending that every rejected paraphrase is false.
Everything in this chapter is made up for learning
Synthetic classroom data only. Sahyadri Reading Club, its lending rules and every proposed answer below are fictional. The “replies” are hand typed, not outputs from any model. The offline lab uses Python's standard library, no API keys, no downloads, no real resumes or customer records, and no network calls. A passing span check never proves truth.
1. Four questions hidden inside one citation
| Layer | What we can check | What it does not prove |
|---|---|---|
| Provenance | Was this chunk really retrieved for this request? | It may be the wrong chunk or an untrusted source. |
| Quote integrity | Does the quotation exactly match the stored text at the stated offsets? | A real quote can be irrelevant or taken out of context. |
| Claim support, or entailment | Does that passage support the whole claim, including exceptions and conditions? | A supported claim can still come from an outdated or false source. |
| External truth and authority | Is the source current, reliable and applicable to this user's question? | A citation alone cannot establish this. Check ownership, dates and conflicting evidence. |
Do not combine these into a single green tick called “verified.” Name the result honestly. “Span verified” means only that the pointer and copied text agree. “Supported by this policy” needs a separate meaning check. “Correct for this person now” needs the policy's scope and currency as well.
2. A real ID and matching numbers can both mislead
Our fictional source club-loan / v2 contains two sentences:
Members may borrow 2 books for 7 days. Reference books cannot be borrowed.
| Proposed claim | Human label | Why |
|---|---|---|
| Members may borrow 2 books for 7 days. | Supported within the stated scope. | The first sentence says this. Keep the reference-book exception visible. |
| Members may borrow 7 books for 2 days. | Unsupported. | Both numbers occur, but their relationships are reversed. |
| Reference books can be borrowed. | Contradicted. | The proposal drops “cannot.” No number check catches that. |
| Members can renew a loan twice. | Insufficient evidence. | Nothing in this chunk covers renewals. |
| You can take two books home for one week. | A plausible paraphrase requiring scope review. | The meaning may fit ordinary loans, but the exact-copy lab deliberately will not approve paraphrases automatically. |
This is why “every number appears somewhere in the retrieved text” is only a smoke test. It cannot check who may do what, whether a rule is negated, which date applies or whether “up to” became “exactly.” Keep that earlier check, but do not let it certify a claim.
Ravindra Bagale's Tip
When a student shows me a citation badge, I ask one more question: “Show me the sentence that supports your whole claim.” A source name is the beginning of checking, not the end.
Ravindra Bagale's Tip – मराठी
Student citation दाखवतो तेव्हा मी अजून एक प्रश्न विचारतो: “तुझं पूर्ण उत्तर बरोबर ठरवणारं वाक्य दाखव.” फक्त source चं नाव दिसलं म्हणजे तपासणी संपली असं नाही; ती तिथून सुरू होते.
Ravindra Bagale's Tip – हिंदी
Student citation दिखाता है तो मैं एक सवाल और पूछता हूँ: “तुम्हारे पूरे दावे को सही साबित करने वाला वाक्य दिखाओ.” सिर्फ source का नाम दिखना जाँच का अंत नहीं, शुरुआत है.
3. Build an evidence contract before the answer
Keep the retrieved snapshot in application code. Assign each chunk an ID and a version. The model must not invent the registry, supply a new source URL or decide that an unprovided file counts as retrieved. Our small contract has a status and a list of claims. Each claim has one exact excerpt and its source coordinates:
{
"status": "evidence",
"claims": [{
"text": "Members",
"citation": {
"chunk_id": "club-loan", "version": "v2",
"start": 0, "end": 7, "quote": "Members"
}
}]
}
This tiny example demonstrates coordinates, not a useful answer: the word “Members” does not answer a lending question. Python's slice text[0:7] includes position 0 and stops before position 7. The exercise compares that slice with the quote. It rejects negative offsets, out-of-bounds spans, floats and booleans; True must not accidentally count as integer 1.
Our offsets count Python Unicode code points in the exact retrieved string. They are not UTF-8 byte positions or JavaScript UTF-16 positions. Marathi marks and other Unicode sequences make this distinction important. Do not normalise whitespace, perform OCR cleanup or convert line endings after computing the offsets. If you need a cleaned representation, preserve a mapping back to the original and test it. Production systems should also bind versions to immutable snapshots or hashes; our short version labels are only a teaching convention.
4. Check the passage, then check the meaning
- Check the response shape and size. Reject missing fields, extra fields, duplicate JSON keys and wrong types.
- Resolve the chunk ID only inside this request's retrieved snapshot. Check its version before touching a span.
- Check the start and end bounds, then require the source slice to equal the proposed quote exactly.
- For a free-form claim, review whether the quote entails the entire claim. Check subject, action, negation, quantity, time, location and exceptions. Do not use matching words as a substitute.
- When multiple facts need multiple passages, attach evidence to each fact. A citation after a paragraph does not automatically support every sentence in the paragraph.
- If support is absent, refuse that part. If the source is conflicting or stale, say so and ask the document owner. Do not turn “I found nothing” into “the policy forbids it.”
A model-based reviewer can help screen paraphrases, but it can also misunderstand context or obey an instruction planted in evidence. Compare its decisions with human-labelled supported, contradicted and insufficient examples. For a consequential answer, an accountable reviewer still checks the original. This lab avoids pretending to solve entailment: it accepts only text that is identical to the excerpt, labels the result for review, and renders the full retrieved context alongside it.
5. The cherry-picking trap: a real quote can fail the question
Our second synthetic chunk says, “The reading room opens on Saturday. It is closed on Sunday.” A proposal quotes just “Sunday.” That word really is at the cited span. The span check passes. But it does not support the answer “The room opens on Sunday.” Even a perfect exact-quote checker cannot decide what the user meant from the presence of one word.
Keep the neighbouring sentence visible, and test questions with exceptions and negative statements. For display, our renderer never accepts a separate unchecked answer. It shows only the checked excerpt, its ID and span, the full chunk, and a warning that meaning and freshness still need review. For malformed or unsupported proposals, it displays a fixed abstention instead of echoing the rejected claim. In a real product, also enforce user access before retrieval and before opening a source; a citation is not permission to reveal a document.
Ravindra Bagale's Tip
In an interview, say, “I validate the source span in code, but I review whether it supports the claim separately.” Do not say your substring check understands meaning. That honest boundary makes your design stronger.
Ravindra Bagale's Tip – मराठी
Interview मध्ये असं सांगा: “मी code मध्ये source चा span तपासतो, पण तो पूर्ण दाव्याला आधार देतो का हे वेगळं तपासतो.” Substring check ला अर्थ समजतो असा दावा करू नका. ही मर्यादा स्पष्ट सांगितली तर तुमचं design जास्त भक्कम होतं.
Ravindra Bagale's Tip – हिंदी
Interview में बोलो: “मैं code में source span जाँचता हूँ, लेकिन वह पूरे दावे को support करता है या नहीं, यह अलग से जाँचता हूँ.” Substring check को अर्थ समझ आता है ऐसा दावा मत करो. यह सीमा साफ बताने से तुम्हारा design मजबूत होता है.
6. What current provider documentation actually offers
Official documentation was opened and rechecked on 16 November 2026 (IST). These are specific interface facts, not a ranking of models or a guarantee of correctness.
- Anthropic's citations documentation describes document citations with source locations. Plain-text citations use zero-based character ranges with an exclusive end; PDFs use page ranges; custom-content documents use content-block ranges. The documentation says its citation feature provides valid pointers to supplied documents and extracts cited text directly. That is a useful provenance advantage, not proof that every surrounding claim is true. It also states that native citations and structured outputs are incompatible. Our JSON contract is a provider-neutral classroom exercise, not an instruction to combine those two API features.
- Amazon Bedrock's RetrieveAndGenerate documentation describes generated response parts associated with retrieved references, including chunk content, metadata and source locations. It also warns that guardrails apply to the input and generated response, not to retrieved Knowledge Base references at runtime. Keep treating retrieved text as evidence to inspect, not as orders or automatic truth. Streaming and non-streaming response shapes differ; use the current interface documentation rather than assuming our lab schema matches the SDK.
When adapting a provider response, map its native locations into your own immutable source snapshot and test offset conventions. Keep source positions separate from output positions: an answer span says where the citation applies in the generated answer, while a source span says where the evidence lives in the document.
7. Run the offline lab
Save the two files below in one folder. Use Python 3.9 or newer. No package installation is needed. Run python3 -B citation_guard.py, then python3 -B -m unittest -v test_citation_guard. You should see 42 tests pass. No internet and no API key are required. Checks are fail-closed on bad types. Every candidate is handwritten. No AI call is made.
Demo output (synthetic)
exact excerpt: SPAN VERIFIED; SEMANTIC REVIEW REQUIRED
right id, false claim: REJECTED: paraphrase requires semantic review; do not display it
invented quote: REJECTED: quote does not equal the cited span
stale version: REJECTED: citation version mismatch
unsupported question: ABSTAIN
cherry-picked excerpt: SPAN VERIFIED; SEMANTIC REVIEW REQUIRED
The cherry-picked quote is real text, not a supported answer about opening days.
Test runner tail
Ran 42 tests in 0.003s
OK
Read that result carefully. The guard blocks paraphrases because this particular contract is extractive, not because every paraphrase is wrong. The deliberately cherry-picked word passes the mechanical check and still needs review. Forty-two passing tests mean that these code behaviours matched their expected labels; they do not mean forty-two real AI answers were faithful.
citation_guard.py
"""Offline synthetic citation exercise. No AI, network, keys or private data.
Verifies exact spans, NOT entailment or truth. Only extractive candidates are
rendered, with surrounding chunk text and a mandatory review label.
Python indices here count Unicode code points, not bytes or UTF-16 units.
"""
import html
import json
from dataclasses import dataclass
class Rejected(ValueError):
"""Fail closed: do not display the proposed answer."""
@dataclass(frozen=True)
class Chunk:
version: str
text: str
RETRIEVED = {
"club-loan": Chunk("v2", "Members may borrow 2 books for 7 days. Reference books cannot be borrowed."),
"club-hours": Chunk("v1", "The reading room opens on Saturday. It is closed on Sunday."),
"club-mr": Chunk("v1", "वाचन कक्ष रविवारी बंद असतो."),
}
REFUSAL = "I cannot support an answer from the retrieved evidence. Please ask the document owner."
def _text(value, maximum=600):
return type(value) is str and bool(value.strip()) and len(value) <= maximum
def _object(pairs):
result = {}
for key, value in pairs:
if key in result:
raise Rejected("duplicate JSON key")
result[key] = value
return result
def _constant(value):
raise Rejected("non-finite JSON constant")
def validate(raw, retrieved):
"""Return checked extractive candidates. Passing is NOT permission to publish.
Contract: {status: evidence|insufficient, claims: [{text, citation: {
chunk_id, version, start, end, quote}}]}. End is exclusive, start is zero-based.
'text' must equal 'quote'; paraphrases always require a separate human review.
No free-form answer field is accepted. All proposals are hand typed in this lab.
"""
if type(retrieved) is not dict:
raise Rejected("retrieved must be the app's chunk dictionary")
for key, chunk in retrieved.items():
if not _text(key, 100) or type(chunk) is not Chunk:
raise Rejected("bad retrieved chunk")
if not _text(chunk.version, 100) or not _text(chunk.text, 5000):
raise Rejected("bad retrieved snapshot")
if type(raw) is not str or not 1 <= len(raw) <= 16000:
raise Rejected("reply must be bounded JSON text")
try:
data = json.loads(raw, object_pairs_hook=_object, parse_constant=_constant)
except Rejected:
raise
except (ValueError, RecursionError):
raise Rejected("invalid JSON") from None
if type(data) is not dict or set(data) != {"status", "claims"}:
raise Rejected("wrong reply keys")
if type(data["status"]) is not str or data["status"] not in {"evidence", "insufficient"}:
raise Rejected("unknown status")
claims = data["claims"]
if type(claims) is not list or len(claims) > 8:
raise Rejected("claims must be a bounded list")
if data["status"] == "insufficient":
if claims:
raise Rejected("insufficient evidence must not include claims")
return ()
if not claims:
raise Rejected("evidence status needs a citation")
checked = []
for claim in claims:
if type(claim) is not dict or set(claim) != {"text", "citation"}:
raise Rejected("wrong claim keys")
text, cite = claim["text"], claim["citation"]
if not _text(text):
raise Rejected("empty or oversized claim")
keys = {"chunk_id", "version", "start", "end", "quote"}
if type(cite) is not dict or set(cite) != keys:
raise Rejected("wrong citation keys")
cid, version, start, end, quote = (cite[k] for k in
("chunk_id", "version", "start", "end", "quote"))
if not _text(cid, 100) or cid not in retrieved:
raise Rejected("citation was not retrieved")
chunk = retrieved[cid]
if not _text(version, 100) or version != chunk.version:
raise Rejected("citation version mismatch")
if type(start) is not int or type(end) is not int:
raise Rejected("offsets must be integers, never booleans")
if not 0 <= start < end <= len(chunk.text):
raise Rejected("span out of bounds")
if not _text(quote) or chunk.text[start:end] != quote:
raise Rejected("quote does not equal the cited span")
if text != quote:
raise Rejected("paraphrase requires semantic review; do not display it")
checked.append((cid, chunk.version, start, end, quote, chunk.text))
return tuple(checked)
def render(raw, retrieved):
"""Validate internally. Never accept unchecked tuples or a model-provided URL."""
try:
checked = validate(raw, retrieved)
except Rejected:
return "<p>" + html.escape(REFUSAL) + "</p>"
if not checked:
return "<p>" + html.escape(REFUSAL) + "</p>"
output = ["<p>SPAN-VERIFIED EXCERPTS — review meaning, scope and source freshness. Not proof of truth.</p>"]
for cid, version, start, end, quote, context in checked:
output.append("<section><h3>" + html.escape(cid + " / " + version) + "</h3>"
+ "<blockquote>" + html.escape(quote) + "</blockquote>"
+ f"<p>Python character span [{start}, {end}).</p>"
+ "<p>Full retrieved context: " + html.escape(context) + "</p></section>")
return "".join(output)
def proposal(text=None, chunk_id="club-loan", start=0, end=None, version=None):
"""Build hand-typed examples only. Not an AI model or a production API adapter."""
chunk = RETRIEVED[chunk_id]
end = len(chunk.text) if end is None else end
quote = chunk.text[start:end]
return {"status": "evidence", "claims": [{"text": quote if text is None else text,
"citation": {"chunk_id": chunk_id, "version": version or chunk.version,
"start": start, "end": end, "quote": quote}}]}
if __name__ == "__main__":
examples = [
("exact excerpt", proposal()),
("right id, false claim", proposal("Members may borrow reference books.")),
("invented quote", proposal()),
("stale version", proposal(version="v0")),
("unsupported question", {"status": "insufficient", "claims": []}),
("cherry-picked excerpt", proposal(chunk_id="club-hours", start=RETRIEVED["club-hours"].text.index("Sunday"), end=RETRIEVED["club-hours"].text.index("Sunday")+6)),
]
examples[2][1]["claims"][0]["citation"]["quote"] = "All books are free."
for label, example in examples:
raw = json.dumps(example, ensure_ascii=False)
try:
checked = validate(raw, RETRIEVED)
status = "SPAN VERIFIED; SEMANTIC REVIEW REQUIRED" if checked else "ABSTAIN"
except Rejected as exc:
status = "REJECTED: " + str(exc)
print(label + ": " + status)
print("The cherry-picked quote is real text, not a supported answer about opening days.")
test_citation_guard.py
"""Synthetic labeled examples. No real model, documents or personal data."""
import copy
import json
import unittest
from citation_guard import Chunk, RETRIEVED, REFUSAL, Rejected, proposal, render, validate
def raw(data):
return json.dumps(data, ensure_ascii=False)
class CitationTests(unittest.TestCase):
def good(self):
return proposal()
def reject(self, data):
self.assertRaises(Rejected, validate, raw(data), RETRIEVED)
def test_exact_excerpt(self):
self.assertEqual(validate(raw(self.good()), RETRIEVED)[0][4], RETRIEVED["club-loan"].text)
def test_marathi_codepoints(self):
p = proposal(chunk_id="club-mr")
self.assertTrue(validate(raw(p), RETRIEVED))
self.assertGreater(len(RETRIEVED["club-mr"].text.encode()), len(RETRIEVED["club-mr"].text))
def test_end_exclusive(self):
p = proposal(end=7)
self.assertEqual(validate(raw(p), RETRIEVED)[0][4], "Members")
def test_right_id_wrong_meaning(self):
self.reject(proposal("Members may borrow reference books."))
def test_same_number_wrong_relationship(self):
self.reject(proposal("Members may borrow 7 books for 2 days."))
def test_unsupported_paraphrase(self):
self.reject(proposal("You can take two books home for one week."))
def test_cherry_pick_is_not_semantic_proof(self):
text = RETRIEVED["club-hours"].text
start = text.index("Sunday")
p = proposal(chunk_id="club-hours", start=start, end=start+6)
self.assertTrue(validate(raw(p), RETRIEVED))
page = render(raw(p), RETRIEVED)
self.assertIn("closed on Sunday", page)
self.assertIn("Not proof of truth", page)
def test_quote_mismatch(self):
p=self.good(); p["claims"][0]["citation"]["quote"]="Not in the source."
self.reject(p)
def test_unretrieved_source(self):
p=self.good(); p["claims"][0]["citation"]["chunk_id"]="club-private"
self.reject(p)
def test_changed_version(self):
self.reject(proposal(version="v0"))
def test_snapshot_edit_invalidates_span(self):
changed=dict(RETRIEVED); changed["club-loan"]=Chunk("v2", "A replacement rule.")
self.assertRaises(Rejected, validate, raw(self.good()), changed)
def test_negative_start(self):
p=self.good(); p["claims"][0]["citation"]["start"]=-1; self.reject(p)
def test_end_too_large(self):
p=self.good(); p["claims"][0]["citation"]["end"]=999; self.reject(p)
def test_empty_span(self):
p=self.good(); p["claims"][0]["citation"]["end"]=0; self.reject(p)
def test_reversed_span(self):
p=self.good(); p["claims"][0]["citation"].update(start=10,end=5); self.reject(p)
def test_offset_types_fail_closed(self):
for key in ("start", "end"):
for bad in (True, False, 2.0, "2", None, [], {}):
with self.subTest(key=key,bad=bad):
p=self.good(); p["claims"][0]["citation"][key]=bad; self.reject(p)
def test_nontext_fields(self):
for key in ("chunk_id", "version", "quote"):
for bad in ([], {}, None, 1, True, "", " "):
with self.subTest(key=key,bad=bad):
p=self.good(); p["claims"][0]["citation"][key]=bad; self.reject(p)
def test_claim_text_types(self):
for bad in ([], {}, 4, None, True, "", " ", "x"*601):
p=self.good(); p["claims"][0]["text"]=bad; self.reject(p)
def test_top_level_types(self):
for bad in ([], 4, None, True, "x"):
self.reject(bad)
def test_wrong_reply_keys(self):
for p in ({"status":"evidence"}, dict(self.good(), answer="extra")):
self.reject(p)
def test_wrong_claim_keys(self):
p=self.good(); p["claims"][0]["approved"]=True; self.reject(p)
def test_wrong_citation_keys(self):
p=self.good(); p["claims"][0]["citation"]["url"]="https://example.invalid"; self.reject(p)
def test_claim_container_types(self):
for bad in (None, {}, "x", [None], ["x"], [[]]):
p=self.good(); p["claims"]=bad; self.reject(p)
def test_citation_container_types(self):
for bad in (None, [], "x", 1):
p=self.good(); p["claims"][0]["citation"]=bad; self.reject(p)
def test_status_types(self):
for bad in (None, [], {}, 1, True, "supported", ""):
p=self.good(); p["status"]=bad; self.reject(p)
def test_missing_citation(self):
self.reject({"status":"evidence","claims":[]})
def test_refusal_has_no_claims(self):
p=self.good(); p["status"]="insufficient"; self.reject(p)
def test_refusal_fixed_message(self):
p={"status":"insufficient","claims":[]}
self.assertEqual(validate(raw(p), RETRIEVED), ())
self.assertIn(REFUSAL, render(raw(p), RETRIEVED))
def test_multiple_claims_all_checked(self):
p=self.good(); p["claims"].append(proposal(chunk_id="club-hours")["claims"][0])
self.assertEqual(len(validate(raw(p), RETRIEVED)), 2)
p["claims"][1]["text"]="Open on Sunday."; self.reject(p)
self.assertNotIn("Members", render(raw(p), RETRIEVED))
def test_too_many_claims(self):
p=self.good(); p["claims"]*=9; self.reject(p)
def test_duplicate_json_keys(self):
self.assertRaises(Rejected, validate, '{"status":"evidence","status":"insufficient","claims":[]}', RETRIEVED)
def test_nonfinite_json(self):
for constant in ("NaN", "Infinity", "-Infinity"):
self.assertRaises(Rejected, validate, '{"status":'+constant+',"claims":[]}', RETRIEVED)
def test_malformed_json(self):
for bad in ("", "not JSON", "{", "[] trailing"):
self.assertRaises(Rejected, validate, bad, RETRIEVED)
def test_oversized_integer_literal(self):
# Python may reject huge JSON integers before any schema check.
self.assertRaises(Rejected, validate, '{"status":'+"9"*5000+',"claims":[]}', RETRIEVED)
def test_deep_json_fails_closed(self):
self.assertRaises(Rejected, validate, "["*1500+"0"+"]"*1500, RETRIEVED)
def test_bounded_raw_types(self):
for bad in (None, {}, b"{}", "x"*16001):
self.assertRaises(Rejected, validate, bad, RETRIEVED)
def test_invalid_retrieved_snapshot(self):
for bad in (None, [], {"x":"text"}, {"x":Chunk("", "text")}, {"x":Chunk("v1", "")}):
self.assertRaises(Rejected, validate, raw(self.good()), bad)
def test_safe_rendering(self):
text='<script>alert("synthetic")</script>'
chunks={"demo":Chunk("v1",text)}
p={"status":"evidence","claims":[{"text":text,"citation":{"chunk_id":"demo","version":"v1","start":0,"end":len(text),"quote":text}}]}
page=render(raw(p), chunks)
self.assertNotIn("<script>", page)
self.assertIn("<script>", page)
def test_render_invalid_reply_abstains(self):
self.assertIn(REFUSAL, render("bad JSON", RETRIEVED))
def test_does_not_mutate_inputs(self):
p=self.good(); before=copy.deepcopy(p); chunks=copy.deepcopy(RETRIEVED)
validate(raw(p), RETRIEVED)
self.assertEqual(p,before); self.assertEqual(RETRIEVED,chunks)
def test_empty_retrieval_abstains(self):
self.assertRaises(Rejected, validate, raw(self.good()), {})
self.assertEqual(validate(raw({"status":"insufficient","claims":[]}), {}), ())
def test_whitespace_not_silently_normalized(self):
p=self.good(); p["claims"][0]["citation"]["quote"] += " "; self.reject(p)
if __name__ == "__main__":
unittest.main(verbosity=2)
8. A small citation review checklist for your project
For each factual answer, keep a table with the question, atomic claim, retrieved chunk version, exact quote, pointer result and human support label. Use synthetic cases until your data-use permissions and redaction are settled. Track these two measures separately:
- Pointer-valid fraction: valid citation locations divided by all proposed citation locations. This detects broken IDs and fabricated quotes, not meaning.
- Supported-claim fraction: claims that a reviewer marks supported divided by all factual claims in the answer. A factual claim without a citation still belongs in the denominator. Review whether support is complete, not just whether any related phrase exists.
If an answer has no factual claims, report the second measure as “not applicable,” not a perfect score. Test abstentions separately so that a bot cannot win by refusing everything. Keep answer completeness and usefulness beside support: quoting one true sentence can still fail to answer the user's question. Add the number-swap and negation cases to the golden set from the evaluation chapter.
9. Practise before you connect a real model
- Change 2 books for 7 days into 7 books for 2 days. Predict which older number-only rule misses it and which lab rule rejects it.
- Make a proposal with the right ID but
version="v0". Confirm that it is rejected. - Quote “Sunday,” then read the full reading-room chunk. Write a human label explaining why an opening-day claim would fail.
- Add a Hindi sentence to a synthetic snapshot. Test an exact code-point span and a deliberately wrong byte-based span.
- Write two valid paraphrases. Have a person label them, and explain why this extractive guard still routes them out of automatic display.
- Add an unsupported renewal question to your evaluation set. The correct action is to say that the evidence does not cover renewal, not invent a renewal limit.
Quick self-check quiz (5 questions)
Client-only quiz — not saved. Browser-only practice. Your answers are not sent anywhere, are not saved, and do not count towards any course progress or certificate.
Recap
- A real retrieved ID is provenance, not proof of support.
- An exact quote and span can catch fabrication and broken pointers.
- Meaning depends on relationships, negation, conditions and scope, not matching numbers.
- A cherry-picked real quote can still mislead. Show context and review the whole claim.
- Refuse unsupported parts, label uncertainty honestly and check source freshness before consequential use.
Continue learning
- Embeddings: similarity is not agreement.
- Build the retrieval pipeline and inspect cited pages.
- Chunk documents so each cited span keeps its whole rule.
- Add citation failures to your regression evaluation set.
- Keep retrieved text as data and enforce action boundaries.
Ravindra Bagale, trainer: linkedin.com/in/ravindra-bagale. Sahyadri Reading Club, its lending rules and every proposed answer on this page are made up / SYNTHETIC classroom material. Official interface details were checked against the linked documentation on 16 Nov 2026 (Asia/Calcutta); no provider endorsement, model-quality benchmark or guarantee of error-free RAG is claimed.