Back to the research
Context Engineeringretrievalrelevance evaluation

Write a Relevance Test Before Your AI Retrieves Anything

A short checklist for deciding what deserves a place in context, using a mismatched search as the example.

How do you decide what belongs in an AI system's context?

Write down what "relevant" means for the task before the system retrieves anything. Then check each candidate document against that rule. Without a rule, a search can return items that look related by keyword or index label but cannot help with the job.

What a mismatched search looks like

Context engineering is the work of giving an AI system the right instructions, evidence and tool results for a task. Retrieval is only one step in that work.

Here is a small example. A literature search tagged "context engineering AI systems" and "context engineering evaluation" returned five arXiv abstracts. They covered:

From the abstracts, none of them studies how to select or evaluate context for an AI system. I reviewed only the abstracts, so this says nothing about the full papers. It also says nothing about how well that search tool works in general.

Why a plausible-looking result can still be wrong

A retrieval system can match on words, topics or broad categories. A task needs more than that. It needs evidence that answers the question, comes from a usable source and is specific enough to act on.

Suppose a support bot is asked about refund policy. A shipping-policy page may share many words with the question and still be the wrong evidence. (This is an invented illustration.) Putting that page into context adds noise, and the model may use it anyway.

A simple relevance test

Before retrieval, write a short acceptance rule. It can have four questions:

  1. What is the user's task, in one sentence?
  2. What kind of evidence would answer it: a policy, a number, a definition or a tool result?
  3. What should be excluded, such as other topics, outdated versions or unrelated products?
  4. What should the system do if nothing qualifies?

The last question matters most. An empty result is better than filler, because filler gives the model something to build on.

What remains uncertain

This example shows why a rule helps. It does not show how much a rule improves answers in any real system. That needs a test with your own questions and documents.

Next steps

  • Collect 20–50 real questions from your task. For each, mark which documents should and should not be admitted.
  • Compare retrieval with and without the acceptance rule. Measure how many admitted items are relevant. Also measure how often the final answer is correct.
  • Log the "nothing qualifies" cases. Review them to find missing documents or a rule that is too strict.
← Explore more research