LLM Evaluations: Judge Models, Rubrics, and Layered Test Pipelines
How to test LLM features with rule-based evals, aligned judge models, metrics, and CI pipelines—synthesized from Chrome and related provider docs.
This page concentrates on how teams test generative AI in web applications. Most of the guidance comes from the Create AI evaluations learning path on Chrome for Developers, which walks through an example app (ThemeBuilder) end to end. A smaller slice covers Cloudflare AI Gateway Evaluations (human feedback on gateway logs). The goal is the same across providers: replace guesswork with measurable tests so you can change models, prompts, and features without silent quality regressions.
AI evals: why probabilistic outputs need tests
Section titled “AI evals: why probabilistic outputs need tests”People look for evals when intuition stops working—outputs look fine in demos but break in production, model swaps feel risky, or a rare toxic response blocks a launch. Large language models are probabilistic: the same company description can yield different mottos and palettes on every run, and subjective qualities like “on-brand” have no single correct answer.
Evals are tests for your AI features. When you create a robust evals pipeline, your LLM-based features will work well for your users. Then, you can ship your features with confidence.
— Chrome for Developers, Create AI evaluations
The Introducing AI Evals module frames the problem plainly: without tests, teams stall launches because output quality varies too much. Evals reuse familiar engineering habits—datasets, pass rates, CI gates—but add techniques such as LLM-as-a-judge, stability across multiple generations per input, and expert-labeled ground truth.
Rule-based evals versus LLM judge: objective and subjective criteria
Section titled “Rule-based evals versus LLM judge: objective and subjective criteria”When to use code (rule-based evals)
Section titled “When to use code (rule-based evals)”Objective failures—invalid JSON, missing keys, non-hex colors, empty strings, motto word limits, or contrast below WCAG-style thresholds—belong in regular code. The Design your evaluations guide recommends rule-based checks even when the model supports structured output, because valid syntax can still violate domain rules after token limits or partial generations.
The evaluation criteria are binary. Your rule-based eval functions should produce a binary output, such as a PASS or FAIL label.
— Chrome for Developers, Build rule-based evaluations
The Your mental model for AI testing article splits criteria explicitly: data format and contrast ratio are rule-based; motto brand fit, palette brand fit, and toxicity use an LLM judge. One shared EvalResult type with PASS/FAIL plus an optional rationale keeps rule-based and judge evaluators consistent in the pipeline.
When to use an LLM judge (subjective evals)
Section titled “When to use an LLM judge (subjective evals)”Subjective qualities need a rubric and a judge model—a language model that scores another model’s output at scale against labeled expectations. The same mental-model doc notes that LLM-as-a-judge has become a common production pattern for subjective checks.
For scoring, Set up a basic judge model (part 1) recommends binary PASS/FAIL labels instead of 1–5 scales, because models and humans tend to cluster mid-range scores. Configure a strict expert persona, structured JSON output (rationale before label), and low randomness: set temperature to 0 (or high thinking level on reasoning models) so the same input gets the same verdict.
Rubrics and failure cases: define PASS and FAIL before automation
Section titled “Rubrics and failure cases: define PASS and FAIL before automation”A rubric is a structured set of criteria the judge (human or AI) must apply on every sample. In Design your evaluations, experts define criteria such as psychological association, harmony, and industry appropriateness for color palettes before any labeling starts.
Start from real failure modes: broken structure, off-brand creative output, inaccessible contrast, toxicity. Build an expert judge stresses that thirty high-quality labels from a domain expert outweigh hundreds from non-experts. For production judges, use three or more experts (odd count for majority vote on binary PASS/FAIL), a written rubric, 30–50 labeled samples with rationales, and a labeling UI—not raw JSON for experts.
| Labeling setup | Trade-off |
|---|---|
| One expert | Fast start; judge inherits individual bias |
| Two experts | Budget sweet spot; ties need a process |
| Three+ experts | Majority ground truth; measure disagreements and fix the rubric |
Efficiency patterns from the same guide include verify-only (LLM drafts labels, expert audits), selective second-expert audit, and LLM-as-second-opinion to detect rubric ambiguity before scaling labels.
Judge alignment: from basic accuracy to precision, recall, and Kappa
Section titled “Judge alignment: from basic accuracy to precision, recall, and Kappa”Basic alignment and overfitting traps
Section titled “Basic alignment and overfitting traps”An alignment dataset (roughly 30–50 human-labeled pairs) is ground truth. Set up a basic judge model (part 2) defines alignment as the percentage of judge labels matching human labels; teams often target around 85% before tightening production metrics. Keep few-shot examples out of test sets, or scores look artificially perfect.
Stress tests from the same module:
- Bootstrapping: resample the alignment set with replacement (~10 iterations) and watch score variance.
- Self-consistency: rerun identical inputs; aim for zero variance when temperature is 0.
- Hold-out final exam: 15–20 fresh expert-labeled samples never used in prompt tuning.
Expert agreement and judge metrics
Section titled “Expert agreement and judge metrics”Raw agreement can mislead when labels are imbalanced. Build an expert judge recommends Cohen’s Kappa (two raters) or Fleiss’ Kappa (three+), aiming for at least 0.61 (substantial agreement) before trusting the rubric. Below 0.61, refine the rubric using disagreement cases and expert rationales.
For gatekeeping evals, define the positive class—often FAIL when the pipeline must catch bad outputs. Then use precision and recall, not accuracy alone (a judge that always says PASS can score high accuracy while missing every toxic motto). Toxicity-style safety may prioritize recall (minimize false negatives); balanced brand fit may use F1. Collapse multi-expert votes to majority labels, configure the judge with the same rubric and few-shot examples, validate on a hold-out set with Kappa and F1, and realign when the underlying judge model or product behavior changes.
Evaluation pipeline: orchestration, retries, and stability rates
Section titled “Evaluation pipeline: orchestration, retries, and stability rates”Build your evaluation pipeline describes wiring rule-based and LLM evaluators behind one orchestrator, a standard result format, and a reporting surface. LLM judge calls should retry on overload (exponential backoff); exhausted retries should return ERROR, not FAIL, so infrastructure failures do not look like quality failures.
Because application outputs vary, generate multiple outputs per test input (often 5–10), evaluate each, and report a stability rate (for example, 8/10 passes → 80%). Store app prompt versions, hashes, and judge version metadata with every run so regressions are traceable.
An optional pattern from Evaluator-Optimizer is a separate evaluator model looping with a generator until quality thresholds pass—useful for translation or refinement workflows, distinct from offline CI evals but conceptually aligned with “evaluate then improve.”
Layered eval runs: unit, extended, regression, release, and human sign-off
Section titled “Layered eval runs: unit, extended, regression, release, and human sign-off”Run evaluations maps evals onto familiar test layers:
| Layer | What runs | Dataset scale | Typical gate |
|---|---|---|---|
| Rule-based unit tests | Format, contrast, schema | 10–30 static inputs | 100% pass; block merge on failure |
| Extended unit tests | LLM judge on critical scenarios | ~30 curated cases (happy, edge, adversarial) | 100% on core scenarios |
| Regression / integration | Full criteria at scale | ~1,000 static inputs; use data slicing | Pass rate per criterion or composite scorecard (safety can veto) |
| Release “final exam” | Generalization check | ~1,000 random draws from unseen pool each run | Bootstrap confidence; block ship if targets slip |
| Human acceptance | SME audit | Small random sample of release candidates | Recalibrate judge if humans disagree |
Dynamic rubric (per-case assertions merged into the judge prompt) is high maintenance but recommended for production edge cases—for example, requiring the judge to FAIL if a motto invents “Yoga” when the input only says “Gym.” Pairwise evaluation compares two outputs for the same input; judges are often more consistent picking a winner than giving absolute grades—useful for model or prompt benchmarks (Your mental model for AI testing).
Run targeted eval subsets when only part of the app changed; consider production evals on live traffic and feed failures back into datasets (Run evaluations). Eval testing and debugging for WebMCP tools reinforces framing inputs, outputs, and constraints like an API contract before choosing rule-based versus judge checks.
Cloudflare AI Gateway: human feedback as an evaluation metric
Section titled “Cloudflare AI Gateway: human feedback as an evaluation metric”Cloudflare AI Gateway Evaluations targets gateway operators comparing cost, speed, and quality on filtered log datasets. The feature is deprecated for new accounts; existing docs still describe human feedback as a performance evaluator.
When you run an evaluation (as outlined in the Set Up Evaluations guide), the human feedback metric will be calculated based on the percentage of logs that received thumbs-up feedback.
— Cloudflare, Add Human Feedback using Dashboard
You must select human feedback as an evaluator in Set up Evaluations; results appear on the Evaluations tab alongside cost and speed. Datasets can follow log filters, but evaluations do not auto-refresh—you create a new evaluation when the log set changes. This is operational telemetry, not a substitute for rubric-aligned judges in your application CI.
Common mistakes when building LLM evals
Section titled “Common mistakes when building LLM evals”- Treating API errors as FAIL skews pass rates; distinguish
ERRORfrom quality failure (Build your evaluation pipeline). - Testing on few-shot examples baked into the judge prompt inflates alignment (Run evaluations).
- Relying on accuracy alone when failures are rare; define positive class and recall for safety (Build an expert judge).
- Vague rubrics that experts interpret differently; fix with Kappa and rationale review before scaling.
- Single demo inspection instead of multi-sample stability per input (Build your evaluation pipeline).
- Skipping rule-based format checks because the API returns JSON (Design your evaluations).
- Same model for app and judge during model comparison benchmarks—possible self-bias (Set up a basic judge model (part 1)).
How to check this on your site
Section titled “How to check this on your site”- List product failure modes (format, safety, subjective quality) using Design your evaluations, then implement at least one rule-based
PASS/FAILcheck such as contrast or schema validation per Build rule-based evaluations. - Draft a rubric and label 30–50 examples (or three-expert majority labels for production) following Build an expert judge; compute inter-rater Kappa before trusting labels.
- Configure an LLM judge with
temperature0, structuredEvalResult, and alignment against the label set per Set up a basic judge model (part 2); run bootstrap and hold-out checks. - Wire rule-based and judge evaluators into CI with retries and stability reporting per Build your evaluation pipeline and gate merges using the layers in Run evaluations.
- You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are questioning so it can be corrected or explained.