Forum Discussion
dramaraj
Microsoft
Nov 29, 2026Building Trustworthy Production AI: An Evaluation Framework with 500+ Golden Test Cases
AI applications can produce responses that look completely reasonable and still be wrong in ways that matter.
A production AI system can:
- generate an unsupported factual claim,
- select the wrong tool,
- perform an action without required approval,
- expose information after identity verification fails,
- contradict trusted tool output,
- claim success after a tool call failed,
- violate an output contract,
- or confidently answer a request that should have been escalated.
This is why I don't think production AI evaluation should answer only one question:
“Was the final answer correct?”
A stronger question is:
“Can we prove that the AI system behaved correctly, used the right evidence, followed the required controls, produced a grounded response, and knew when it could not safely decide?”
To evaluate that systematically, we built an evaluation framework around 500+ curated golden test cases, deterministic evaluation for objectively verifiable behavior, selective semantic evaluation for cases requiring judgement, measurable quality metrics, regression testing, and release gates.
The objective was not to produce one impressive evaluation score.
It was to make AI quality measurable, explainable, repeatable, and actionable.
1. Start with a Golden Dataset, Not the Evaluator
One of the most important decisions was to build the benchmark around the behaviors we wanted to validate rather than around rules we had already implemented.
The resulting golden dataset contains 500+ curated evaluation cases spanning the key capabilities, risks, difficulty levels, adversarial behaviors, and edge cases identified for the AI system.
But dataset size alone isn't meaningful.
Five hundred variations of the same straightforward question would still produce a weak benchmark.
The real objective is coverage, not volume.
Capability coverage
Cases evaluate behaviors such as:
- tool selection,
- authorization,
- approval before consequential actions,
- identity verification,
- privacy,
- task completion,
- factual grounding,
- numeric grounding,
- policy compliance,
- output contracts,
- escalation behavior.
Difficulty coverage
The benchmark includes:
- easy cases,
- medium cases,
- hard cases,
- ambiguous cases,
- adversarial cases,
- edge cases.
Verdict coverage
Cases are designed to exercise three outcomes:
PASS
The available evidence supports the AI application's behavior.
FAIL
There is sufficient evidence to identify incorrect or unsafe behavior.
ESCALATE
The evaluator cannot reliably determine PASS or FAIL without additional semantic or human judgement.
Tool-behavior coverage
The dataset represents situations such as:
- successful tool execution,
- failed tool execution,
- partial results,
- incorrect tool selection,
- unauthorized tools,
- missing prerequisite calls,
- false completion after failure.
Grounding coverage
Grounding tests include:
- supported facts,
- unsupported claims,
- incorrect numbers,
- conflicting evidence,
- scoped numeric claims,
- derived calculations,
- insufficient evidence.
Language variation
The same behavioral requirement can appear through:
- direct wording,
- paraphrases,
- negation,
- indirect requests,
- temporal language,
- semantically equivalent responses.
This is important because an evaluator should understand the underlying behavior rather than succeed only when it recognizes familiar keywords.
Safety and adversarial coverage
The dataset also includes cases involving:
- privacy violations,
- prompt injection,
- attempts to bypass constraints,
- missing approval,
- identity verification failures,
- conflicting instructions,
- sensitive-data handling.
The golden dataset therefore becomes more than a set of questions and expected answers.
It becomes a behavioral coverage model for the AI system.
Figure 1. Coverage-driven golden dataset spanning capability, difficulty, verdict, safety, grounding, tool behavior, language variation, and adversarial scenarios rather than optimizing for case count alone.2. Separate Evaluator Inputs from Ground Truth
A golden dataset creates another important challenge:
How do we prevent the expected answer from influencing the evaluator?
Every case therefore has two logically isolated components.
CaseInput
Contains only what the evaluator is permitted to inspect:
- task,
- constraints,
- allowed tools,
- trajectory,
- tool evidence,
- final response.
Gold
Contains the expected human-labelled outcome:
- expected verdict,
- quality score,
- policy-violation label,
- rationale.
The evaluator receives only:
CaseInput
It does not receive:
Gold
Only after the evaluator produces and persists its prediction do we compare that prediction with the expected result.
The lifecycle becomes:
CaseInput → Evaluator → Prediction
followed by:
Prediction + Gold → Evaluation Metrics
This boundary matters.
If expected labels or human rationales leak into the evaluator, the resulting score no longer represents a fair evaluation.
For production evaluation, preventing leakage is just as important as calculating the score correctly.
3. Not Every AI Failure Needs Another LLM
One of the core architectural decisions was determining what should be evaluated deterministically and what genuinely requires semantic judgement.
Consider:
Was this tool allowed?
That can be determined from structured evidence.
Did a write operation happen before required approval?
Again, structurally verifiable.
Does the output contain all required JSON fields?
Deterministic.
Did the last tool call fail while the final answer claimed success?
Deterministic.
Sending these checks to another LLM introduces unnecessary latency, cost, and variability.
Now consider different questions:
Is this paraphrased summary actually supported by the evidence?
Does this indirectly worded response violate the policy?
Is this derived calculation consistent with the available tool results?
These require semantic understanding.
That led to a principle that became central to the framework:
Do not ask an LLM to judge what code can prove.
Do not force code to guess what requires semantic judgement.
4. Tier 1: Deterministic Evaluation
The first evaluation tier applies deterministic checks in strict priority order.
Authority and Temporal Safety
The evaluator checks whether the AI application:
- used only allowed tools,
- respected read-only restrictions,
- obtained required human approval,
- executed actions in a permitted order.
Priority matters.
An excellent final answer should not compensate for an unauthorized action.
Output Format Contracts
The evaluator verifies requirements such as:
- non-empty outputs,
- JSON-only responses where required,
- valid schemas,
- required fields,
- sentence-count limits,
- structural response contracts.
These are objectively verifiable conditions and do not require semantic judgement.
Identity and Escalation
The framework evaluates scenarios such as:
- sensitive information disclosure after failed verification,
- unresolved human confirmation,
- ambiguous requests,
- false completion following tool failure,
- situations requiring human intervention.
Factual and Numeric Grounding
Grounding requires more than checking whether a word or number appears somewhere in a tool response.
Suppose trusted evidence contains:
Revenue, Q1 = 10
The number 10 appearing somewhere in a response does not automatically make every claim involving 10 grounded.
The evaluator needs to associate the value with concepts such as:
Subject + Attribute + Period + Value
The same principle applies to factual statements.
A claim should be supported by the relevant evidence, not merely share words or numbers with it.
Task Deliverable Verification
Finally, the framework verifies whether the requested deliverable was actually supported by execution evidence.
For example:
- Was the requested action actually completed?
- Was the inventory lookup performed?
- Were listed values returned by a trusted tool?
- Did the claimed operation actually succeed?
If deterministic evidence cannot safely establish the result, the framework does not manufacture certainty.
It returns:
ESCALATE
5. ESCALATE Is a Feature, Not a Failure
A deterministic evaluator should not be forced to answer every question.
Sometimes evidence is incomplete.
Sometimes the request is ambiguous.
Sometimes human confirmation is required.
And sometimes determining whether the output is correct genuinely requires semantic understanding.
Returning ESCALATE in those situations is safer than manufacturing an optimistic PASS.
This gives us three meaningful outcomes:
PASS: We have sufficient evidence to defend the behavior.
FAIL: We have sufficient evidence to identify a violation or incorrect behavior.
ESCALATE: We do not have enough deterministic evidence to decide safely.
Uncertainty is therefore explicit rather than hidden.
6. Tier 2: Selective Semantic Evaluation
Cases requiring semantic interpretation can be routed to a Tier-2 evaluator such as an LLM-as-a-Judge.
Typical Tier-2 scenarios include:
- paraphrased summaries,
- indirect policy interpretation,
- semantic grounding,
- derived calculations,
- open-ended reasoning.
But the judge itself should also be bounded.
A production semantic evaluator should operate using:
- a defined evaluation rubric,
- relevant evidence,
- a strict structured output schema,
- controlled configuration,
- explicit decision reasons.
Most importantly:
Tier 2 should not automatically evaluate every request.
The deterministic layer handles what can reliably be established from evidence.
Only genuinely ambiguous or semantic cases incur the additional model-based evaluation.
This gives us a hybrid evaluation architecture:
Deterministic where possible. Semantic where necessary.
Figure 2. Reusable production AI evaluation lifecycle combining deterministic checks for objectively verifiable behavior with selective semantic evaluation for cases requiring contextual judgement, followed by standardized metrics and production quality gates.7. Don't Measure Production AI with One Accuracy Number
Even a high overall accuracy score can hide serious problems.
Imagine two evaluators reporting similar overall accuracy.
One occasionally escalates a valid request unnecessarily.
The other occasionally marks a genuine policy violation as safe.
The headline number might look similar.
The production risk is fundamentally different.
This is why the framework uses multiple evaluation signals.
Verdict Accuracy
Measures exact agreement between predicted and expected:
PASS / FAIL / ESCALATE
Useful as an overall signal, but insufficient by itself.
Macro F1
Macro F1 measures PASS, FAIL, and ESCALATE independently and gives each verdict class equal importance.
This helps expose cases where one class performs poorly despite acceptable overall accuracy.
Confusion Matrix
The confusion matrix shows not only how often the evaluator is wrong but how it is wrong.
For example:
FAIL → PASS
can represent a potential safety leak.
Whereas:
PASS → ESCALATE
indicates unnecessary caution.
Those two failures should not trigger the same engineering response.
Policy Precision and Recall
Precision asks:
When the evaluator flags a policy violation, how often is it correct?
Recall asks:
Of all actual policy violations, how many did it catch?
Both matter.
High precision with low recall means the evaluator rarely raises false alarms but may still miss genuine violations.
Quality Score MAE
For quality scoring, Mean Absolute Error measures how far the evaluator's predicted score deviates from the human-labelled score.
This helps identify cases where the overall verdict may appear reasonable while severity is being estimated incorrectly.
Figure 3. Production AI quality requires multiple evaluation signals because aggregate accuracy alone can hide class imbalance, missed policy violations, severity errors, and safety-critical misclassifications.8. Every Metric Should Trigger an Engineering Response
Evaluation metrics become useful when they change what engineers do next.
If policy precision drops
Likely signal:
Too many false positives.
Engineering response:
Improve context handling, negation detection, temporal interpretation, and policy-rule specificity.
If policy recall drops
Likely signal:
The evaluator is missing genuine violations.
Engineering response:
Expand policy coverage, introduce domain-specific adapters, or route semantically complex cases to Tier 2.
If Macro F1 drops while accuracy remains acceptable
Likely signal:
One verdict class is underperforming.
Engineering response:
Inspect PASS, FAIL, and ESCALATE independently rather than tuning the entire evaluator around aggregate accuracy.
If FAIL → PASS increases
Likely signal:
Potential safety leakage.
Engineering response:
Strengthen high-priority authority, identity, policy, tool-use, and grounding checks.
Critical categories can become explicit release blockers.
If PASS → ESCALATE increases
Likely signal:
The deterministic layer is becoming overly conservative.
Engineering response:
Look for brittle exact matching and move genuinely semantic decisions into the bounded Tier-2 evaluator.
If Quality MAE increases
Likely signal:
Evaluator severity no longer aligns with human judgement.
Engineering response:
Inspect large score differences and determine whether upstream safety or grounding failures are being scored too lightly.
This turns evaluation metrics into diagnostic engineering signals, not simply dashboard numbers.
9. Evaluation Is Also Part of Hallucination Reduction
Hallucination is often discussed as though it is exclusively a model-generation problem.
In a production AI system, an apparently hallucinated response can originate from many different layers.
Wrong evidence retrieved
→ retrieval problem.
Outdated evidence
→ freshness problem.
Unsupported number
→ numeric-grounding problem.
Tool failed but the AI claims success
→ execution-grounding problem.
Insufficient evidence but the AI answers anyway
→ escalation problem.
Restricted information appears in the response
→ authorization or policy problem.
This is why simply telling a model:
“Do not hallucinate”
cannot be the complete solution.
Reducing unsupported responses requires validating the behavior of the whole AI application, not just the generated text.
Evaluation gives us the mechanism to identify where the failure actually occurred.
10. Turn Important Failures into Regression Cases
A production evaluation framework gets stronger when previously discovered failures cannot silently return.
When a legitimate new failure pattern is identified, the workflow should become:
Failure Detected
→ Inspect Evidence
→ Identify Root Cause
→ Create Evaluation Case
→ Human Review
→ Add to Golden Dataset / Regression Suite
→ Re-run Evaluation
In this model, the golden dataset evolves alongside the application.
Production failures, newly identified risks, tool changes, policy changes, and new application capabilities can all create new evaluation requirements.
The benchmark therefore becomes an engineering memory of known failure patterns.
11. Synthetic Cases Can Expand Coverage, but They Still Need Governance
Some important scenarios are rare.
Waiting for every edge case to occur naturally in production can leave major coverage gaps.
Synthetic cases can help introduce controlled variations such as:
- alternative phrasing,
- negation,
- reordered instructions,
- different tool failures,
- ambiguous requests,
- authorization changes,
- numeric variations,
- adversarial prompts.
But synthetic generation should not automatically turn generated examples into golden truth.
A safer workflow is:
Coverage Gap
→ Generate Candidate Cases
→ Validate Scenario
→ Define Expected Behavior
→ Human Review
→ Approve into Golden Dataset
The benchmark remains curated, not merely generated.
12. Version the Evaluation System
A score without provenance is difficult to trust.
Evaluation results can change because of:
- dataset modifications,
- new rules,
- policy changes,
- semantic-judge prompts,
- model changes,
- threshold changes,
- configuration changes.
The framework therefore needs versioning for components capable of changing a decision.
Examples include:
- dataset version,
- evaluator version,
- deterministic-rule version,
- policy-adapter version,
- rubric version,
- judge-prompt version,
- model or deployment version where applicable,
- thresholds,
- runtime configuration.
This enables a crucial production question:
“Can we explain exactly what produced this evaluation result?”
Evaluation evidence should ideally tell us:
Which dataset?
Which evaluator?
Which rule?
Which model or judge?
Which thresholds?
Which configuration?
Without that provenance, comparing evaluation runs quickly becomes unreliable.
13. Connecting the Pattern to Microsoft Foundry
The architecture described here is intentionally framework-oriented.
Individual applications can implement deterministic checks, domain policies, golden datasets, and quality gates according to their requirements.
Microsoft Foundry provides evaluation capabilities that can complement this architecture across development and production.
Foundry evaluations can be run against test datasets, generated model or agent responses, and production traces. Built-in evaluation capabilities cover multiple dimensions of AI quality and safety, while custom evaluation mechanisms can support application-specific requirements.
For agentic applications, agent-focused evaluation is particularly useful because production quality is not determined only by the final response.
The process matters too.
Which tools were selected?
Did tool execution succeed?
Was the trajectory appropriate?
Was the final response supported by the execution evidence?
This creates a useful separation of responsibilities.
Application-specific deterministic controls
validate behavior that can be established directly from structured evidence.
Semantic and platform evaluators
assess dimensions requiring deeper contextual or model-assisted evaluation.
Golden datasets and regression suites
provide repeatable evidence across application versions.
Quality gates
translate those signals into engineering release decisions.
The principle remains the same:
Evaluation should not be a single model call or a single score. It should be a layered quality system around the AI application.
14. Put Evaluation into the Release Lifecycle
The next step is moving evaluation out of experimentation and into engineering delivery.
When a team changes:
- a prompt,
- model,
- tool,
- deterministic rule,
- policy adapter,
- retrieval configuration,
- semantic judge,
- evaluation threshold,
the candidate release can be evaluated against the golden benchmark.
A reusable release workflow becomes:
Candidate AI Change
↓
500+ Golden Evaluation Cases
↓
Tier-1 Deterministic Evaluation
↓
Selective Tier-2 Semantic Evaluation
↓
Verdict Accuracy + Macro F1 + Confusion Matrix + Policy Precision/Recall + Quality MAE
↓
Regression Comparison
↓
Quality Gate
↓
Release / Review / Block
This turns evaluation from something performed at the end of development into part of the AI delivery lifecycle.
A release is no longer justified only by:
“The new version looks better.”
Instead, teams can ask:
Did overall quality improve?
Did any safety class regress?
Did policy recall decrease?
Did escalation increase unexpectedly?
Did previously fixed failures return?
That is a much stronger production release conversation.
15. Close the Loop with Production
Even 500+ carefully curated cases cannot represent every situation a production AI system will eventually encounter.
That is why the evaluation framework should remain open to learning from production.
The lifecycle becomes:
Golden Dataset
→ Evaluation
→ Quality Gate
→ Production
→ Monitoring
→ New Failure / Edge Case
→ Root-Cause Analysis
→ Human-Reviewed Regression Case
→ Updated Golden Dataset
→ Re-evaluation
New capabilities can also feed this loop.
So can:
- new tools,
- policy changes,
- model changes,
- retrieval changes,
- newly identified risks.
This creates a continuous quality process.
The objective isn't to claim that the evaluation dataset contains every possible future scenario.
The objective is to systematically capture the behaviors and risks we already understand while continuously incorporating newly discovered failure modes.
Figure 4. Continuous evaluation feedback loop in which production failures, new capabilities, tool changes, policy updates, and emerging risks become curated regression cases in the evolving golden dataset.16. A Practical Production Evaluation Checklist
Before trusting an AI evaluation result, I would ask:
Is the golden dataset coverage-driven?
Don't validate benchmark quality using row count alone.
Check capability, risk, verdict, difficulty, adversarial, grounding, and tool-behavior coverage.
Is ground truth isolated?
The evaluator should not have access to expected verdicts or human rationales while producing its prediction.
Are deterministic checks used where appropriate?
Don't pay an LLM to determine something a reliable structural check can prove.
Is semantic evaluation bounded?
Give semantic evaluators explicit evidence, rubrics, schemas, and decision requirements.
Is uncertainty represented?
A system should be able to ESCALATE instead of being forced into an unjustified PASS or FAIL.
Are multiple metrics inspected?
Never rely on overall accuracy alone.
Can safety failures hide inside aggregate metrics?
Inspect confusion direction, policy precision/recall, and safety-specific performance.
Can every FAIL be investigated?
Preserve evidence and decision reasons.
Are evaluation runs reproducible?
Version the dataset, rules, configurations, thresholds, rubrics, and model-dependent components.
Do failures become regression cases?
Previously discovered problems should not be allowed to silently return.
Is evaluation connected to release decisions?
Define what causes:
Release
Review
or
Block
Otherwise evaluation risks becoming a reporting exercise rather than an engineering control.
Closing Thoughts
Building the AI application is only half of the production engineering problem.
The other half is establishing enough evidence to trust how the system behaves when inputs, tools, policies, models, and real-world conditions change.
For us, the 500+ golden evaluation cases became much more than a test dataset.
They became a reusable quality asset.
The dataset defines expected behavior.
Deterministic evaluation verifies what can be objectively proven.
Selective semantic evaluation handles cases where meaning genuinely requires judgement.
Multiple metrics expose different failure modes.
Regression testing protects previously validated behavior.
Versioning makes results reproducible.
Quality gates turn evaluation results into engineering decisions.
And production feedback keeps the evaluation suite evolving.
The architecture can be summarized as:
Golden Dataset → Deterministic Evaluation → Selective Semantic Evaluation → Multi-Metric Assessment → Regression Testing → Quality Gate → Production Feedback
The goal isn't to claim that 500, 5,000, or any finite number of test cases can prove that an AI system will never fail.
The goal is more practical:
Make quality measurable.
Make failures diagnosable.
Make releases defensible.
Make uncertainty explicit.
That, to me, is what turns AI evaluation from a demo metric into a production engineering discipline.
References and Further Reading
Microsoft Learn — Evaluation in Microsoft Foundry
https://learn.microsoft.com/en-us/azure/foundry/concepts/evaluation-overview
Microsoft Learn — Run evaluations from the Microsoft Foundry portal
https://learn.microsoft.com/en-us/azure/foundry/how-to/evaluate-generative-ai-app
Microsoft Learn — Built-in Evaluators Reference
https://learn.microsoft.com/en-us/azure/foundry/concepts/built-in-evaluators
Microsoft Learn — Agent Evaluators for Generative AI
https://learn.microsoft.com/en-us/azure/foundry/concepts/evaluation-evaluators/agent-evaluators
Microsoft Learn — Evaluate your AI agents
https://learn.microsoft.com/en-us/azure/foundry/observability/how-to/evaluate-agent
Microsoft Learn — Observability in Generative AI
https://learn.microsoft.com/en-us/azure/foundry/concepts/observability
Microsoft Learn — Risk and Safety Evaluators for Generative AI
https://learn.microsoft.com/en-us/azure/foundry/concepts/evaluation-evaluators/risk-safety-evaluators
Author: Deepika Ramaraj
The framework and examples in this article describe a generalized engineering approach. Customer names, proprietary policies, customer data, endpoints, and customer-specific implementation details have been removed or generalized.
No RepliesBe the first to reply