Taming the Beast: Testing AI When the Answer Keeps Changing

Same input, different answer, and the test still has to mean something

Every tester knows the sinking feeling of a flaky test. Now picture a system where every test is a little flaky by design. That is what testing AI-enabled features feels like, and it is the problem I'll dig into at TestCon 2026 in my session, Taming the Beast: Testing the Unpredictable with Confidence.

Most teams building with AI today aren't training models. They're integrating them: a support chatbot, a RAG-powered product assistant, a summarization feature, an agent that can issue refunds. The engineering feels familiar. The testing doesn't. "Assert the output equals the expected string" stops working the moment one input produces three different, equally reasonable answers.

Here's the good news after 30-plus years in software quality: this is still software testing. The fundamentals hold. What changes is the toolkit, and more importantly, the mindset. Below is a preview of what I'll cover.
‍

Why traditional testing breaks down

Ask an AI feature to summarize the same research article three times and you'll get three summaries that differ in structure, style and tone. If every output is different, how do you decide which ones are "correct"?

Non-determinism in AI models stems from several factors, and each source calls for a tailored testing approach:

  • Sampling parameters (temperature, top-p, top-k) can be tuned but never guarantee determinism. Run each test many times and report a pass rate.
  • Model version drift occurs when providers update models between your test runs. Version-pin, and monitor for behavior change.
  • Context variation in RAG systems means a tiny query change can pull different documents. Test the retrieval, not just the generation.
  • Tool use brings in APIs, search results and database state that change over time. Mock the external calls and test the agent's decisions.

The practical consequence is a shift from binary to statistical thinking. A single green check tells you very little. A distribution of results across repeated runs and perturbed inputs tells you a lot.
‍

Spec first, then read the traces

A common trap is writing evaluation criteria before anyone has actually read the outputs. Specs tell you what to check first. The traces tell you what those checks will miss.

Start with what the requirements already give you. For a product support assistant, that might be: every answer includes at least one citation, citations link to published documentation, responses stay under the length limit, and no internal document IDs appear in the reply. Those become cheap, deterministic assertions.

Then do the error analysis nobody wants to do:

  1. Sample about 100 traces, including ones that pass your deterministic checks.
  2. Add one note per trace: the first thing that went wrong.
  3. Cluster the notes into named failure modes.
  4. Prioritize by frequency and impact.
  5. Build one assertion, scorer or pass/fail judge per mode.

In an illustrative run of that exercise, the top failure modes might be stale sources cited, invented product details, partial answers and out-of-scope answers. None of them would show up in a spec. That's the point: the failures that hurt you most are usually the ones no requirement predicted.
‍

Layer your evaluation

No single technique tames the beast. The modern AI test stack is layered, and each layer trades cost for judgment. From cheapest and most deterministic to most expensive and most subjective:

  1. Deterministic assertions: schema, required fields, format.
  2. Reference-based metrics: semantic similarity to a known-good answer.
  3. Reference-free metrics: coherence, fluency, faithfulness.
  4. Specialized scorers: domain-specific checks and hallucination detection.
  5. LLM-as-a-judge: subjective qualities such as helpfulness, tone and safety.
  6. Human review: sampled, structured and focused on edge cases.

How you use the stack depends on where you are. When getting started, work top-down: write deterministic checks from the spec, read traces to find what they missed, then build judges. In steady state, run bottom-up, so cheap filters catch the obvious problems before the expensive layers ever see them.

Two habits keep this sustainable. Separate traditional tests from tests that call a model, so you control cost. And log every input, output and evaluation, so a human can review what the automation decided.
‍

A judge is a test instrument. Measure it like one.

LLM-as-a-judge is powerful: it can be orders of magnitude cheaper than human review. Early work (Zheng et al., 2023) found GPT-4 judges reached over 80% agreement with human preferences, the same level humans reach with each other, but later studies show reliability varies sharply by task and judge. That's enough to catch regressions. It is not enough to support an absolute quality claim. Treat the judge as software that can have bugs.

Judges fail in predictable ways. They show position bias in pairwise comparisons, prefer longer answers, favor outputs from their own model family, flip verdicts on small formatting changes, and perform near chance on adversarial safety inputs. The mitigations are just as concrete:

  • Never use the application's own model as its judge.
  • Use one pass/fail judge per criterion, with detailed instructions and examples of pass and fail.
  • Ask for the reasoning before the verdict.
  • Evaluate pairs in both orders and count only consistent wins.
  • Use a panel of judges for high-stakes evaluations.

