This playbook is for prompt engineering teams that need a data-driven decision process for promoting a prompt change. Instead of relying on ad-hoc spot checks or a single aggregate score, this prompt runs a candidate version and a baseline version against a shared test suite and produces per-example win/loss/tie judgments with explanations. The output is a decision-support report that includes aggregate scoring, confidence intervals, and a clear recommendation. Use it when you have a candidate prompt, a baseline prompt, and a set of test cases with expected outputs.
Prompt
Prompt Version Comparison Evaluation Prompt

When to Use This Prompt
A structured, repeatable method to compare two prompt versions against a shared test suite before promoting a change to production.
The prompt requires three concrete inputs to function: a [BASELINE_PROMPT] that represents the current production version, a [CANDIDATE_PROMPT] that is the proposed change, and a [TEST_SUITE] containing input-output pairs with expected behavior. Each test case should include the input, the expected output, and optional tolerance thresholds for semantic equivalence. The prompt works best when your test suite covers a representative distribution of production traffic, including edge cases, boundary conditions, and known failure modes. If your test suite is sparse or unrepresentative, the comparison results will be unreliable regardless of how well the prompt is constructed.
Do not use this prompt when you lack a defined test suite, when the expected outputs are purely subjective and cannot be evaluated programmatically, or when the prompt change is cosmetic and does not affect functional behavior. For subjective quality dimensions like tone or style, pair this prompt with a separate LLM judge evaluation using calibrated rubrics. For cosmetic changes like whitespace or comment adjustments, skip the comparison entirely and rely on your version control diff. The next section provides the copy-ready prompt template you can adapt for your own evaluation harness.
Use Case Fit
Where this prompt works and where it does not. Use it to gate prompt changes with data, not intuition.
Good Fit: Gating Prompt Changes
Use when: you have two prompt versions and a labeled test suite. The prompt produces per-example win/loss/tie judgments with explanations, giving you a data-driven signal before promotion. Guardrail: always pair with a human review step for high-risk or safety-critical changes.
Bad Fit: Single Prompt Debugging
Avoid when: you are diagnosing why one prompt failed on a single input. This prompt is designed for comparative evaluation across a batch, not root-cause analysis. Guardrail: use a failure analysis or debugging prompt for single-case diagnosis before running a full comparison.
Required Inputs
Risk: running the prompt without a structured test suite produces unreliable judgments. Guardrail: require a golden test set with input, expected output, and optional difficulty tier per case. The prompt needs both prompt versions and the full test suite to produce valid comparisons.
Operational Risk: Judge Bias
Risk: the LLM acting as judge may favor verbose, stylistically similar, or longer outputs over factually correct ones. Guardrail: include explicit evaluation criteria in the prompt, such as factual accuracy, schema compliance, and refusal correctness, and spot-check a sample of judgments manually.
Operational Risk: Confidence Inflation
Risk: aggregate scores can mask high variance or borderline cases. Guardrail: require the prompt to output per-example confidence and flag ties or ambiguous wins for human review. Never rely solely on a single aggregate number for a go/no-go decision.
When to Escalate
Risk: the comparison shows no clear winner or reveals regressions in safety-critical categories. Guardrail: define explicit escalation thresholds before running the prompt. If safety-related examples regress or aggregate confidence drops below a set threshold, block promotion and escalate to a human review board.
Copy-Ready Prompt Template
A copy-ready template for running side-by-side prompt version comparisons against a shared test suite.
This prompt is the core instruction set for a Prompt Version Comparison Evaluation. It is designed to be pasted into your evaluation harness, where it will receive two prompt versions and a set of test cases. The model acts as a judge, comparing outputs side-by-side and producing structured win/loss/tie judgments with detailed explanations. Before using this template, ensure you have a validated golden test set and a clear definition of what constitutes a better output for your specific use case.
textYou are an expert prompt evaluator. Your task is to compare two prompt versions against a shared test suite and determine which version produces better outputs. ## INPUT DATA - Test Suite: [TEST_SUITE] A set of test cases, each containing an [INPUT] and an [EXPECTED_OUTPUT_CONTRACT]. - Prompt Version A: [PROMPT_VERSION_A] - Prompt Version B: [PROMPT_VERSION_B] - Outputs for Version A: [OUTPUTS_A] The model's responses to each test case using Prompt Version A. - Outputs for Version B: [OUTPUTS_B] The model's responses to each test case using Prompt Version B. ## EVALUATION CRITERIA For each test case, compare the two outputs against the [EXPECTED_OUTPUT_CONTRACT] and determine a winner based on these dimensions: - **Accuracy**: Which output better matches the expected facts, data, or logical conclusions? - **Schema Compliance**: Which output better adheres to the required format, field types, and structure? - **Completeness**: Which output addresses all required elements without missing critical information? - **Constraint Adherence**: Which output better respects explicit constraints like tone, length, or prohibitions? - **Safety and Refusal Correctness**: If refusal is expected, which output refuses more appropriately? If refusal is incorrect, penalize accordingly. ## OUTPUT FORMAT Return a single JSON object with the following structure: { "aggregate_results": { "version_a_wins": <integer>, "version_b_wins": <integer>, "ties": <integer>, "total_test_cases": <integer>, "version_a_win_rate": <float between 0 and 1>, "version_b_win_rate": <float between 0 and 1>, "confidence_interval_95": "<string describing the 95% confidence interval for the difference>" }, "per_example_results": [ { "test_case_id": "<string>", "judgment": "<version_a_wins | version_b_wins | tie>", "explanation": "<concise reason for the judgment, referencing specific criteria>", "key_differences": "<summary of what differed between the two outputs>" } ], "overall_assessment": "<narrative summary of the comparison, including which version is recommended and any notable patterns or risks>" } ## CONSTRAINTS - Do not hallucinate differences. Only report differences you can observe in the provided outputs. - If both outputs are equally good or equally flawed, mark as a tie and explain why. - If a test case is invalid or cannot be evaluated, mark it as a tie and note the issue in the explanation. - Base your judgment strictly on the provided [EXPECTED_OUTPUT_CONTRACT], not on personal preference.
To adapt this template, replace the square-bracket placeholders with your actual data. The [TEST_SUITE] should be a structured list of test cases, each with a unique ID, an input, and an expected output contract. The [EXPECTED_OUTPUT_CONTRACT] can be a full golden output, a schema definition, or a set of pass/fail rules. The [OUTPUTS_A] and [OUTPUTS_B] should be pre-generated by running each prompt version against the test suite before invoking this evaluation prompt. For high-stakes decisions, always have a human review the per-example explanations and the overall assessment before promoting a prompt change.
Prompt Variables
Required inputs for the Prompt Version Comparison Evaluation Prompt. Each variable must be populated before the comparison run to ensure reliable side-by-side judgments.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[PROMPT_VERSION_A] | Full text of the baseline or current prompt to compare | You are a support classifier. Classify the following ticket into one of: billing, technical, account, or other. Ticket: [TICKET_TEXT] | Must be non-empty string. Validate that version A differs from version B by at least one token. If identical, abort comparison. |
[PROMPT_VERSION_B] | Full text of the candidate or new prompt to evaluate | You are a support triage agent. Analyze the ticket and return a JSON object with fields: category, priority, and suggested_team. Ticket: [TICKET_TEXT] | Must be non-empty string. Validate that version B differs from version A. Check for parseable template syntax if version B uses structured output instructions. |
[TEST_SUITE] | Array of test cases, each containing input and expected output contract | [{"id":"tc-001","input":"I can't log in since yesterday","expected":{"category":"technical","priority":"high"}}] | Must contain at least 5 test cases for statistical significance. Validate each test case has non-null input and expected fields. Check for duplicate inputs across suite. |
[EVALUATION_MODEL] | Model identifier to use for the judge/comparison calls | gpt-4o or claude-sonnet-4-20250514 | Must be a valid model ID available in the target environment. Prefer a model at least as capable as the one being tested. Validate model availability before run. |
[COMPARISON_CRITERIA] | Ordered list of dimensions to evaluate per test case | ["accuracy","completeness","format_compliance","safety"] | Must contain 1-5 criteria. Each criterion must map to a defined pass/fail rule in the eval harness. Validate no duplicate criteria names. |
[OUTPUT_SCHEMA] | Expected JSON schema for the comparison output per test case | {"test_case_id":"string","winner":"A|B|tie","confidence":0.0-1.0,"explanation":"string","criteria_scores":{"accuracy":"A|B|tie"}} | Must be valid JSON Schema. Validate that winner field accepts only A, B, or tie. Confidence must be float 0-1. Explanation must be non-empty string. |
[TOLERANCE_THRESHOLDS] | Per-criterion tolerance for declaring a tie instead of win/loss | {"accuracy":0.05,"completeness":0.1,"format_compliance":0.0,"safety":0.0} | Must be a map with keys matching COMPARISON_CRITERIA. Values must be floats 0-1. Zero tolerance means any difference is a win/loss. Validate no missing criteria keys. |
[AGGREGATION_METHOD] | How to compute overall winner from per-example results | weighted_majority or strict_majority or bradley_terry | Must be one of: weighted_majority, strict_majority, bradley_terry. If weighted_majority, validate that weights are provided per criterion. If bradley_terry, validate minimum 10 test cases. |
Implementation Harness Notes
How to wire the Prompt Version Comparison Evaluation Prompt into a reliable, automated testing pipeline.
This prompt is designed to be the core comparison engine in an automated prompt evaluation harness, not a one-off manual review tool. It expects a structured test suite—a set of inputs paired with expected outputs or acceptance criteria—and two prompt versions to compare. The harness should iterate over each test case, call the model with this comparison prompt, and collect the per-example win/loss/tie judgments. The prompt's value comes from its ability to produce structured, machine-readable judgments that can be aggregated into a release gate report.
To wire this into an application, build a runner that loads your test suite from a version-controlled file (JSON Lines or a database), then for each test case: (1) execute both prompt versions against the input, capturing the raw outputs; (2) construct the comparison prompt by injecting the input, the two outputs, and your evaluation criteria into the [INPUT], [OUTPUT_A], [OUTPUT_B], and [EVALUATION_CRITERIA] placeholders; (3) call a capable model (GPT-4o, Claude 3.5 Sonnet, or equivalent) with response_format set to json_object and a strict JSON schema matching the expected output contract; (4) validate the returned JSON for required fields (judgment, winner, explanation, confidence), enum values (A, B, tie), and confidence score range (0.0–1.0). Failed validations should trigger a single retry with the validation error message appended to the prompt as additional context. Log every comparison result—including raw outputs, judgment, and validation status—to your observability platform for later trace analysis.
For high-stakes prompt changes where a bad promotion could degrade user-facing behavior, add a human review gate before aggregating results. After the harness completes all comparisons, compute aggregate metrics: win rate for each version, tie rate, and a 95% confidence interval for the win-rate difference using a binomial proportion test. If the confidence interval for the new version's improvement excludes zero and the win rate exceeds your pre-defined threshold (e.g., >55% with p<0.05), the harness can emit a go signal. Otherwise, it should emit no-go or review. Store the full comparison report—including per-example judgments, aggregate statistics, and the raw prompt versions—as an artifact in your CI/CD pipeline for auditability. Do not rely solely on this prompt's aggregate score; always spot-check a random sample of comparisons, especially ties and low-confidence judgments, to catch evaluator blind spots before promoting a prompt to production.
Expected Output Contract
Defines the required fields, types, and validation rules for the JSON output of the Prompt Version Comparison Evaluation Prompt. Use this contract to configure automated parsers, downstream dashboards, and CI/CD gates.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
comparison_id | string (UUID v4) | Must match regex for UUID v4. Reject if missing or malformed. | |
prompt_version_a | string | Must match the provided [VERSION_A_ID]. Non-empty string check. | |
prompt_version_b | string | Must match the provided [VERSION_B_ID]. Non-empty string check. | |
test_suite_id | string | Must match the provided [TEST_SUITE_ID]. Non-empty string check. | |
aggregate_results | object | Must contain keys: 'total_tests', 'wins_a', 'wins_b', 'ties', 'errors'. All values must be non-negative integers. Sum of wins_a + wins_b + ties + errors must equal total_tests. | |
per_example_results | array of objects | Array length must equal aggregate_results.total_tests. Each object must contain keys: 'test_case_id' (string), 'judgment' (enum: 'win_a', 'win_b', 'tie', 'error'), 'explanation' (string, non-empty unless judgment is 'error'), 'confidence' (number, 0.0-1.0). | |
confidence_interval | object | Must contain keys: 'confidence_level' (number, typically 0.95), 'margin_of_error' (number, 0.0-1.0), 'lower_bound' (number, 0.0-1.0), 'upper_bound' (number, 0.0-1.0). Bounds must be within [0,1] and lower_bound <= upper_bound. | |
error_log | array of objects | If present, each object must contain: 'test_case_id' (string), 'error_type' (string), 'error_detail' (string). Required if any per_example_result has judgment 'error'. |
Common Failure Modes
When running side-by-side prompt comparisons, these failures degrade trust in the results and lead to shipping the wrong version.
Position Bias Skews Win Rates
What to watch: The judge model systematically prefers outputs from Position A or Position B, regardless of quality. This inflates win rates for one version and masks real regressions. Guardrail: Randomize the presentation order of Prompt A and Prompt B for every test case, and log the original position to detect bias in aggregate results.
Verbosity Over Quality Preference
What to watch: The evaluator confuses longer, more fluent responses with better responses, awarding wins to a prompt that adds unnecessary detail while missing the core task. Guardrail: Add explicit length and conciseness criteria to the evaluation rubric. Include a tie-breaker instruction that penalizes information irrelevant to the expected output contract.
Semantic Drift Without Schema Violation
What to watch: Both outputs pass structural validation, but one version subtly changes the meaning, tone, or factual claim. The comparison misses this because it only checks format. Guardrail: Pair structural comparison with a semantic similarity check against a golden expected output. Flag ties for human review when outputs diverge in meaning but not in schema.
Unstable Judgments on Borderline Cases
What to watch: The judge flips between Win/Loss/Tie on repeated runs of the same test case, producing noisy confidence intervals and unreliable aggregate scores. Guardrail: Run each comparison N times (e.g., 3 or 5) with a low temperature. Report a decision only when the majority vote is consistent; escalate split decisions for manual review.
Test Suite Leakage Into Evaluation
What to watch: The golden expected outputs or test case details leak into the comparison prompt, causing the judge to favor whichever version memorizes the test set rather than generalizes. Guardrail: Strictly separate the test harness from the evaluation prompt. The judge should see only the input and the two anonymized outputs, never the expected answer or test metadata.
Aggregate Metrics Mask Regressions
What to watch: A new prompt wins on 80% of cases but catastrophically fails on a critical 5% slice. The aggregate score hides the regression, and it ships to production. Guardrail: Slice results by difficulty tier, intent category, and risk level before computing win rates. Set a minimum acceptable score per slice, and block promotion if any high-risk slice degrades.
Evaluation Rubric
Criteria for evaluating the quality of a prompt version comparison report. Use this rubric to validate the evaluator prompt's output before trusting its go/no-go decision.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Per-Example Judgment Completeness | Every test case in the input suite has exactly one judgment: win, loss, or tie. | Missing test cases, duplicate entries, or unlabeled judgments in the output. | Parse the output JSON and assert that the count of judgment objects equals the count of input test cases. |
Judgment-Explanation Alignment | The explanation for each judgment references specific output differences and matches the declared win/loss/tie label. | Explanations that are generic, contradict the label, or describe a difference that doesn't exist in the actual outputs. | Sample 5 random judgments and have a second LLM call verify that the explanation text is consistent with the label and the provided outputs. |
Aggregate Score Accuracy | The reported win/loss/tie counts and win-rate percentage are mathematically correct given the per-example judgments. | Win-rate percentage that doesn't match the counts, or counts that sum to more than the total test cases. | Recalculate the win-rate from the per-example judgments in the output and assert it matches the reported aggregate score within 0.1%. |
Confidence Interval Validity | Confidence intervals are reported at the specified level and are statistically plausible given the sample size. | Confidence intervals that are impossibly narrow for the sample size, or missing entirely when requested. | Check that the interval width decreases as sample size increases in a test run with varying test suite sizes. |
Tie Detection Sensitivity | Outputs that are semantically equivalent but differ in whitespace, formatting, or synonym choice are correctly classified as ties. | Trivial formatting differences causing a loss judgment, or semantically different outputs classified as ties. | Include a known tie case in the test suite where outputs differ only by trailing whitespace and assert it is judged as a tie. |
Output Schema Compliance | The entire evaluation report is valid JSON matching the expected schema with all required fields present. | Missing required fields, incorrect types, or unparseable JSON in the evaluation output. | Validate the output against the expected JSON schema using a schema validator; assert zero validation errors. |
Refusal and Error Handling | When a prompt version refuses or errors, the judgment correctly identifies this and does not attempt a content comparison. | Refusals treated as content losses, or errors causing the evaluator prompt itself to crash or return null. | Include a test case where one prompt version returns a refusal message and assert the judgment is a loss with a refusal-specific explanation. |
Aggregate Summary Usefulness | The summary provides actionable insight about the types of changes observed, not just a restatement of the win-rate. | Summary that only says 'Version B won 60% of tests' without describing patterns or categories of improvement or regression. | Human review of the summary against the per-example judgments: does it surface the most frequent failure mode? Pass if yes. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a small hand-curated test suite of 5-10 examples. Replace the aggregate scoring section with a simple win/loss/tie count. Skip confidence intervals and statistical rigor.
code[SYSTEM_INSTRUCTION] Compare these two prompt versions against the test suite below. For each example, output: example_id, winner (A/B/tie), brief_reason. [TEST_SUITE] [EXAMPLE_1] [EXAMPLE_2] ... [PROMPT_VERSION_A] [PROMPT_VERSION_B]
Watch for
- Overfitting to a tiny test set that doesn't represent production diversity
- Missing edge cases that would surface in larger-scale comparison
- Subjective win/loss judgments without clear criteria

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us