JEEKSSHIRE 24

Testing AI features: how to check the quality of a neural network in your product

Conventional tests check that a program always returns the same result for the same input. An AI feature does not work that way: model answers vary from run to run, and a correct answer can often be phrased in many ways. So AI is tested differently. You collect a set of test examples from real tasks, agree in advance on what counts as a good answer, and run the whole set every time the prompt, the model or the knowledge base changes. Scoring is automatic — with rules and with another model — plus regular spot checks by a subject-matter expert. Security is tested separately: attempts to bypass instructions, data leaks and actions taken without permission.

Open the software development page

How an AI feature differs from ordinary code

In an ordinary program a bug is reproducible: the same data gives the same result. A language model produces probabilistic output, and its behaviour depends on how the request is worded, on the context, on the model version and even on which documents were retrieved from the knowledge base. That is why one successful demo proves nothing: you need to see how the feature behaves on dozens or hundreds of typical and difficult cases.

Ordinary tests do not disappear. The code around the model — document loading, tool calls, access rights, parsing the answer — is covered by classic automated tests, as described in the guide software testing. New methods are added only for the part where the model produces the answer.

A set of test examples

The foundation of testing is a set of examples: input data plus a description of what a good answer looks like. It is assembled before development or at the very start, not after the first complaints. The set should include:

For each example you do not have to record the exact wording of the answer. You record criteria instead: which facts must be present, what must not appear, and what format the result should take. That way the check does not depend on the exact words the model chose.

What to measure and how

What is checkedHow it is scoredExample
Factual accuracycomparison with a reference or sourcethe amount and deadline were extracted correctly from the contract
Grounding in sourcesis there a reference to a document, is anything inventedthe answer cites the right clause of the internal policy
Formatautomatic structure checkthe answer is valid JSON with the required fields
Refusal and hand-offdoes it trigger where it shouldfor a question outside the knowledge base the assistant does not make up an answer
Tone and stylemodel scoring against a rubric plus spot checks by peoplepolite, concise, no promises on behalf of the company
Speed and costmeasuring time and spend per requestthe answer arrives within an acceptable time

You do not need to measure everything at once. What matters is choosing two or three criteria that drive business value, tracking them constantly, and adding others as needed.

Automatic scoring: rules and a judge model

Some checks are done with simple rules: does the extracted number match, is a mandatory field present, are there forbidden words, does the answer fit the length limit. For free text a second, judge model is used: it receives the question, the answer, the source and a rubric — a description of a good answer — and is asked to give a score with an explanation.

A judge model is convenient but makes mistakes of its own. So its scores are regularly compared with human scores on a small sample, and the rubric is written concretely: not "the answer is good" but "the deadline is stated, the source is cited, no discount is promised". The more precise the rubric, the closer the model's score is to the expert's.

Human review

Automatic scoring does not replace a subject-matter expert. A lawyer notices an imprecise contract wording that no rule will catch; a support agent knows which answer will annoy a customer. So before launch, and regularly afterwards, an expert reviews a sample of answers.

It helps when the expert has a simple form: a score, a comment and the correct version. All of this goes straight into the example set and becomes part of the next runs. The expert's knowledge is not lost but accumulates in the testing system.

Checking after every change

The most common trap is improving one scenario and quietly breaking another. A prompt edit, a model switch, new documents in the knowledge base, a model update by the provider — any of these can change behaviour. So the set is run before every release in the same order:

  1. record the versions of the prompt, the model and the knowledge base;
  2. run the whole example set;
  3. compare the metrics with the previous run and review the cases that got worse;
  4. release only if the key metrics have not dropped;
  5. save the results of the run so there is something to compare with next time.

This is the same discipline as releasing only from a green build in ordinary development; instead of "the test passed or failed" you compare metrics with the previous version.

A pilot before full launch

After runs on the example set, a pilot is useful: the AI works on real traffic, but its results are first seen only by an employee, not by the customer. The employee compares the AI draft with their own decision and marks the differences. This checks what the example set does not cover: the real wording of requests, the quality of incoming documents, speed at peak hours.

A pilot is usually limited to one process, one department or a share of requests. Its results show what share of tasks the AI handles without edits, where it errs systematically and whether some steps can move to autonomous operation. If the result is worse than expected, that is not a failure but information: often it is enough to extend the knowledge base or narrow the task. More on pilots in the guide AI implementation in business.

Security and abuse tests

A separate block covers attempts to make the system do what it must not. Testers check how it reacts to instructions hidden in an email or document, to requests to show someone else's data, to attempts to steer the conversation off topic. If the AI has tools — sending emails, changing records — they check that important actions are not executed without human confirmation. More on this in the guide AI agent security, and on where exactly a person is needed in the guide human in the loop for AI.

Testing after launch

Testing does not end at launch. Real users ask questions that were not in the set, documents go out of date, the provider updates the model. So after launch the team collects feedback, reviews a sample of conversations and adds new cases to the set. How to organise this monitoring is covered in the guide AI solution maintenance after launch.

How we test AI features at JEEKSSHIRE 24

We run our own AI product in production — Legal, where AI helps draft, review and edit contracts. It shows clearly why a single demo is not enough: legal text demands precision, and an error in one wording changes the meaning of a document. That is why in Legal the decision stays with the user, and the app states plainly that it does not replace a lawyer.

In client projects we build the example set together with the client's experts, agree on quality criteria before development and run the set before every release. More on the AI agent development page; describe your task on the custom software development page.

Frequently asked questions

How many examples are needed to test an AI feature?

There is no exact number. A few dozen examples covering the main and the difficult cases are enough to start; the set grows as new errors are found. Variety of cases matters more than their number.

Can AI be tested once before launch?

No. Behaviour changes when the prompt is edited, the model is switched, the knowledge base is updated and even when the provider updates the model. The example set is run before every release and regularly after launch.

Can you trust a score given by another model?

Partly. A judge model speeds up testing, but its scores are compared with human scores on a sample and it is given a concrete rubric. A person makes the final call on disputed cases.

Who should write the test examples?

Subject-matter experts together with developers: a lawyer for contracts, a support agent for customer answers. The developer knows how the system works; the expert knows which answer is actually right.

What if the AI makes mistakes in rare cases?

Add those cases to the example set, find the cause — missing data, an unclear instruction, a weak model — and for risky scenarios set up a hand-off to a person instead of an automatic answer.

How do you check that the AI does not leak confidential data?

Include attempts to obtain other people's data and hidden instructions in the set, limit the AI's access to the sources it needs, and test this before every release rather than once.

Is a dedicated tester needed for AI features?

Not necessarily a dedicated one, but someone must own the example set and the runs. In a small project the developer does this together with the client's expert.

How is testing AI different from testing ordinary software?

An ordinary test expects an exact result, while AI answers vary from run to run. So AI is scored against criteria on an example set and metrics are compared between versions instead of checking for identical text.

How often should the example set be run?

Before every release: when the prompt is edited, the model is switched or the knowledge base is updated. A scheduled run is also useful to catch changes the provider made to the model without notice.

What if a new model is better at one thing and worse at another?

Look at which cases got worse and how much they matter to the business. Adjusting instructions for the new model often helps; if not, keep the old model for that task or split tasks between models.

IP geolocation by DB-IP