Evaluation and monitoring of model output
Traditional software is tested by checking that the same input gives the expected output. AI output varies, is often free text, and can be fluent and wrong at the same time. Evaluation is how you decide whether a model, prompt or retrieval change is good enough to release. Monitoring is how you find out when production quality slips, which it will, without any change on your side.
Without both, quality is judged by whoever complains loudest.
Diagram
Section titled “Diagram”- Every candidate release is scored against fixed test sets before it ships.
- A sample of production requests is scored continuously with the same checks.
- Low-scoring and flagged cases go to people for review.
- Confirmed failures are added to the test sets, so they can't come back unnoticed.
Build test sets first
Section titled “Build test sets first”A test set is a list of realistic inputs with what a good output looks like. Build it before choosing a model or writing a prompt, from:
- Real questions or documents from the domain, collected with the business owners.
- Edge cases: ambiguous questions, missing information, out-of-scope requests, adversarial inputs.
- Every production failure, once confirmed.
A few hundred well-chosen cases beat thousands of generated ones. Version the set, and keep a slice the development team never looks at, so it stays an honest measure.
What to measure
Section titled “What to measure”| Measure | Question | How |
|---|---|---|
| Correctness | Is the answer right? | Compare with a reference answer; exact match for structured output |
| Groundedness | Is every claim supported by the retrieved sources? | Check claims against sources, automatically or by review |
| Retrieval quality | Did search find the passages that contain the answer? | Recall of known relevant passages for each test question |
| Instruction and format | Did it follow the rules and the output schema? | Deterministic checks: schema validation, length, required fields |
| Safety | Did it refuse what it should, and not refuse what it shouldn’t? | Red-team and policy test cases |
| Task success | Did the user get what they needed? | Resolution, escalation and retry rates; user feedback |
| Cost and latency | Is it affordable and fast enough? | Tokens, cost and response time per request |
Measure retrieval separately from generation in RAG systems. When an answer is wrong, you need to know whether search failed or the model did.
How to score
Section titled “How to score”- Deterministic checks wherever possible: does the JSON validate, is the cited document in the retrieved set, is the extracted amount equal to the reference. They’re cheap, fast and reliable.
- Model-graded evaluation (“LLM as judge”): a model scores outputs against a rubric. It scales to free text, but judges have biases (preferring longer answers, or answers from their own model family). Check the judge against human ratings on a sample before trusting it, and keep the rubric specific.
- Human review: the reference standard, and expensive. Use it to calibrate automatic scoring and on samples of production traffic, not on everything.
Set release thresholds before running the evaluation, per metric: for example, “no drop in groundedness, and correctness at least 90% on the golden set”. Deciding afterwards invites rationalizing a regression.
Monitoring in production
Section titled “Monitoring in production”- Sample and score a share of live traffic with the same automatic checks.
- Collect feedback: thumbs up or down, edits users make to drafts, escalations to a human, repeated questions.
- Watch for drift: changes in the kinds of input (new products, new topics, a new language), and in score distributions over time.
- Watch the model itself: hosted models can change behind the same name. Pin versions, and rerun the evaluation suite when a provider announces a change.
- Alert on quality, not just errors and latency. A sudden rise in refusals or a fall in groundedness is an incident.
- Releases are decided on evidence, and regressions are caught before users see them.
- Production problems surface in hours, not when a customer escalates.
- A record of quality over time, which governance and auditors will ask for.
- Building and curating test sets takes the time of domain experts, not just engineers.
- Automatic judges are imperfect and need ongoing calibration.
- Storing samples of production inputs and outputs creates a privacy obligation.
Common pitfalls
Section titled “Common pitfalls”- Evaluating on examples the team tuned the prompt against, so scores measure memory, not quality.
- One overall score that hides a collapse in one important category.
- Judging with the same model that generated the answer, with no human calibration.
- No owner for the test sets, so they stop reflecting real use.
Related patterns
Section titled “Related patterns”- MLOps and LLMOps: where the evaluation gate sits in the release path
- Human-in-the-loop approval
- Observability
Further reading
Section titled “Further reading”- NIST AI 600-1, the Generative AI Profile (opens in a new tab), which lists measurement actions for generative AI risks
- AI system readiness checklist
Written and edited by Abhinav Taduka, enterprise software architect.
New pages are added regularly. Follow Abhinav on LinkedIn to see them first.