AI Dojo Open on the typewriterThe typewriter

An exercise to try

Follow one fact through retrieval

15 minutes
Assumes: you have graded answers against written rules, as in Grade an AI answer, and know what hit@k and recall@k count.
First published 19 November 2026. Last edited 19 November 2026.

When an assistant that answers from documents gets something wrong, the fault can sit in the search or in the answer. Follow four questions from the search to the answer and say where each fact was lost.

Time
15 minutes
What you need
This page and a place to write. No chatbot or code is needed.

Illustration. The search results and answers here are invented teaching material, not outputs from a model or a real search system.

How a question reaches an answer

Figure 1 · Illustration · The path of one question

Notice passages → search → ranked list → top three passed on → answer

  1. The library notice is stored as separate passages.
  2. A search compares the question with every passage and returns its top five as a ranked list, best match first.
  3. Only the top three passages go to the assistant, together with the question.
  4. The assistant writes its answer from those three passages and cites them.
Invented setup. Real systems differ in how many passages they pass on.

A fact can disappear at several points. The search can miss its passage, or rank it fourth so it never reaches the assistant. The assistant can receive it and not use it. Or the search can hand over an outdated passage that the assistant repeats faithfully.

The notice and its archive

D1 to D6 are the library notice, the same six passages as on earlier pages.

D1. Returns. The outdoor book drop accepts returns every day. The library desk is closed on Sundays.

D2. Fees. Borrowed books have no late fees. Lost books can incur replacement charges.

D3. Opening hours. The library desk is open Monday to Saturday, 9 am to 6 pm. It is closed on Sundays and public holidays.

D4. Renewals. A borrowed book can be renewed twice, for two weeks each time, unless another member has reserved it.

D5. Lost books. The replacement charge for a lost book is the price printed in the library catalogue.

D6. Membership. Membership is free for residents. Bring one photo ID to join.

One passage is new here. D7 is a withdrawn 2023 notice that still sits in the library’s archive. D2 replaced it, but the search reaches the archive too, so it can fetch D7:

D7. Withdrawn 2023 notice, kept in the archive. Late returns cost 10 cents per day.

For each question, a librarian has listed the passages a correct answer needs. That list is the labelled reference the search is scored against, the dataset of questions paired with relevant passages that Husain and Shankar’s evals FAQ recommends. D7 is never a needed passage, because it is withdrawn.

Two measures and four rules

  • Hit@3: 1 if at least one needed passage is in the top three, otherwise 0.
  • Recall@3: the share of the needed passages that are in the top three.

Both are explained in Retrieval metrics. An answer passes only if it meets all four library rules:

  1. Answer every part of the question.
  2. State the policy correctly.
  3. Make no material claim the notice contradicts or does not support.
  4. Cite a supporting passage for every claim.

The four cases

RET-01. “Can I return a book on Sunday, and is there a late fee?”

  • Needed: D1 and D2.
  • Search ranked: D1, D3, D5, D2, D6.
  • Passed on: D1, D3, D5.
  • Answer: “Yes, the outdoor book drop accepts returns every day [D1]. The passages I have do not mention late fees.”

RET-02. “Is there a fee if I return a book late?”

  • Needed: D2.
  • Search ranked: D7, D2, D1, D5, D3.
  • Passed on: D7, D2, D1.
  • Answer: “Yes, late returns cost 10 cents per day [D7].”

RET-03. “How many times can I renew a book?”

  • Needed: D4.
  • Search ranked: D3, D1, D6, D2, D5.
  • Passed on: D3, D1, D6.
  • Answer: “The notice does not say whether books can be renewed.”

RET-04. “What do I need to bring to join the library?”

  • Needed: D6.
  • Search ranked: D6, D3, D1, D5, D2.
  • Passed on: D6, D3, D1.
  • Answer: “Membership is free for residents [D6].”

Step 1. Score the search

For each case, work out hit@3 and recall@3. Then average each measure over the four cases.

Step 2. Say where the fact was lost

