How do you evaluate an AI workflow? Define the decision and expected behavior, test representative cases and important failures, and inspect results by category. A higher average score alone does not prove the product improved.
Suppose a support assistant scores better after a prompt change. It answers more routine questions correctly, but its average score hides a new failure: it drafts a ticket with the wrong customer details. The first number looks better; the release decision is harder. Inspect the cases behind the average before deciding what improved.
This guide follows a fictional support assistant that answers questions and drafts tickets. Start with the decision you need to make, then define expected behavior and separate high-risk failures from ordinary errors. The example illustrates the method; it is not a benchmark result from our team.
Promptfoo is one open-source way to run cases and assertions repeatedly. It can organize the checks, but your team still has to choose representative cases and decide what failure rate is acceptable. Later in the guide, an example shows how a concrete assertion fits into that process.
Start with the change under consideration and the behavior it should improve. For example: a new retrieval prompt should reduce unsupported policy claims while preserving useful answers when the policy is available. This statement identifies both the desired improvement and a behavior that must not be lost.
Avoid beginning with whatever metric a dashboard happens to offer. A similarity score may be convenient, but it may reward copying an expected phrase even when the answer cites the wrong policy version. Token usage measures resource consumption, not whether the customer received the right guidance. Each metric should connect to a product requirement that someone can explain in plain language.
Write the release decision in advance. Which failures block the change? Which tradeoffs require human review? Which measurements are exploratory? You do not need a complicated statistical plan for every small prompt edit, but you do need protection against changing the success criteria after seeing the result. Otherwise the evaluation can become a way to justify a preferred change rather than challenge it.
Build cases from real task shapes
A useful test set reflects the kinds of requests the product receives or is intended to handle. Include straightforward tasks, ambiguous requests, missing information, conflicting sources, and requests outside the allowed scope. The mix should come from an explicit understanding of the product, not just examples that are easy to write.
Use real interactions only through an appropriate privacy process. Remove identifying information, respect retention and access restrictions, and check whether the transformed case still preserves the behavior you want to test. Synthetic cases are useful for controlled boundaries, but label them as synthetic and do not assume they represent the frequency of problems in production.
For the support assistant, include a valid policy question, an outdated policy, a request with no matching documentation, and a request to perform an action the assistant cannot take. A case should specify the relevant environment and evidence. Without that context, two reviewers may reasonably disagree about the right answer, and the resulting score will reflect an unclear test rather than a clear product failure.
Define acceptable answers without overfitting wording
Many tasks have several correct responses. A support answer can be concise or detailed, use different phrasing, and still communicate the same policy accurately. An evaluation that requires one exact paragraph may punish useful variation while missing a serious error that happens to use familiar words.
Separate required facts from optional style. State what must be present, what must not be claimed, and what uncertainty must be acknowledged. Where the answer depends on a source, identify the source version and the claim it supports. For an action, define the required state transition rather than judging only the final message.
In our example, an answer about a return window should use the applicable policy and avoid inventing an exception. It may not need to match a reference sentence exactly. A drafted ticket should contain the required fields and remain a draft if the product lacks permission to submit it. These criteria are more stable than a single idealized response and make disagreements easier to discuss during review.
Make the score answer a product question
Use deterministic checks where they fit
Some requirements can be checked directly. A response must parse as a specified schema, a cited document identifier must exist, a tool argument must fall within an allowed range, or a forbidden operation must be rejected. Use explicit checks for these properties instead of asking another model to guess whether they are satisfied.
Deterministic does not mean complete. Valid JSON can contain a false claim. A real citation can point to a document that does not support the answer. A successful tool call can perform the wrong action. Combine structural checks with checks of meaning and outcome, keeping each result visible rather than hiding everything in one opaque score.
Test your checks themselves. Include examples that should pass and examples that should fail for known reasons. A citation validator that accepts any URL-shaped string provides very different protection from one that checks an allowed source identifier. Review the implementation and the failure messages. An evaluation harness is software, and a bug in its assertions can make a broken product appear consistently correct.
Treat model judges as fallible reviewers
A model judge can help assess open-ended qualities, but its verdict is not ground truth. It can misunderstand the rubric, miss a subtle factual error, or prefer a style that does not serve your users. Give the judge the evidence and criteria it needs, then compare a sample of its decisions with informed human review.
Keep the judge configuration visible: model, prompt, rubric version, and relevant generation settings. If you change the judge while changing the candidate system, differences in scores become harder to interpret. Preserve enough information to rerun the comparison or explain why exact reproduction is not possible with a hosted model.
Inspect disagreements rather than averaging them away. If the judge marks an unsupported refund promise as acceptable, that is a failure in the evaluation process that deserves a targeted case. For important constraints, use enforceable application checks as well as judgment. A favorable natural-language review should never grant an action permission that the application itself has not established.
Keep a holdout set away from routine tuning
If you repeatedly edit a prompt against the same cases, those cases gradually become part of the development process. Improvement on them still matters, but it becomes weaker evidence that the change will generalize. Keep a separate set for less frequent assessment and resist using every failure immediately as a prompt-writing hint.
The holdout set does not need to be mysterious or enormous to be useful. It needs a clear role, controlled access, and cases that represent the intended evaluation decision. Rotate or expand it thoughtfully when the product changes. Record when a case moves into the development set so future comparisons do not pretend it remained unseen.
Do not solve this problem by hiding all failures from developers. They need actionable feedback. Use development cases for diagnosis and a separate evaluation stage for the release decision. If the holdout exposes a serious defect, fix it and acknowledge that the set has now informed development. Fresh evidence may be needed before making a strong claim about general performance.
Inspect failure groups before the average
An aggregate score can hide a regression in a small but important category. The assistant might improve on easy factual questions while becoming worse at admitting missing information. If the easy cases dominate the test set, the overall result can rise even as the product becomes less trustworthy in difficult situations.
Group results by meaningful task properties: available versus missing evidence, read-only versus action requests, familiar versus unfamiliar topics, or short versus long context. Use categories tied to your product's risks and user journeys. Avoid slicing so finely that every group contains too few cases to support interpretation.
Show counts with rates. “No failures” means something different across three cases and three thousand, and neither proves impossibility of failure. When a group is small, report the limitation directly. Review the actual failing examples alongside the summary. A single unauthorized action can matter more to a release decision than several stylistic improvements, even when a simple average assigns them equal weight.
Measure variability instead of hiding it
The same model and prompt can produce different outputs across runs. A single successful result on a difficult case does not establish dependable behavior. Decide where repeated runs are useful and record the variation. Focus repetition on unstable or consequential cases rather than multiplying every easy check without a purpose.
Keep the conditions consistent when comparing candidates: inputs, tools, source versions, time limits, and evaluation configuration. Record provider errors separately from answer-quality failures, while still considering their effect on the user experience. An unavailable service and an incorrect answer are different causes that may require different repairs.
Avoid reporting more precision than the evidence supports. A small difference on a small, variable test set may not justify a strong claim of superiority. You can still make a practical choice based on cost, latency, or maintainability, but explain that basis. Evaluation should clarify a decision under uncertainty, not decorate it with decimal places that imply a level of certainty the test did not establish.
Test the full workflow, not only the answer
A model can write a correct response while the application performs the wrong action. Conversely, the tool may succeed while the final answer tells the user it failed. Evaluate the relationship between the request, permissions, tool calls, stored state, and final message when your product does more than generate text.
For the imaginary ticket assistant, check that a draft remains a draft unless submission is authorized. Check that a timeout does not lead to duplicate tickets. Check that the final message distinguishes a prepared draft from a submitted ticket. These properties require application-level evidence, not merely a judge reading the conversation's last paragraph.
Use controlled adapters or fixtures for side effects during routine evaluation. A test suite should not send real customer emails or create production records by accident. Keep any live integration tests explicit, bounded, and separately authorized where needed. Record which layers were exercised. A passing offline evaluation does not establish that production credentials, network access, or external service behavior will work correctly.
Turn failures into small, reusable repairs
When a case fails, identify the layer responsible before changing the prompt. The source may be missing, the retriever may select an outdated document, a tool schema may be ambiguous, or the application may accept an invalid state. Prompt changes can sometimes help, but they cannot replace missing evidence or an unenforced permission boundary.
Create the smallest regression case that demonstrates the defect. Keep the original expected behavior and explain why the old output was unacceptable. Then apply the repair and confirm that the case changes for the intended reason. Include a neighboring valid case so the fix does not simply refuse every difficult request.
Store the case, configuration, and result with the relevant change. This creates a useful record for future model or prompt updates. Over time, the regression set becomes a map of known failure modes in your product. Review it periodically for obsolete assumptions and duplicate cases, while preserving the history needed to understand why a boundary was introduced.
Publish results with enough context to be useful
An evaluation report should name the task, dataset origin, case count, versions, scoring method, and limitations. Explain whether the examples are public, synthetic, private, or adapted. If you cannot share the inputs, say what that prevents others from checking. Do not describe a private internal comparison as independently reproduced evidence.
Include failure examples and tradeoffs alongside wins. A model that improves factual accuracy but increases latency may still be the right choice, but readers need both facts to assess the decision. Distinguish measured results from recommendations and from hypotheses that you plan to test. This makes the report more useful than a leaderboard number detached from its conditions.
For your next change, choose one product decision, a small representative case set, explicit checks, and a review process for ambiguous results. Keep a separate assessment set, inspect important failure groups, and verify the complete workflow where actions are involved. A score is useful when it helps you make that decision with better evidence. It is not a substitute for knowing what the product must do.