{"course":{"slug":"evaluating-ai","title":"Knowing If It Works","url":"https://addaly.com/learn/evaluating-ai","level":"intermediate","track":"build"},"lesson":{"slug":"groundedness-checks","title":"Checking an answer against the passages it was given","url":"https://addaly.com/learn/evaluating-ai/groundedness-checks","position":46,"of":76,"minutes":9,"answer":"Decompose an answer into claims and test each against the retrieved text with an entailment model, remembering that groundedness measures faithfulness to the source and never truth.","keyIdea":"Decompose an answer into claims and test each against the retrieved text with an entailment model, remembering that groundedness measures faithfulness to the source and never truth."},"body":{"format":"markdown","text":"## The one check that runs on live traffic\n\nAlmost every quality measurement needs a label. Groundedness does not: the source passages were part of the request, so you can check an answer against them at any time, including in production, on every response, with no human in the loop.\n\nThat property makes it the most valuable automatic check a retrieval system can have, and it is worth building carefully.\n\n## The pipeline\n\n**One: split the answer into claims.** One assertion each, resolved pronouns, no compound sentences. A small model does this adequately; a larger one does it well; either way, cache the result, because claims are stable across judge changes.\n\n**Two: retrieve the relevant source sentences** for each claim: usually just the passages already in the context, chunked to a few sentences, ranked by embedding or keyword similarity to the claim.\n\n**Three: classify entailment.** For each claim and its candidate support: supported, contradicted, or not enough information. A natural-language-inference cross-encoder does this well, runs on a CPU, and costs nothing per call:\n\n```python\nfrom transformers import pipeline\nnli = pipeline(\"text-classification\", model=\"cross-encoder/nli-deberta-v3-base\")\nnli(f\"{passage}</s></s>{claim}\")     # entailment / contradiction / neutral\n```\n\nThreshold the entailment probability, and calibrate that threshold against your own labelled examples rather than accepting the default.\n\n## Free checks that come first\n\nBefore any model runs, three deterministic tests catch the most damaging errors:\n\n- **Quoted text must appear verbatim** in the source. A quotation the model composed is the clearest possible failure and a string search finds it.\n- **Numbers and dates in the answer must appear in the source**, allowing for formatting. The same regex as in the summarisation lesson.\n- **Citations must resolve.** The chunk id exists, and it contains at least one content word from the claim it supports. A citation pointing at a chunk about something else is common and invisible to readers.\n\n## Measure the checker itself\n\nA groundedness detector is a classifier, and it needs the same treatment as any other. Label 200 answers by hand (supported, unsupported, partially supported) and compute the detector's **recall on unsupported claims**, which is the class you care about. Overall agreement will look high because most claims are supported, and it will tell you nothing.\n\nRe-measure after any change to the chunking, the retriever, the answer format, or the NLI model. The calibration lesson's discipline applies unchanged.\n\n## What entailment models cannot do\n\nThree limits, each with a workaround:\n\n- **Long premises.** NLI models were trained on short sentence pairs. Feeding a 3,000-token passage degrades them badly. Chunk, and check the claim against the best few chunks rather than the whole context.\n- **Arithmetic and aggregation.** \"Revenue rose 15%\" is not entailed by two revenue figures in any sense an NLI model understands. Route numeric claims to a code check that recomputes them, or to a judge with the numbers isolated.\n- **Implicature.** A source saying \"the office closes at 5\" does not literally entail \"you cannot collect at 6\", and a strict entailment check will mark a sensible answer unsupported. Decide your policy (strict entailment or reasonable inference) write it into the labelling guide, and apply it to both the humans and the model.\n\n## Aggregating claims into an answer-level number\n\nClaim-level percentages flatter the system, because most claims in any answer are uncontroversial scaffolding. Report the number a reader experiences: **the share of answers containing at least one unsupported claim**. An assistant at 98% claim support and 12% of answers carrying an unsupported claim is described honestly by the second figure and misleadingly by the first.\n\nWeight by consequence where you can. An unsupported claim about a deadline, an amount or an eligibility rule is not the same event as an unsupported claim in a closing pleasantry, and a two-tier severity marking in the claim decomposition costs one extra field.\n\n## Grounded is not true\n\nThe most important sentence in this lesson. Groundedness measures whether the answer follows from the retrieved passages. If the passage is out of date, wrong, or from a bad source, a perfectly grounded answer is false.\n\nSo groundedness pairs with two other measurements and never replaces them: source quality, which is a corpus problem (freshness, provenance, deduplication of contradictory versions) and answer correctness against reality on a labelled subset.\n\nThe failure this catches in production is a system confidently citing a superseded policy document. Groundedness will be 100%, users will be misinformed, and the only thing that finds it is a check on the corpus itself."},"check":{"question":"A retrieval assistant scores 99% groundedness in production, yet users report incorrect refund deadlines. What is the most likely explanation?","options":[{"text":"The groundedness checker has poor recall on unsupported claims, so it is missing hallucinations.","correct":false,"tempting":"Always worth verifying, but the symptom described is a consistent wrong deadline rather than scattered inventions, which points at the source rather than the detector."},{"text":"The retrieved passages include a superseded policy document, so the answers faithfully reflect a source that is wrong.","correct":true},{"text":"The entailment model is treating reasonable inferences as supported, inflating the score.","correct":false,"tempting":"An inference-policy issue would produce borderline cases, not a systematically wrong figure that users can identify."},{"text":"Groundedness was measured on claims rather than on whole answers, which overstates it.","correct":false,"tempting":"Claim-level aggregation does flatter the number, and it would not by itself cause a specific policy figure to be consistently wrong."}]},"prev":{"slug":"cheap-checks-first","title":"The checks that cost nothing and catch most of it","url":"https://addaly.com/learn/evaluating-ai/cheap-checks-first"},"next":{"slug":"judging-on-a-budget","title":"What judging costs, and how to pay a tenth of it","url":"https://addaly.com/learn/evaluating-ai/judging-on-a-budget"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Exam keys checked blind by a second model: 3,665 of 3,666 agreed. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Checking an answer against the passages it was given', in Knowing If It Works. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/evaluating-ai/groundedness-checks (Accessed: 13 October 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Checking an answer against the passages it was given","courseTitle":"Knowing If It Works","module":{"index":5,"slug":"automating-judgement","title":"Automating judgement"},"answer":null,"keyIdea":"Decompose an answer into claims and test each against the retrieved text with an entailment model, remembering that groundedness measures faithfulness to the source and never truth.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"the-one-check-that-runs-on-live-traffic","runs":[{"text":"The one check that runs on live traffic"}]},{"t":"p","runs":[{"text":"Almost every quality measurement needs a label. Groundedness does not: the source passages were part of the request, so you can check an answer against them at any time, including in production, on every response, with no human in the loop."}]},{"t":"p","runs":[{"text":"That property makes it the most valuable automatic check a retrieval system can have, and it is worth building carefully."}]},{"t":"h2","id":"the-pipeline","runs":[{"text":"The pipeline"}]},{"t":"p","runs":[{"text":"One: split the answer into claims.","b":true},{"text":" One assertion each, resolved pronouns, no compound sentences. A small model does this adequately; a larger one does it well; either way, cache the result, because claims are stable across judge changes."}]},{"t":"p","runs":[{"text":"Two: retrieve the relevant source sentences","b":true},{"text":" for each claim: usually just the passages already in the context, chunked to a few sentences, ranked by embedding or keyword similarity to the claim."}]},{"t":"p","runs":[{"text":"Three: classify entailment.","b":true},{"text":" For each claim and its candidate support: supported, contradicted, or not enough information. A natural-language-inference cross-encoder does this well, runs on a CPU, and costs nothing per call:"}]},{"t":"code","lang":"python","label":"Python","text":"from transformers import pipeline\nnli = pipeline(\"text-classification\", model=\"cross-encoder/nli-deberta-v3-base\")\nnli(f\"{passage}</s></s>{claim}\")     # entailment / contradiction / neutral"},{"t":"p","runs":[{"text":"Threshold the entailment probability, and calibrate that threshold against your own labelled examples rather than accepting the default."}]},{"t":"h2","id":"free-checks-that-come-first","runs":[{"text":"Free checks that come first"}]},{"t":"p","runs":[{"text":"Before any model runs, three deterministic tests catch the most damaging errors:"}]},{"t":"ul","items":[[{"text":"Quoted text must appear verbatim","b":true},{"text":" in the source. A quotation the model composed is the clearest possible failure and a string search finds it."}],[{"text":"Numbers and dates in the answer must appear in the source","b":true},{"text":", allowing for formatting. The same regex as in the summarisation lesson."}],[{"text":"Citations must resolve.","b":true},{"text":" The chunk id exists, and it contains at least one content word from the claim it supports. A citation pointing at a chunk about something else is common and invisible to readers."}]]},{"t":"h2","id":"measure-the-checker-itself","runs":[{"text":"Measure the checker itself"}]},{"t":"p","runs":[{"text":"A groundedness detector is a classifier, and it needs the same treatment as any other. Label 200 answers by hand (supported, unsupported, partially supported) and compute the detector’s "},{"text":"recall on unsupported claims","b":true},{"text":", which is the class you care about. Overall agreement will look high because most claims are supported, and it will tell you nothing."}]},{"t":"p","runs":[{"text":"Re-measure after any change to the chunking, the retriever, the answer format, or the NLI model. The calibration lesson’s discipline applies unchanged."}]},{"t":"h2","id":"what-entailment-models-cannot-do","runs":[{"text":"What entailment models cannot do"}]},{"t":"p","runs":[{"text":"Three limits, each with a workaround:"}]},{"t":"ul","items":[[{"text":"Long premises.","b":true},{"text":" NLI models were trained on short sentence pairs. Feeding a 3,000-token passage degrades them badly. Chunk, and check the claim against the best few chunks rather than the whole context."}],[{"text":"Arithmetic and aggregation.","b":true},{"text":" “Revenue rose 15%” is not entailed by two revenue figures in any sense an NLI model understands. Route numeric claims to a code check that recomputes them, or to a judge with the numbers isolated."}],[{"text":"Implicature.","b":true},{"text":" A source saying “the office closes at 5” does not literally entail “you cannot collect at 6”, and a strict entailment check will mark a sensible answer unsupported. Decide your policy (strict entailment or reasonable inference) write it into the labelling guide, and apply it to both the humans and the model."}]]},{"t":"h2","id":"aggregating-claims-into-an-answer-level-number","runs":[{"text":"Aggregating claims into an answer-level number"}]},{"t":"p","runs":[{"text":"Claim-level percentages flatter the system, because most claims in any answer are uncontroversial scaffolding. Report the number a reader experiences: "},{"text":"the share of answers containing at least one unsupported claim","b":true},{"text":". An assistant at 98% claim support and 12% of answers carrying an unsupported claim is described honestly by the second figure and misleadingly by the first."}]},{"t":"p","runs":[{"text":"Weight by consequence where you can. An unsupported claim about a deadline, an amount or an eligibility rule is not the same event as an unsupported claim in a closing pleasantry, and a two-tier severity marking in the claim decomposition costs one extra field."}]},{"t":"h2","id":"grounded-is-not-true","runs":[{"text":"Grounded is not true"}]},{"t":"p","runs":[{"text":"The most important sentence in this lesson. Groundedness measures whether the answer follows from the retrieved passages. If the passage is out of date, wrong, or from a bad source, a perfectly grounded answer is false."}]},{"t":"p","runs":[{"text":"So groundedness pairs with two other measurements and never replaces them: source quality, which is a corpus problem (freshness, provenance, deduplication of contradictory versions) and answer correctness against reality on a labelled subset."}]},{"t":"p","runs":[{"text":"The failure this catches in production is a system confidently citing a superseded policy document. Groundedness will be 100%, users will be misinformed, and the only thing that finds it is a check on the corpus itself."}]}],"check":{"question":[{"text":"A retrieval assistant scores 99% groundedness in production, yet users report incorrect refund deadlines. What is the most likely explanation?"}],"options":[{"text":[{"text":"The groundedness checker has poor recall on unsupported claims, so it is missing hallucinations."}],"correct":false,"tempting":[{"text":"Always worth verifying, but the symptom described is a consistent wrong deadline rather than scattered inventions, which points at the source rather than the detector."}]},{"text":[{"text":"The retrieved passages include a superseded policy document, so the answers faithfully reflect a source that is wrong."}],"correct":true,"tempting":null},{"text":[{"text":"The entailment model is treating reasonable inferences as supported, inflating the score."}],"correct":false,"tempting":[{"text":"An inference-policy issue would produce borderline cases, not a systematically wrong figure that users can identify."}]},{"text":[{"text":"Groundedness was measured on claims rather than on whole answers, which overstates it."}],"correct":false,"tempting":[{"text":"Claim-level aggregation does flatter the number, and it would not by itself cause a specific policy figure to be consistently wrong."}]}],"order":[3,2,0,1],"why":null},"prev":{"slug":"cheap-checks-first","title":"The checks that cost nothing and catch most of it","minutes":8},"next":{"slug":"judging-on-a-budget","title":"What judging costs, and how to pay a tenth of it","minutes":9}}}