Insights · AI engineering

How to make generative AI reliable in production

A demo shows that AI can do a task. Production needs proof that it does the task well, safely and at a known cost, every time the model, prompt or data changes.

Short answer: treat an AI feature like any other software that has to meet a standard. Agree what "good" means before you build, measure it with an evaluation set of real examples, test it against misuse, put guardrails and a human handover path around it, and track its cost per transaction. Then re-run the evaluation whenever the model, prompt or data source changes, because each of those can quietly change the results.

Key points

  • Define success as a number, such as accuracy, handover rate or cost per answer, before building.
  • Build an evaluation set from real questions and documents with expected answers.
  • Test adversarial, out-of-scope and prompt-injection inputs before release.
  • Set a confidence threshold below which a person takes over, with the context passed along.
  • Re-run the evaluation on every model, prompt or data change, and monitor in production.

Why "it worked in the demo" isn't enough

Generative AI is very good at producing plausible output, which makes demos convincing. But a demo uses a handful of friendly examples. In production the feature meets thousands of real inputs: unclear questions, unusual documents, missing data and the occasional user trying to make it misbehave. Without measurement you only find out how it performs when something goes wrong.

Models also change underneath you. A provider's model update, a reworded prompt or a new set of source documents can improve one thing and break another. Reliability means being able to see that happen before your users do.

1. Start with a job and a number

Pick one process that costs time or money today, such as answering policy questions, extracting data from claims or triaging incoming requests, and agree how success will be measured. Typical measures are:

  • Accuracy: the share of answers or extracted fields that are correct.
  • Groundedness: whether each answer is supported by the source it cites.
  • Handover rate: how often the AI passes the task to a person.
  • Cost per transaction: what each answer or document costs to process.

2. Build an evaluation set

An evaluation set is a collection of real inputs with the answers you expect: real questions, real documents, real edge cases. Score the AI against it automatically for accuracy and groundedness. Start with a set big enough to cover the common cases and the known awkward ones, and add every production failure to it so the same mistake can't come back unnoticed.

The evaluation set is what turns AI quality from opinion into evidence. It is also what lets you compare models and providers fairly when prices and capabilities change.

3. Test it the way it will be misused

Before release, test with adversarial prompts, out-of-scope requests and prompt-injection attempts, where instructions are hidden inside a document or message to make the AI ignore its rules. Check that the feature refuses or hands over instead of improvising.

4. Put guardrails around it

  • Input and output filtering to block unsafe content and personal information that shouldn't be shown.
  • Data-access controls so the AI only retrieves what the current user is already allowed to see.
  • Explicit limits on what the AI may do or say, especially for agents that can update records or send messages, with approval steps for anything consequential.
  • Citations back to the source document, so people can check an answer quickly.

5. Design the human handover

No AI feature should be expected to handle everything. Define a confidence threshold and clear rules for when a person takes over, and pass the full context along so the customer or colleague doesn't have to start again. A well-designed handover is what makes it safe to automate the cases the AI does handle well.

6. Know what it costs to run

Set a target cost per answer or document and track it in production. Route simple requests to smaller, cheaper models and keep larger models for the hard cases. A model-agnostic design, with an abstraction layer between your application and the AI provider, lets you change providers as prices move without rebuilding the feature.

7. Keep testing after launch

Run the evaluation set automatically whenever a model, prompt or data source changes, and block the change if quality drops. In production, monitor accuracy signals, handover rates, latency and cost, and review a sample of real conversations regularly. Reliability is a process, not a launch milestone.

Questions we're often asked

How do you stop generative AI from hallucinating?

You can't make hallucination impossible, but you can make it rare and visible. Ground answers in your own approved documents, require citations, score groundedness on an evaluation set, and hand over to a person when confidence is low.

How big should an AI evaluation set be?

Big enough to cover your common cases and your known awkward ones, which for a focused feature often means a few hundred real examples to start. More important than size is that the examples are real and that every production failure is added to the set.

Do we need to retest when the AI provider updates its model?

Yes. A model update can change behaviour in ways that aren't announced. Re-run the evaluation before adopting the new version, and keep the option to stay on the previous one until it passes.

This is how we build AI for clients; see how we make AI reliable and how client data is protected in the trust centre.

Want this applied to your own systems?

Your first conversation is with a senior engineer, who'll tell you honestly whether we can help and what it would take.