Skip to main content
All guides
Evaluation foundations

How to Test an LLM Application Before Production

Build a representative test set, choose the right graders, and gate releases on behavior instead of demos.

9 min readUpdated September 2, 2026

Short answer

Test the complete application, not an isolated model prompt. Define required behavior, collect representative and adversarial cases, combine deterministic checks with calibrated semantic grading, and compare every candidate with a reviewed baseline before release.

Key takeaways

  • Start from product behavior and risk, not a generic benchmark.
  • Use deterministic assertions wherever the expected result is objective.
  • Protect important slices even when the overall score rises.

Signs this is the problem

Start by confirming the symptom before changing prompts, models, or infrastructure.

  • Release review depends on a few hand-picked prompts.
  • Tests cover the final answer but not retrieval, tools, or side effects.
  • A model or prompt update can ship without a baseline comparison.

Step-by-step approach

  1. 1

    Define acceptable behavior

    Write observable requirements, forbidden behavior, and risk tiers for each important user intent.

  2. 2

    Build representative cases

    Include normal use, boundary conditions, known failures, missing context, and adversarial inputs with attributable sources.

  3. 3

    Assign the right grader

    Use schemas and code for objective contracts, model judges for reviewed semantic rubrics, and people for unresolved high-impact judgment.

  4. 4

    Compare and gate

    Run baseline and candidate under matched conditions, inspect protected slices, and block material regressions.

What to measure

MetricWhat it measuresHow to use it
Protected-slice pass ratePass rate for each critical intent or risk group.Do not let a global average compensate for a critical failure.
Regression countNew failures relative to the accepted baseline.Review every material regression before release.
Coverage qualityRequirements and known failure modes represented by attributable cases.Add cases when a real risk lacks proof.

Common mistakes

  • Testing the foundation model instead of the application path.
  • Using one opaque quality score for every behavior.
  • Promoting synthetic cases without review.

Practical checklist

  • Define acceptable behavior: Write observable requirements, forbidden behavior, and risk tiers for each important user intent.
  • Build representative cases: Include normal use, boundary conditions, known failures, missing context, and adversarial inputs with attributable sources.
  • Assign the right grader: Use schemas and code for objective contracts, model judges for reviewed semantic rubrics, and people for unresolved high-impact judgment.
  • Compare and gate: Run baseline and candidate under matched conditions, inspect protected slices, and block material regressions.

Frequently asked questions

What should I do first?

Write observable requirements, forbidden behavior, and risk tiers for each important user intent

How should the result be measured?

Pass rate for each critical intent or risk group. Do not let a global average compensate for a critical failure.

When is the change ready to ship?

Ship only after the protected cases pass, the primary metric clears its agreed boundary, and the team reviews the remaining failure modes instead of relying on one aggregate score.

Keep going