Evaluate retrieval and answers separately
A knowledge assistant needs two distinct checks. Does retrieval return the right evidence, and does the answer follow from that evidence?
Lessons in this path
How to do it
- Prepare questions with the expected document and section. Include cases with missing sources, superseded versions and restricted access.
- Score retrieved passages independently. If the right section is missing, revisit indexing, filtering or chunking. If the answer misstates a correct passage, revisit the response instructions and evaluation.
- Ask subject experts to contribute new questions. Run the tests after a content, index or model change. Assign ownership for correcting outdated answers.
Acceptance check · AI for mid-sized businesses
A service team searches installation guides for multiple models and sites. One transitional rule applies at a particular site for a limited time.
Test a user changing sites and an expired manual. Only sources valid for the site and date should support an answer.
Apply this in your organization
Include a backup reviewer. They should be able to act from the citation and version without repeating the search.
How do you build a test set for retrieval and answers?
A test set for a knowledge assistant consists of questions, the expected evidence and a reference answer or review criteria. Here is how to build one with manageable effort:
- Collect real questions from support, team chats or emails and phrase them as users write, including typos and abbreviations.
- Have subject-matter experts specify the document and section containing the answer for each question, or “no source”.
- Deliberately add hard cases: synonyms, outdated versions, questions spanning two documents, unanswerable questions, restricted-access questions.
- Measure retrieval first: is the expected section among the top five hits?
- Then measure the answer: is it correct, complete, supported, and does it name gaps?
Which metrics belong in the evaluation?
The literature uses many metrics. For most companies, the following four are enough, as long as they are captured separately and consistently.
| Metric | Question | If poor, check … |
|---|---|---|
| Hit rate (recall@k) | Is the right section among the top k hits? | Chunking, metadata, search method |
| Faithfulness | Does every statement follow from the supplied hits? | System instruction, output format, model |
| Answer relevance | Does the answer address the question asked? | Query understanding, query rewriting |
| Honest gap | Does the assistant say “I don't know” when no source exists? | Thresholds, rules for empty results |
Going deeper: automated evaluation and ongoing operations
Open-source libraries such as Ragas, along with evaluation features of many platforms, compute faithfulness and relevance automatically, usually with a language model as judge. That saves time on large test sets but has its own failure modes: the judge may misread nuance or technical terms. Calibrate automated scoring against a sample scored by experts and use it to compare versions, not as absolute truth.
In operation, two signals are added: user feedback (such as thumbs up or down with an optional comment) and questions without hits. The latter are the most valuable source for content gaps. A weekly look at the most frequent unanswered questions shows which documents are missing. In enterprises a standing group of business owners and operations working through this list pays off; for solo professionals a weekly note is enough. Rerun the full test set on every change to index, chunking, model or system instruction.
Example: error analysis in an IT helpdesk assistant
A fictional IT helpdesk tests 50 questions. Result: for 41 questions the right section is among the top five hits, for 9 it is not. Of the 41, 36 are answered correctly; 5 contain a wrong sequence of steps even though the correct section was supplied.
The 9 retrieval failures almost all involve abbreviations such as “VPN” or “MFA” that are spelled out in the documents. The team adds keyword search and a small synonym list. The 5 answer errors occur on numbered instructions that the model summarises. Fix: the system instruction requires step sequences to be reproduced unchanged. Without separate measurement, the team would probably have switched models and solved neither problem.
Common mistakes
- Testing only questions you wrote yourself. Real users ask differently.
- No unanswerable questions in the test set. You will not notice when the assistant fills gaps with fabrications.
- Creating the test set once and never extending it. New content and new question types need new cases.
Frequently asked questions
How many test questions are enough?
For a pilot, 30 to 50 well-chosen questions are a workable start, as a rough orientation. Coverage matters more than volume: every document type, every role and every kind of edge case.
Who should score the answers?
Subject-matter experts who own the content. Technical teams can assess retrieval but not reliably whether a domain answer is complete.
Try it yourself
For five questions, record expected evidence, actual match, answer quality and whether the assistant handled missing evidence appropriately.
Check your result
Can you tell whether a failure came from locating evidence or writing the answer?