Choosing Evaluators for Generative AI Applications
This lesson explains how evaluation uses datasets, metrics and AI-assisted judges to score quality and safety consistently, since generative output cannot be tested with exact string comparisons alone.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the fields of an evaluation dataset.
- Identify the evaluators by purpose and the data each needs.
- Choose evaluators for an application's purpose and available data.
Evaluation data
Traditional software is tested by comparing an output with an expected value. Generative output rarely allows this: two answers can use different words and both be correct, and a fluent answer can still be wrong. Evaluation therefore replaces exact comparison with measurement. A fixed set of test inputs is run through the application, and each output is scored on the qualities that matter, such as whether it is supported by the sources, whether it answers the question and whether it is safe. Comparing these scores between versions shows whether a change to a prompt, model or index made the application better or worse.
An evaluator is a component that scores one quality of an output, such as groundedness or fluency, and returns a score, often with a reason. Scores come from three kinds of evaluator, and all three read their inputs from the evaluation dataset.
AI-assisted evaluators ask a judge model to apply a rubric. They suit qualities that need language understanding, such as groundedness.
Natural language processing (NLP) metrics, such as F1 or ROUGE, compute word overlap with a reference answer. They need a reference answer for every row.
Code-based evaluators apply a deterministic rule, such as whether the output is valid JSON.
An evaluation dataset is a JSON Lines file in which each row contains some of the following fields: query (the input), response (the output to evaluate), context (retrieved content for RAG) and ground_truth (a reference answer). For agents, rows may contain the conversation messages and tool calls. Datasets are drawn from real usage, cover edge cases and adversarial inputs, and are kept in source control so that results are comparable across versions.
Evaluation dataset fields
Evaluators
The following table groups the evaluators in azure-ai-evaluation and Foundry by purpose and shows the data each one needs. AI-assisted evaluators use a judge model deployment, typically scoring from 1 to 5 with a reason and a pass or fail result against a threshold.
| Group | Evaluator | Measures | Needs |
|---|---|---|---|
| RAG | Groundedness | Claims supported by the context | query, response, context |
| RAG | Relevance | Response addresses the query | query, response |
| RAG | Retrieval / document retrieval | Quality of retrieved chunks | query, context (or labels) |
| RAG | Response completeness | Covers the ground truth | response, ground_truth |
| General | Coherence, fluency | Logical flow and language quality | query, response |
| Textual similarity | Similarity, F1, BLEU, ROUGE, METEOR | Closeness to a reference | response, ground_truth |
| Agents | Intent resolution, task adherence, tool call accuracy | Understanding, compliance, correct tool use | conversation, tool definitions |
| Safety | Violence, sexual, self-harm, hate, indirect attack, protected material | Harmful or unsafe output | query, response |
Custom evaluators are Python functions or prompt-based judges with their own rubric, for example "Does the answer mention the required disclaimer?". Code-based checks are cheap and deterministic and should be used wherever a rule can decide the result.
AI-assisted evaluators work by asking a judge model to apply a rubric. For groundedness, the judge reads the context and the response, identifies the claims in the response and checks whether each one is supported, then assigns a score and explains which claims were not. Because the judge is itself a model, its scores vary slightly between runs and depend on the judge deployment chosen, so the same judge model should be used when comparing versions, and conclusions should rest on averages over many rows rather than on single examples. Spot-checking a sample of judgements against human review confirms that the judge agrees with the team's own standard.
Choosing evaluators
Evaluators are chosen by the application's purpose and available data. A RAG chatbot needs groundedness, relevance and retrieval quality; an agent needs intent resolution, task adherence and tool call accuracy; any public-facing system needs safety evaluators. Similarity metrics require ground-truth answers and suit tasks with a single correct answer, such as extraction; they penalize valid paraphrases in open-ended answers.
Which evaluator?
Choosing metrics
A team wants to know whether its policy assistant invents information and whether it answers the question asked. It has no reference answers, but it logs the retrieved context for each query.
Groundedness (query, response, context) detects invented information, and relevance (query, response) checks that the question is answered; neither needs ground truth. Similarity or F1 cannot be used without reference answers.
Which evaluators need ground-truth answers?
Show answer
Similarity, F1, BLEU and ROUGE, because they compare the response with a reference answer.
Exam Tips
Remember for the exam
- Fabrication: groundedness. Answering the question: relevance. Retrieval quality: retrieval evaluators.
- Similarity, F1, BLEU and ROUGE need ground-truth answers.
- Agents: intent resolution, task adherence and tool call accuracy.