Evals are not complicated

If you’re building applied AI features like AI agents, you need to measure how well they perform.

With traditional (deterministic) software, you can write a suite of unit tests, system tests, or end-to-end tests. These have a binary output, either the test passes or fails.

However, AI models are non-deterministic. This means that our measurements need to become qualitative (“how well did this agent using this model perform on this task?”) rather than binary or quantitative (“did this unit test pass? how many of the unit tests passed?”).

Instead of unit tests, we use evals.

Eval suite basics

For AI features like agentic workflows, you use traditional code to write an eval suite. This eval suite contains a static set of inputs representing your “golden tasks” (your core use cases/scenarios).

Each eval passes the input into your agent or other AI feature, and then a separate “judge model” objectively evaluates the result according to a rubric you provide it. The resulting grade or score is the result for that eval.

As far as types of evals, your suite includes:

  • End-to-end task evals. These are gating. Basically, “was the agent able to complete the task correctly, regardless of how they got there?”
  • Individual step evals. Was the agent able to select the right tool required for the step, etc.?
  • Deterministic checks. These are cheap, and some of the things we still care about are deterministic.

Deterministic checks might include:

  • was the agent able to call allowed tools?
  • was the output parsed correctly?
  • was the agent unable to call disallowed tools?
  • etc.

What stays the same, and what changes

What you measure in an eval suite (your core scenarios or “golden tasks”) should remain static. What changes (what you are evaluating) is the version of the prompt you’re using for your AI feature. You’re evaluating the qualitative result on the output, of the nuances of the prompt instructions used as input.

Each eval run should be labeled with the prompt version that was evaluated.

You can swap your judge model to a better one as they become available, but just be aware that this will render future results not directly comparable to past results. If this is important, you can re-run a subset of recent runs using the new judge model to get apples-to-apples results to calibrate to the new judge model.

RAG search evals

For retrieval evals, we measure precision and recall.

Basically, precision answers the question “what percentage of the retrieved results were relevant?” i.e. how much noise in the results are you squelching?

Recall answers the questions “what percentage of the relevant results were retrieved?” i.e. how many relevant results did you miss?

For retrieval evals, you might re-run them any time you update the stored content chunks, change the overlap percentage, change the proximity threshold for your vector search engine, etc.