For each case, choose the category that fits; one trace can show more than one failure: never found (a needed passage is not in the search’s top five), found but ranked too low to be passed on (in the top five, below third), passed on but not used, or an outdated passage used faithfully. Then say whether the answer passes the four rules.

Check your work
CaseHit@3Recall@3Where lost
RET-0111 of 2, 50%Ranked too low
RET-0211 of 1, 100%Outdated passage used, or D2 not used
RET-0300 of 1, 0%Never found
RET-0411 of 1, 100%Passed on, not used
  • RET-01 fails rule 1. D2 came fourth, one place short. The answer is honest about what it received, yet the fee part is unanswered. Grading the answer alone would blame the assistant; the fix belongs to the search.
  • RET-02 fails rules 2 and 3: it states a late fee the notice no longer has. The search scores perfectly, since D2 is in the top three. Two diagnoses fit, and both name a failure you can see in the trace. “An outdated passage used faithfully”: the search fetched the withdrawn D7 and ranked it above D2. “Passed on but not used”: the assistant had the current D2 and chose D7 over it. Either answer is right. Which failure caused the wrong answer, this one trace cannot say, because one trace is not a controlled comparison. Telling them apart takes runs that change one thing at a time: D7 present or absent, and D7 ranked above or below D2, with everything else the same. Recall@3 sees neither failure: it counts needed passages and ignores an outdated one beside them.
  • RET-03 fails rules 1 and 3: it leaves the question unanswered and says the notice is silent, which D4 contradicts. D4 is not in the search’s top five, so it was never found. “The notice does not say” would be the right reply to a question the notice cannot answer, such as parking. This notice does answer it, so the search failed.
  • RET-04 fails rule 1: it never says what to bring, one photo ID. D6 came first, so the search did its job. Better search would not fix this answer.

Averages: hit@3 is 3 of 4, or 75%. Mean recall@3 is (50% + 100% + 0% + 100%) divided by 4, or 62.5%. None of the four answers passes. A 75% hit rate can sit beside four failed answers, because the search scores and the answer grades measure different things.

Step 3. Hand the assistant the right passages

To test whether the search deserves the attention, the four questions were run again with the search skipped. Each time, the assistant received exactly the needed passages, picked by the librarian.

  • RET-01, given D1 and D2: “Yes, use the outdoor book drop [D1]. Borrowed books have no late fees [D2].”
  • RET-02, given D2: “No. Borrowed books have no late fees [D2].”
  • RET-03, given D4: “You can renew a book twice, for two weeks each time, unless another member has reserved it [D4].”
  • RET-04, given D6: “Membership is free for residents [D6].”

Count the passing answers with the search and with the hand-picked passages. What does the change tell you, and what can this comparison alone not tell apart?

Check your work

With the search, 0 of 4 answers pass. With hand-picked passages, 3 of 4 pass. Three answers improved, so for those the search step deserves the attention first. RET-04 fails both ways, so its problem is in the answer step.

Each rerun changes more than one thing: it adds any missing needed passage and removes every other passage. In RET-01 and RET-03 the missing passage arrived, so supplying it is the likely gain. In RET-02 the assistant already had D2, so the gain came from a removal. But two passages were removed, D7 and D1, and this comparison cannot say which removal helped. Removing D7 is the likely help, since the wrong answer cited it, but a likely cause is not a tested one. To test it, change one thing: rerun RET-02 with D2 and D1, taking away only D7. A further run that keeps D7 but ranks it below D2 would show whether its position mattered.

A pass count also cannot say which search fix will help: ranking needed passages higher, passing on more than three, or keeping withdrawn passages out of the search. And four cases are far too few to size any of it.

Try a different case

A patron asks “Is parking free?” The notice does not cover parking, so the librarian lists no needed passages. The search still returns five passages, and three are passed on. Work out hit@3 and recall@3, then write what a passing answer must say.

Check this one too

There is nothing to count: recall would mean dividing by zero needed passages. Leave the case out of the retrieval scores and grade the answer instead. It passes only if it says the notice does not cover parking. An answer that offers the opening hours instead, or guesses about parking, fails.

Where this sits: Separate finding evidence from using it in the beginner evaluations guide, and the measures in Retrieval metrics.