Locate whether a failure comes from retrieval, generation, or unsupported citation.
Section 3.1 1 of 7
Overview
Focus
Locate whether a failure comes from retrieval, generation, or unsupported citation.
Your route through the lesson
3.2 Relevant-item labels and retrieval metrics
3.3 Claim support and citation validation
3.4 Answerable questions, abstention, and evaluation
3.5 Put it into practice
3.6 Guided comparison
3.7 A correct guess with missing source evidence
All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.
Section 3.2 2 of 7
Relevant-item labels and retrieval metrics
Focus
Calculate retrieval recall using explicit relevant-item labels and a stated cutoff.
Evaluation starts with a fixed query set and checked relevance labels. A relevant passage contains evidence needed for the question, not merely similar words. For “How do contractors reset access?”, the staff self-service rule is related but not sufficient; the contractor-support rule is relevant. Keep source revisions with labels so later edits do not silently change the expected evidence.
Recall at a cutoff is the fraction of all labeled relevant items retrieved within that many results. Suppose a question has two relevant passages, A and C. The first three retrieved items are A, B, D. One of two relevant passages is present, so recall at three is 1/2 = 0.5. Precision at three is the relevant fraction of retrieved items: 1/3. The denominators answer different questions.
A larger cutoff often raises recall while increasing context size and noise. Report the cutoff, corpus, query count, and labeling rule alongside a score. For a query with no relevant source, recall’s denominator is zero; handle that case separately as an unanswerable question rather than assigning a misleading perfect score.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.3 3 of 7
Claim support and citation validation
Focus
Check a citation’s identity and whether its text supports each material claim.
A citation has two jobs: identify an actual source and support a claim. Finding a real source identifier satisfies only the first. Suppose passage P says “Standard requests are processed within two business days.” The answer “All requests finish within two calendar days [P]” changes both scope and time unit. The citation exists, but its text does not support the claim.
Break an answer into material claims: statements that affect the user’s decision. For each, record the cited passage and check subject, condition, quantity, date, and exceptions. An answer can correctly cite one sentence while leaving another unsupported. Citation coverage is the fraction of material claims that have citations; support checking asks whether those citations actually justify them.
Automated checks can verify identifier existence, source revision, exact quoted spans, and whether the citation belongs to the allowed retrieved context. These are valuable deterministic guards. General paraphrase support still requires a carefully defined evaluation rubric or a separately evaluated judge. A substring test in the lab proves only its narrow exact-evidence contract, not complete understanding of natural-language entailment.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.4 4 of 7
Answerable questions, abstention, and evaluation
Focus
Score answers, abstentions, and component failures with a fixed rubric.
A grounded answer uses available authorized evidence. An appropriate abstention states that those sources do not establish an answer. Abstention is useful when a requested policy is absent, the necessary source is restricted, or two current sources disagree. It should be specific enough to help the user understand the limit without revealing restricted details.
Define the rubric before comparing systems. For an answerable case, require the correct conclusion and support for each material factual claim. For an unanswerable case, require an explicit limitation and no invented fact. A correct guess without source evidence fails grounding even if its conclusion happens to match reality.
Diagnose the pipeline. If the relevant source exists but is not retrieved, record a retrieval failure. If it is retrieved and the answer misreads it, record a generation failure. If the answer supplies an absent or mismatched citation, record a citation failure. More than one category can apply. Keep these counts separate from authorization violations, which must be visible even when an answer sounds correct. This decomposition shows which component to improve rather than rewarding a lucky final sentence.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.5 5 of 7
Put it into practice
Focus
Run fixed retrieval and exact-evidence checks and classify the resulting failures.
Save week07.py in your exercise folder and run python week07.py --lesson 3. The fixed fixtures include an answerable access question, an exact-code question, and a question absent from the corpus. The script prints recall and citation checks separately. Its answer generator is a deterministic fixture; passing it does not mean a real language model has been evaluated.
Python sets store unique identifiers. The ampersand computes their intersection: the items present in both sets. len counts those items. This complete calculation reproduces a retrieval metric:
The lab also rejects a fabricated source identifier and an unsupported exact quote. Inspect which guard failed. A missing identifier is a citation-identity problem; an absent relevant passage is retrieval loss. The unanswerable fixture must abstain. Optional written observations are ungraded, and the executable checks supply their own expected values and assertions. Keep the fixtures unchanged when comparing a new encoder so improvements remain comparable.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.6 6 of 7
Guided comparison
Focus
Use a completed report to select a component-specific improvement.
A completed three-case report contains these results. The access query retrieves its only relevant passage and answers with a supported citation. The product-code query retrieves one of two relevant passages and gives a supported partial answer. The retention query has no relevant source and appropriately abstains. The first recall is 1; the second is 0.5; the third is scored under abstention, not recall.
The mean recall over the two answerable cases is (1 + 0.5) / 2 = 0.75. Both factual answers may pass their claim-support checks, yet the product response can still fail a completeness requirement. Evaluation must say whether a partial answer counts and why. A system that retrieves every passage can have high recall while answering incorrectly; a system that guesses correctly can have poor grounding.
The next improvement is targeted: investigate candidate selection for the second relevant product passage while preserving correct abstention on missing evidence. Merely asking the generator to “be accurate” does not fix a passage it never sees. Conversely, increasing retrieval limits does not repair a generator that contradicts evidence already present.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.7 7 of 7
A correct guess with missing source evidence
Focus
Distinguish an accurate guess from an evidence-backed answer in a policy case.
A user asks whether deleted backups remain recoverable for seven days. The assistant’s authorized corpus contains no backup-retention policy. It answers “Yes, seven days,” which happens to match the organization’s actual rule. The factual conclusion is lucky, but the system cannot substantiate it from the evidence it was allowed to use.
A completed grounded response instead says that the available policy sources do not establish the recovery window and identifies the appropriate policy owner or source needed. If a current authorized backup policy is later added, the system can retrieve it, verify the seven-day condition and exceptions, and give a supported answer. That is a new evidence state, not retroactive justification for the earlier guess.
This matters in engineering reports. Mark the first response as factually matching but unsupported, and the second as appropriate abstention. If a business requirement demands supported answers, the guess fails. Keeping both labels prevents an apparent accuracy gain from concealing missing retrieval coverage. It also makes improvement concrete: obtain the missing authorized document, index its revision and source span, and rerun the frozen case.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Your personal notes
Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.
Optional public reference; internet, no account. Its model-based evaluator examples require packages, a model, and sometimes dataset downloads; those executions are outside the core lab.
Ask your own AI assistant
Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.