Book a free call

How to Test LLMs in Production: A Practical Guide

Testing an LLM in production means checking live answers against a fixed set of cases, watching quality drift, and rolling back fast when scores fall.

Hertiv engineering teamReviewed by a senior engineer
5 min read
How to Test LLMs in Production: A Practical Guide
On this page

Short answer

Testing LLMs in production means running live prompts and answers through checks after release: a fixed evaluation set scored on every deploy, shadow testing of new prompts, live monitoring of failure rates and costs, and guardrails that block bad output. When a score falls below its threshold, the team rolls back the prompt or model and investigates before shipping again.

What does testing an LLM in production mean?

Testing an LLM in production means checking the model's live answers after release, not just before it. Pre-release tests prove the model can answer a sample set; production tests prove it still answers well on real traffic, with real data, real users and real edge cases.

It is different from general model testing because the input is uncontrolled. Users phrase questions in unexpected ways, documents change, and a prompt that worked in a demo can fail on the tenth variation. Production testing catches that drift while customers are still using the system.

The core idea is simple: keep a fixed set of cases with known good answers, score the live system against them on a schedule, and watch live signals such as failure rate, cost and user feedback. When a number moves, investigate before it becomes a customer complaint.

How do you build an evaluation set for production?

An evaluation set is a fixed collection of real cases with known good answers, used to score the system the same way every time. Without one, every quality discussion is anecdotal, because nobody can say whether the system got better or worse.

Case type What it checks Example
Common questions Everyday accuracy Refund policy, opening hours
Hard cases Edge handling Two products with similar names
Tricky inputs Injection resistance Instructions hidden in pasted text
Format cases Output structure JSON fields, citations present
Costly failures High-risk answers Pricing, safety, legal claims

Build the set from real traffic: past tickets, chat logs and support calls, labelled by a person who knows the right answer. Aim for 100 to 200 cases to start, covering the common, the hard and the risky. Refresh it when the product changes, and keep old versions so scores stay comparable.

How do you test a new prompt before release?

A new prompt should be tested before release with shadow testing and a canary rollout. Shadow testing runs the new prompt on live traffic without showing its answers to users, so you can compare it with the current version on real inputs.

Score both versions on the evaluation set first, then run the shadow test for a few days and compare failure rates, cost and answer quality. Only promote the new prompt when it beats the old one on the cases that matter, not just on average.

A canary rollout then shows the new prompt to a small share of users, such as 5%, while the rest stay on the old version. Watch the same signals for a day or two, then raise the share in steps. If a metric falls, roll back to the old prompt in minutes. For the basics of model testing, how to test AI models covers the pre-release side of this work.

What should you monitor once the LLM is live?

Once an LLM is live, monitor four things: answer quality, failure rate, cost and user feedback. Quality comes from the evaluation set, run on a schedule. Failure rate comes from guardrail blocks, empty answers and user corrections. Cost comes from token usage per task. Feedback comes from thumbs up and down, escalations and support tickets.

Set a threshold for each signal and an alert when it is crossed. A useful threshold is a drop of more than a few points on the evaluation set, or a failure rate that doubles in a day. Alerts should go to the person who can roll back, not to a mailing list nobody reads.

Log every prompt, answer, source and decision, so a bad answer can be traced back to its cause. Without logs, debugging is guesswork. LLM evaluation explains how to define the scores and thresholds that make monitoring meaningful.

How do guardrails and rollback work?

Guardrails and rollback are the safety net that makes production testing practical. Guardrails check answers before they reach users, and rollback returns the system to a known good version when a check fails.

  1. Check the format. Reject answers that miss required fields, citations or structure before sending them.
  2. Check the facts. Verify figures, dates and prices against your data, and block answers that contradict it.
  3. Check for injection. Scan inputs and retrieved text for instructions the user never gave.
  4. Limit the blast radius. Cap retries, spending and tool actions per request, so one bad prompt cannot loop.
  5. Keep the old version ready. Store the last good prompt and model settings so rollback takes minutes, not hours.

Test the rollback itself. A rollback that has never been practised is a hope, not a plan. Run a drill each quarter: deploy a deliberately bad prompt to a canary, watch the alert fire, and roll back.

Example (hypothetical): a support team ships a new prompt

Example (hypothetical): a support team runs an LLM over 200 test cases, and the current prompt answers 172 correctly, which is 86%. The team writes a new prompt that should handle refund questions better, and scores it at 181 of 200, or about 91%.

The team shadow-tests the new prompt for three days on live traffic. It answers 1,500 real questions, and the guardrail blocks 18, or about 1%, for missing citations. The canary rollout to 5% of users shows no rise in escalations, so the team raises the share to 50%, then 100% over the next two days.

A week later the evaluation set score falls to 164 of 200, or 82%, after a help centre update. The alert fires, the team rolls back to the previous prompt in minutes, fixes the outdated articles, and re-runs the set. The score returns to 179 of 200 before the new prompt ships again.

What are the common mistakes?

The most common production testing mistakes are testing once and stopping, trusting averages, and having no rollback plan.

  • Testing only before launch. Live traffic changes. Score the evaluation set on a schedule, not once.
  • Trusting averages. A 90% average can hide a 40% score on the risky cases. Report scores by case type.
  • No canary step. Shipping a new prompt to everyone at once turns a small regression into a large incident.
  • Ignoring cost. A prompt that is 2% better but twice as expensive is not a win. Track cost per task.
  • No rollback drill. If rollback has never been practised, it will be slow when it matters most.
  • Skipping logs. Without prompt and answer logs, a bad answer cannot be explained or fixed.

Key takeaways

  • Production testing means scoring live answers on a fixed evaluation set, on a schedule
  • Shadow-test new prompts on real traffic before users see them
  • Monitor quality, failure rate, cost and feedback, with alerts to the person who can roll back
  • Guardrails check format, facts and injection before an answer reaches a user
  • Practise rollback, so a bad deploy can be reversed in minutes

Frequently asked questions

How is production testing different from pre-release testing?

Pre-release testing checks the model on a sample before launch. Production testing checks live answers on real traffic after launch, including drift, new phrasings and changed documents. Both are needed; pre-release testing cannot predict how real users will phrase questions.

How many cases should an evaluation set have?

Start with 100 to 200 cases covering common questions, hard cases, tricky inputs, format checks and costly failures. That is enough to spot a real regression without taking days to score. Grow the set as new failure modes appear in live traffic.

What is shadow testing?

Shadow testing runs a new prompt or model on live traffic without showing its answers to users. You compare its answers with the current version on real inputs, so you can judge quality and cost before anyone depends on it.

How often should the evaluation set run?

Run it on every prompt or model change, and on a schedule such as weekly for live systems. A score that falls by more than a few points should trigger an investigation, and a larger fall should trigger a rollback.

What guardrails matter most for LLMs?

Format checks, fact checks against your own data, injection scans and action limits matter most. They catch the failures that cost money or trust: wrong figures, invented sources, instructions from untrusted text and runaway tool calls.

How do you test an LLM without real user data?

Start with cases written from past tickets, help centre articles and product docs, then add real traffic as it arrives. Synthetic cases help, but they cannot replace real phrasings, so refresh the set from live logs regularly.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Shipping an LLM to production and want the testing to hold up? Talk to Hertiv.

A senior engineer replies within one business day. Or see our LLM Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call