Most importantly, validate the judge before you trust it. Split your human-labeled traces into a dev set (to tune the judge prompt) and a test set (measured once, at the end). Then track two numbers, not one: the share of real failures the judge catches, and the share of real passes it confirms.

Why not a single agreement percentage? On 100 traces with 8 real failures, a judge that passes everything agrees with humans 92% of the time and catches none of the failures.

The same discipline applies when you report results. Take an illustrative example: if release N-1 scored 91% and release N scored 88% on a 200-case eval set, that looks like a regression. Pair the cases and measure the change, though, and the interval around the -3.0 point drop crosses zero. You may be looking at noise. A judge is a test instrument with a known error rate; report it the way you'd report any measurement.

‍

‍

Agents: grade the output and the path

Agentic systems raise the stakes. A single LLM call becomes a chain of 5 to 50+ calls, state propagates from step to step, and one judge score is no longer enough. Consider a refund agent that tells the customer, "Your refund of $89 has been processed." The reply looks perfect. The database shows a refund of $890.

That's why I grade agents on three things:

  1. The end state. Compare the records after the conversation with the expected goal state.
  2. The path. Right tools, right order, valid parameters, policy checked before acting. In the refund example, every step was right except one parameter.
  3. Reliability. pass@k is the chance one of k attempts succeeds; pass^k is the chance all k succeed. On tau-bench's retail tasks, GPT-4o succeeded on a single attempt 61% of the time, but all eight attempts succeeded less than 25% of the time (Yao et al., 2024). Newer models score much higher on one attempt; the drop across repeated attempts is the metric that matters.

A customer only ever sees one attempt. Reliability means every attempt works.

Security deserves the same rigor. Refusal tests tell you whether the model resisted a prompt injection. Just as important is testing what happens when an injection gets through. Don't wait for the model to be fooled: plant the payload or force the call, then assert deterministically on the trace. No call to an unapproved tool. No outbound call containing private content. Agent credentials that can't read another customer's records. Rendered links and images that resolve only to approved domains. Refunds, sends and deletes above a limit that require confirmation. These tests are deterministic and cheap.
‍

Calibrate by risk, and make evaluation continuous

Not every AI feature needs the full stack. The right depth depends on what a failure costs:

Risk level Examples What must be checked
Very low Brainstorming, internal drafting Format and schema assertions; no judge needed
Low FAQ bots, recommendations Plus pass/fail judges for the top failure modes
Moderate Support answers, summarization, RAG assistants Plus grounding scorers and retrieval checks
High Hiring, credit, healthcare, legal-adjacent Plus bias and fairness checks, a judge panel and human review in the loop

In high-risk use cases, a missed failure costs more than a false alarm, so tune your checks to catch failures and budget human review for the extra false alarms. Set thresholds from your own observed distributions; published numbers don't transfer across embedding models or domains. And remember that regulatory classification can set the floor, so thresholds need to hold up in an audit.

Finally, close the loop. Traditional QA already reviews production bugs for the regression suite, or at least it should. In AI QA, that loop becomes automated and continuous. Production traces flow into an observability platform. Implicit user signals such as abandoned conversations, escalations and repeated rephrasing flag obvious failures, though only a small fraction of users ever signal. Automated scoring covers the rest by sampling 5–10% of traffic plus 100% of high-risk categories. Humans confirm and categorize what's flagged, and it goes straight into the regression suite.

The same scorers protecting your CI pipeline are now sampling production. Failures surface proactively, and your test suite grows continuously instead of bug by bug.
‍

Join me at TesCon 2026

I'll be presenting Taming the Beast: Testing the Unpredictable with Confidence at TesCon 2026 on Wednesday, Oct 21st at 10:10. If you're a tester, QA lead or engineering leader shipping AI-enabled features, you'll leave with:

  • A clear mental model for why traditional testing breaks down on AI-enabled features
  • Practical techniques for validating non-deterministic output
  • Real-world patterns from customer support chatbots, RAG assistants and agentic systems
  • A view of the skills your team needs to start building, from statistical thinking and eval-set design to RAG and agent testing

You don't need to become an ML engineer to test AI well. Curiosity, analytical rigor and solid test design still do most of the work; the new layer is learning to measure behavior instead of matching strings. It's still software testing. It just asks more of us.

If you'll be at TesCon, I hope you'll join the session. If you can't make it, let's continue the conversation: reach me at lee.barnes@fortegrp.com, or on LinkedIn.

‍

Sources

‍

‍

About the author

Lee Barnes
Chief Quality Officer at Forte Group

You may also like

Transform AI into a Scalable Delivery Capability

83% faster delivery. Under 10% rework. See exactly how Xceptor got there.