Composite scenario, not a real company. Assembled from common industry patterns; every number is illustrative and its assumptions are listed at the end.
This case belongs to Evaluating AI systems.
This page is about evaluation design for an internal procedure-lookup assistant in an invented scenario. It is not medical, clinical or regulatory advice, and it is not guidance for patient care or for choosing a clinical system.
Context
- A regional hospital group gives ward and laboratory staff an assistant that answers questions about internal procedures: specimen labelling, patient-transfer paperwork, equipment cleaning logs.
- It retrieves passages from the procedure library and answers with the passage ids it used.
- It gives no diagnosis or dosing advice. Staff remain responsible for following the official procedure.
Problem statement
After launch, staff reported certain-sounding wrong answers, such as a labelling rule the library had replaced a year earlier. The only dashboard showed a mean faithfulness score of 0.93, so the assistant looked healthy. Here "hallucination" means a confident wrong answer; most were not invented text.
| Measure | Value |
|---|---|
| Human audit | 200 sampled questions |
| Confident wrong answers | 38 (19%, 95% interval 14.2% to 25.0%) |
| Target | Measure retrieval and generation separately, at most 5% confident wrong, and say "I could not find a current procedure" when evidence is weak |
Constraints
- Fixed: no patient data in questions or answers; the system prompt forbids clinical advice.
- Fixed: every answer cites passage ids that were actually retrieved.
- Limit: two procedure owners could label 200 questions with their answering passage.
- Limit: a person must be able to read why the assistant declined.
Why the traditional approach fell short
| Approach | Where it breaks |
|---|---|
| Keyword search over the intranet | Returns every version of a procedure at equal rank; the staff member picks |
| Rules or FAQ list | Covers top questions and goes stale as procedures change |
| Manual review of a few answers | Catches wording errors, but the reviewer rarely sees which passage the model saw, so cannot tell if it was current |
Options considered
| Option | Verdict | Reason |
|---|---|---|
| A. Curated "current procedures" page and better intranet search (non-AI) | Kept | Cheap and exact; the destination of the abstention message |
| B. Keep the faithfulness-only dashboard and tune the prompt | Rejected | Faithfulness is judged against the retrieved text, so a faithful answer from the wrong passage scores well |
| C. Retrieval and generation metrics, an evidence check with abstention, a sampled judge | Accepted | Locates the failure and stops answering when evidence is weak |
| D. Put the whole library in every prompt | Rejected | Superseded versions stay in the context, so the model still has to choose |
Solution architecture
Figure 1. Two measurement points and an evidence check
How to read this: the two arrows leaving the Eval service point at the part each metric measures, so a drop is traced to retrieval or to generation.
Figure 2. One question, with the abstain path
How to read this: the alt block is the decision to answer or decline, made before the model is called.
How AI solved it, step by step
Step through one question, then switch to "Without the fix".
Under the hood
The Ragas paper (Es et al.) defines three reference-free scores, each computed with LLM prompts.
| Score | How it is computed | Agreement with humans |
|---|---|---|
| Faithfulness | An LLM splits the answer into statements S and checks each against the retrieved context. F = V / S, with V the supported statements | 0.95 |
| Answer relevance | An LLM writes n questions from the answer. AR is the mean cosine similarity of their embeddings to the original question | 0.78 |
| Context relevance | An LLM extracts the sentences needed from the context. CR is those over all sentences in the context | 0.70 |
Agreement is from pairwise comparisons on the paper's WikiEval set. The authors found context relevance the hardest to evaluate.
For an architect:
- Faithfulness asks whether the answer follows from the context it was given, not whether the context was right. A faithful answer from a superseded passage scores 1.0.
- Context relevance uses the retrieved text alone, so it cannot see the passage that was missed. Only a labelled set with gold passage ids can count that miss, which is why recall at k and ranking metrics sit beside these scores.
Recall at 5 is the share of questions whose gold passage is in the top 5. Gate it at a lower bound of 0.85 (two-sided 95%). Set passes to 152, the audit result: the interval falls to 69.6% to 81.4% and the gate fails.
The target, 180 of 200, gives 85.1% to 93.4% and passes. The mechanism is in Under the hood: Generation metrics.
What went wrong / failure modes
| Failure | What happened and the mitigation |
|---|---|
| Faithful but wrong | 29 of the 38 were faithful to a wrong or superseded passage, judged 1.0. Use retrieval metrics against gold ids and a current-version filter |
| Unsupported claims (hallucination in the narrow sense) | The other 9 had statements in no retrieved passage. Sample with the faithfulness judge; check citations |
| Over-abstention | A high threshold declines answerable questions. Track the abstention rate; read declined questions weekly |
| Judge error | A judge can misgrade, especially on long contexts. Compare 60 judged answers with a human: 54 agree (90%, interval 79.9% to 95.3%); see the summarisation case |
| Gold set drift | Procedures change. Owners re-label when a version changes |
Results
All results are illustrative targets, not measurements.
| Measure | At audit | Target |
|---|---|---|
| Recall at 5 | 152 of 200 (0.76) | At least 180 of 200 (0.90, lower bound 0.85) |
| MRR at 5 | 0.63 | Report it; watch the trend |
| Confident wrong answers | 38 of 200 (19%) | At most 10 of 200 (5%) |
| No current passage | Answered anyway | Declined, with a link to the curated page |
Tradeoffs and when NOT to use this approach
- Abstention has a cost. Every declined question sends someone to a human or a page. Tune the threshold against both errors.
- Small libraries. A few dozen procedures suit a curated page.
- Clinical advice. This design suits procedure lookup. Answers that guide patient care need clinical governance beyond this page.
- Judge-only quality. An uncalibrated judge must not decide releases.
Design rules extracted
- Measure retrieval and generation separately; a generation score cannot see a miss.
- Keep gold passage ids for a labelled set; report recall at k and a rank metric nightly.
- Decide when to abstain before the model is called, using metadata and a tuned threshold.
- Calibrate a judge against humans, then sample.
- Cite ids and verify them in code.
Assumptions
All numbers are illustrative.
- Audit set: 200 questions, one gold passage each. Confident wrong: 38 of 200 = 0.19; Wilson 95% (z = 1.96): 0.1417 to 0.2500. Of the 38, 29 faithful to a wrong passage and 9 with unsupported claims. All 38 fall among the 48 questions whose gold passage was outside the top 5; the other 10 were right or hedged (the audit predates the abstention check).
- Rank of the gold passage: 1 for 110 questions, 2 for 20, 3 for 12, 4 for 6, 5 for 4, outside the top 5 for 48. Recall at 5 = 152 / 200 = 0.76. MRR is the mean of 1 / rank, as the TREC-8 question answering track scored it (Voorhees and Tice, LREC 2000): (110 x 1 + 20 / 2 + 12 / 3 + 6 / 4 + 4 / 5) / 200 = 126.3 / 200 = 0.6315.
- nDCG at 5 (Stanford IR book), DCG = sum of (2^grade - 1) / log2(1 + m). Grades: 3 current, 2 supporting, 1 superseded, 0 irrelevant. Retrieved [1, 0, 3, 0, 2] gives 5.6606; the ideal order gives 9.3928; nDCG = 0.6026.
- Wilson 95%: 180 of 200 gives 0.8506 to 0.9343; 152 of 200 gives 0.6963 to 0.8139.
- Faithfulness mean 0.93 and the judge sample (54 of 60 agree, Wilson 0.7985 to 0.9534) are assumed. The hospital group, procedures and thresholds are invented.
Last verified: 2026-10-22