Knowing If It WorksLesson 46 of 76

Contents

Knowing If It Works

Lesson 46 of 76. Sign in to keep your place.

Module 5 · Automating judgement

Checking an answer against the passages it was given

9 min read

The one check that runs on live traffic

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.

That property makes it the most valuable automatic check a retrieval system can have, and it is worth building carefully.

The pipeline

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.

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.

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:

Python
from transformers import pipeline
nli = pipeline("text-classification", model="cross-encoder/nli-deberta-v3-base")
nli(f"{passage}</s></s>{claim}")     # entailment / contradiction / neutral

Threshold the entailment probability, and calibrate that threshold against your own labelled examples rather than accepting the default.

Free checks that come first

Before any model runs, three deterministic tests catch the most damaging errors:

  • Quoted text must appear verbatim in the source. A quotation the model composed is the clearest possible failure and a string search finds it.
  • Numbers and dates in the answer must appear in the source, allowing for formatting. The same regex as in the summarisation lesson.
  • 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.

Measure the checker itself

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 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.

Re-measure after any change to the chunking, the retriever, the answer format, or the NLI model. The calibration lesson’s discipline applies unchanged.

What entailment models cannot do

Three limits, each with a workaround:

  • 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.
  • 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.
  • 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.

Aggregating claims into an answer-level number

Claim-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.

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.

Grounded is not true

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.

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.

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.

Every lesson here is open. Your progress is recorded once you pass the Shipping It exam.

Check your understanding

A retrieval assistant scores 99% groundedness in production, yet users report incorrect refund deadlines. What is the most likely explanation?

Pick the one you would defend. Your answer stays private.

Next lesson · 9 minWhat judging costs, and how to pay a tenth of it

Stuck on something?Ask Sayali, your AI tutor

How to 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).