Home / AI System Design

LLM Evaluation: Code Checks First, Model Judges Second

 ·  November 25, 2026  ·  5 min read

Evaluating an AI system works best per step and in layers. Code checks run first on every output: schema, required fields, lengths, allowed values and business rules. Model-based review runs second, only on qualities code cannot judge, using a written rubric. Test sets of real tasks measure each step before release, and production logs of check results catch drift after release.

Teams often evaluate AI systems by reading a few outputs and deciding they look good. That works until volume grows, prompts change or the model is updated. A designed system evaluates itself on every run, cheaply, and tells you which step is failing.

Layer 1: code checks

These cost nothing and catch most failures. Run them on every output of every model step:

  • Does it parse, and does it match the schema?
  • Are all required fields present and non-empty?
  • Are lengths within limits?
  • Are values from the allowed set, such as categories, IDs and dates in range?
  • Do business rules hold, such as totals adding up or no prices that do not exist?
  • Are banned words or claims absent?

The agent spec for the page builder I run lists 94 checks like these, numbered and run before any model review. When a check fails, the step gets the specific error and one retry.

Layer 2: model review with a rubric

Some qualities need judgement: tone, relevance, whether a claim is supported by the source. Use a model reviewer with a short written rubric that scores specific criteria, not a vague "is this good". Run it only on outputs that passed code checks, and on a sample if volume is high.

Layer 3: test sets before release

For each step, keep 30 to 100 real examples with known good outcomes. Run the step on all of them whenever you change a prompt, a model or the retrieval. Compare pass rates to the last version. This is how you know a cheaper model or a shorter prompt did not hurt quality.

Layer 4: production monitoring

Log the result of every check with the step, model, prompt version and cost. Watch pass rates over time. A falling pass rate on one step points straight at the cause: a model update, a data change, or a prompt edit.

Why per step

End-to-end evaluation tells you the system is worse. Per-step evaluation tells you where. In a system split into agents with structured handoffs, each boundary is a natural checkpoint, which is one of the main payoffs of designing the system instead of writing one big prompt.

An LLM evaluation framework in one table

LayerWhen it runsCostCatches
Code checksEvery outputFreeFormat, missing fields, limits, rule violations
LLM as judge with rubricOutputs that passed code, or a sampleTokensTone, relevance, unsupported claims
Test set regressionEvery prompt, model or retrieval changeTokens, once per changeQuality drops from changes
Production monitoringContinuouslyLogging onlyDrift from model updates or data changes
Human reviewSamples and escalationsPeople timeWhat everything above missed

LLM evaluation metrics that matter

  • Check pass rate per step: the share of outputs passing code checks first time.
  • Rubric score: average and distribution, per criterion.
  • Retry rate: how often a step needs a second attempt.
  • Human override rate: how often people edit or reject output.
  • Cost and latency per completed task.

LLM as judge: making it trustworthy

A model judging another model's output is useful and fallible. Write the rubric as specific yes or no questions, give the judge the source material it should check against, use a different model or at least a different prompt from the generator, and spot-check its verdicts against human judgement regularly.

How I evaluate my systems

Every system on my systems page runs code checks on every model output, and the page builder's spec numbers its checks so failures can be traced in logs. It is the difference between a demo and a system you can leave running.

LLM evaluation tools

Evaluation platforms help store test sets, run experiments across prompt and model versions, score outputs and compare results over time. They are worth adopting once you have several steps and frequent changes. Before that, a spreadsheet of test cases, a script that runs them and a table of results gets you most of the value. The discipline matters more than the tool.

Building your first test set

  1. Collect 30 to 100 real inputs for one step, including awkward ones.
  2. Write the expected output or the criteria a good output must meet.
  3. Write code checks for everything that can be checked by rule.
  4. Write a short rubric for the rest.
  5. Run the current version and save the results as the baseline.
  6. Run every future change against it before release.

Frequently asked questions

How do you evaluate an AI system?

Evaluate each step in layers: code checks on every output for schema and rules, rubric-based model review for qualities code cannot judge, test sets of real examples before each release, and logging of check results in production.

What is the difference between code checks and model checks?

Code checks verify things that can be written as rules, such as format, required fields, lengths and allowed values, at no cost. Model checks use a model with a rubric to judge qualities like tone or relevance, and cost tokens, so they run only where needed.

How big should an AI test set be?

Thirty to one hundred real examples per step is usually enough to compare versions of a prompt or model and see whether pass rates changed.

What is LLM as a judge?

LLM as a judge is using a language model to evaluate another model's output against a rubric, such as relevance, tone or factual support. It works best with specific criteria, source material to check against, and regular comparison with human judgement.

What are the most useful LLM evaluation metrics?

Check pass rate per step, rubric scores per criterion, retry rate, human override rate, and cost and latency per completed task.

Do I need an LLM evaluation platform?

Not at first. A set of test cases, a script that runs them and a results table cover most needs. Evaluation platforms become worth it when you have many steps, frequent changes and several people working on prompts.

Ammar Imtiaz

Written by

AI developer. I design and build AI agents, AI automation, CRM architecture and the web apps that tie them together. Five of my systems run in production, and one has been acquired. About me · My systems · LinkedIn · GitHub

Want an AI system designed this way?

I design and build AI systems where each agent has one job, sees only what it needs, and hands clean context to the next. Five are running in production right now. See what I have shipped, or book a call and bring the process you want automated.