Why AI Testing Is a Different Problem

Traditional testing assumes code either works or it doesn't. AI features don't work that way. This guide covers what changes and how we test them.

Standard testing doesn't map onto LLMs

When you write a function, you can assert the output. When you call an LLM, you get a range of possible outputs. That one difference changes how you have to test.

Non-determinism

The same prompt can return different outputs on every call. You can't write a simple assertEqual. Any evaluation method that requires exact string matching will miss most real failures and cry wolf on acceptable variation.

No ground truth

For most LLM tasks like summarisation, tone, helpfulness, and reasoning quality, there's no single correct answer. Instead of one expected output, you need a rubric that describes a good answer. Agreeing on what "good" means is often the hardest part.

Emergent failure modes

LLMs fail in ways that don't exist in traditional software: hallucination, sycophancy, prompt injection, context confusion. You can't find these by reading the code or checking logs. You find them by probing the model's behaviour directly.

LLM failure modes, explained

Most AI features in production run into several of these. Here's what each one looks like and what to test for.

Hallucination

Confident fabrication

The model generates plausible-sounding content that is factually wrong: invented citations, non-existent regulations, made-up product specs. The danger is the confidence: users can't tell the difference.

  • Factual claims with no grounding in context
  • Cited sources that don't exist
  • Numbers and dates that are just wrong
  • Over-extrapolation from partial information
Prompt Sensitivity

Fragile prompt behaviour

Small changes to phrasing, such as a different word order or an added sentence, can produce dramatically different outputs. This makes prompt engineering feel like whack-a-mole: fix one thing, break another.

  • Output changes with semantically identical prompts
  • Fixes in one area silently break another
  • Different behaviour across model versions
  • Language or locale sensitivity
Safety & Guardrails

Bypassed safety layers

Safety instructions in a system prompt can be worked around. Creative inputs get past them, and users find these paths, on purpose or by accident.

  • Jailbreaks via roleplay or hypothetical framing
  • Prompt injection from user-controlled content
  • Indirect policy violations through multi-turn context
  • Guardrail bypasses via language switching
Agents & Tools

Agents that take the wrong action

When an AI can call tools or take actions, a wrong answer becomes a wrong action. Agents can pick the wrong tool, pass it the wrong inputs, stop halfway through a task or act without asking.

  • Wrong tool, or the right tool with wrong arguments
  • Multi-step tasks left half done
  • No recovery when a tool or MCP server fails
  • Risky actions taken without confirmation
RAG & Retrieval

Retrieval pipeline failures

If your product uses RAG, the LLM's output quality is only as good as what it retrieves. The model can ignore retrieved context, misattribute it, or blend it incorrectly with its training knowledge.

  • Ignoring retrieved context entirely
  • Contradicting source documents
  • Mixing training knowledge with retrieved facts
  • Citation errors in grounded responses
Regression

Silent regression on update

Model providers update their models without always announcing what changed. Prompts that worked before may behave differently after the next update. Without automated evals, you won't know until users tell you.

  • Model version updates with no changelog
  • Prompt changes that break unrelated flows
  • Fine-tune updates altering base behaviour
  • System prompt interactions that shift over time

How LLM evaluation actually works

Exact-match assertions don't work, so you need other ways to measure quality. These are the main approaches, each with its own trade-offs.

Human Evaluation

A human rates outputs against a rubric. Highest quality signal. Slow and expensive to scale. Essential for establishing ground truth on a calibration set.

LLM-as-Judge

A separate, strong model scores outputs against your rubric. Fast and scalable, but the judge has its own biases, so its prompts need careful design.

Custom Rubrics

Scoring criteria written for your use case. For example: does this answer follow our tone policy and answer what the user actually asked?

Regression Suites

A fixed set of test cases with expected behaviour. Run automatically on every prompt or model change. The closest thing to unit tests for LLM behaviour.

What we use and why

No single tool covers everything, and the right mix depends on your product. This is what we use most and what each is good at.

AI Agent Skills

Agent skills we build for each product, with our testing knowledge and heuristics built in. They work out what needs testing for a change, test it and report what they found.

SHAP / LIME / PDP

Explainability tools used in ML testing engagements. SHAP and LIME explain individual predictions, while PDP plots reveal how features influence model behaviour globally.

Custom Harnesses

When off-the-shelf tools don't fit, we build lightweight Python eval harnesses around your inputs, outputs and scoring criteria.

Exploratory Testing

Not everything can be automated. Hands-on exploration finds new kinds of failure, especially around guardrails and edge cases, and is part of every engagement.

LLM-as-Judge

A strong model scores outputs at scale. We design the judge prompts carefully and check them against a set of human-rated answers first.

Pytest + CI

For teams that want evals in their existing workflow. Wrapping LLM checks in Pytest means regressions show up in the same pipeline as your other tests.

Want to talk through your specific situation?

Every LLM product has different failure modes. Bring yours and we'll figure out where to start.

Book a Free Call