This prompt is designed for evaluation engineers and RAG pipeline architects who need to build fine-grained re-ranking systems or calibration datasets. The core job-to-be-done is comparing two evidence passages head-to-head against a specific query to produce a relative quality judgment, not an absolute score. It is ideal when you need to resolve close ranking decisions, detect subtle quality differences that absolute scoring models miss, or generate preference data for training or evaluating your own scoring models.
Prompt
Pairwise Evidence Comparison Scoring Prompt

When to Use This Prompt
Define the job, ideal user, and constraints for the Pairwise Evidence Comparison Scoring Prompt.
Use this prompt when you have already retrieved a candidate set and need to establish a precise partial ordering. It is particularly effective for creating golden datasets for LLM-as-a-Judge evaluators, calibrating production re-rankers, and auditing retrieval quality where the difference between the 3rd and 4th result matters. The prompt requires a clear query, two evidence passages formatted with source identifiers, and a defined set of comparison criteria such as relevance, specificity, authority, and recency. You must also provide an output schema that captures the winner, the margin of victory, and a structured justification.
Do not use this prompt for bulk scoring of dozens of passages against a query; a pointwise scoring prompt is more efficient for that task. Avoid it when passages are fundamentally incommensurable—comparing a peer-reviewed paper to a tweet about the same topic will produce a trivial judgment that wastes inference compute. This prompt is also insufficient on its own for production ranking systems: you must implement transitivity checks across multiple pairwise comparisons, position bias detection by swapping passage order, and human calibration of the resulting preference pairs. The output of this prompt is a building block for a larger evaluation or training pipeline, not a finished product feature.
Use Case Fit
Where this prompt works and where it does not. Pairwise comparison is powerful for fine-grained ranking but introduces specific operational risks.
Good Fit: Calibration Dataset Creation
Use when: you need to build a golden dataset of relative quality judgments for training or evaluating re-rankers. Guardrail: Pairwise prompts produce more reliable relative labels than absolute scoring prompts, but require transitivity checks across the full comparison set.
Bad Fit: Real-Time Ranking Pipelines
Avoid when: latency budgets are under 500ms or you need to rank more than 20 passages per query. Guardrail: Pairwise comparison scales quadratically. Use a pointwise scoring prompt for production latency and reserve pairwise for offline eval.
Required Inputs
What you need: a query, two evidence passages with source metadata, and a comparison rubric. Guardrail: Missing source metadata prevents authority weighting. Passages without identifiers make downstream audit impossible. Always include passage IDs.
Operational Risk: Position Bias
What to watch: models systematically favor the first passage presented regardless of quality. Guardrail: Run each pair in both orders and flag disagreements. Implement position randomization in your comparison harness and track order-effect metrics.
Operational Risk: Transitivity Violations
What to watch: A > B and B > C does not guarantee A > C in LLM judgments, breaking ranking consistency. Guardrail: Run transitivity checks on comparison chains and flag cycles. Use Elo or Bradley-Terry aggregation to smooth inconsistencies rather than trusting raw pairwise wins.
Operational Risk: Length Bias
What to watch: longer passages receive higher quality scores independent of content. Guardrail: Normalize passage lengths before comparison or include explicit length-penalty instructions in the rubric. Track score-vs-length correlation in eval dashboards.
Copy-Ready Prompt Template
A reusable prompt template for head-to-head evidence comparison with built-in position bias detection and transitivity checks.
This template implements pairwise evidence comparison scoring, where two evidence passages are evaluated side by side against a query to determine which provides stronger support. The prompt is designed for evaluation engineers building precision re-ranking systems and calibration datasets. It produces relative quality judgments with explicit reasoning, making it suitable for fine-grained evidence ranking, LLM-as-judge pipelines, and training data generation for learned re-ranking models. The template includes structural safeguards against common failure modes: position bias (favoring the first or second passage regardless of quality), length bias (favoring longer passages), and superficial relevance (favoring keyword overlap over semantic alignment).
codeYou are an evidence quality evaluator. Your task is to compare two evidence passages and determine which one better supports answering a given query. ## QUERY [QUERY] ## PASSAGE A [PASSAGE_A] ## PASSAGE B [PASSAGE_B] ## COMPARISON CRITERIA Evaluate both passages on these dimensions, in order of importance: 1. **Relevance**: How directly does the passage address the query's information need? Consider semantic alignment, not just keyword overlap. 2. **Specificity**: Does the passage provide concrete details, facts, or data that directly bear on the query? Penalize vague or general statements. 3. **Authority**: Based on available signals (source type, date, author indicators), how credible is this passage for this query domain? 4. **Completeness**: How much of the query's information need does this passage address on its own? ## OUTPUT FORMAT Return a JSON object with this exact schema: ```json { "winner": "A" | "B" | "TIE", "confidence": 0.0-1.0, "reasoning": { "passage_a_strengths": ["specific strength 1", "specific strength 2"], "passage_a_weaknesses": ["specific weakness 1"], "passage_b_strengths": ["specific strength 1"], "passage_b_weaknesses": ["specific weakness 1", "specific weakness 2"], "decisive_factor": "explanation of what most determined the outcome" }, "position_bias_check": { "swapped_expected_winner": "A" | "B" | "TIE", "explanation": "If the passages were swapped, would the winner change? Explain why or why not." } }
CONSTRAINTS
- Do not favor a passage because it appears first or second. The position_bias_check field forces you to verify this.
- Do not favor longer passages. A short, precise passage can outrank a long, diffuse one.
- If both passages are equally strong or equally weak, return "TIE" with confidence reflecting how close the comparison was.
- If neither passage is relevant to the query, return "TIE" with low confidence and explain why both are inadequate.
- Base your judgment only on the passage content provided. Do not bring in external knowledge.
- For the confidence score: use 0.9+ for clear winners, 0.7-0.9 for moderate advantage, 0.5-0.7 for close calls, below 0.5 for uncertain judgments.
EXAMPLES
[EXAMPLES]
To adapt this template for your pipeline, start by populating the [QUERY], [PASSAGE_A], and [PASSAGE_B] placeholders with your retrieval results. The [EXAMPLES] placeholder should contain 2-4 annotated pairwise comparisons that demonstrate your desired judgment standards, including at least one TIE case and one case where the shorter passage wins. For production use, add a [RISK_LEVEL] parameter that gates whether low-confidence results (below 0.6) require human review. If your domain has specific authority signals (e.g., peer-reviewed sources for scientific queries, recency for news queries), add those as explicit sub-criteria under the Authority dimension. The position_bias_check field serves dual purpose: it forces the model to self-audit for position bias and provides a signal you can use in post-processing to detect systematic bias patterns across many comparisons. For transitivity validation, run the same passage pair in both A/B and B/A orderings and verify that the winner is consistent after accounting for the position swap.
Prompt Variables
Required inputs for the Pairwise Evidence Comparison Scoring Prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to verify the input is well-formed and safe.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[PASSAGE_A] | The first evidence passage in the pairwise comparison. | The study found a 12% reduction in error rates when using structured prompts. | Must be a non-empty string. Check for minimum length of 20 characters to avoid degenerate comparisons. Null not allowed. |
[PASSAGE_B] | The second evidence passage to compare against Passage A. | Prior work suggests prompt structure has minimal impact on output quality. | Must be a non-empty string. Check that [PASSAGE_A] and [PASSAGE_B] are not identical strings. Null not allowed. |
[QUERY] | The original user question or information need that both passages should address. | How does prompt structure affect model output accuracy? | Must be a non-empty string. Check for minimum specificity; reject queries under 10 characters or consisting only of stop words. Null not allowed. |
[COMPARISON_DIMENSIONS] | Ordered list of criteria for comparing the two passages. | ["relevance_to_query", "specificity_of_claims", "source_authority", "recency"] | Must be a valid JSON array of strings. Each string must match a known dimension from the allowed set. Empty array triggers a schema validation error. Null not allowed. |
[DIMENSION_WEIGHTS] | Relative importance weights for each comparison dimension. | {"relevance_to_query": 0.4, "specificity_of_claims": 0.3, "source_authority": 0.2, "recency": 0.1} | Must be a valid JSON object with keys matching [COMPARISON_DIMENSIONS]. Values must be numbers between 0.0 and 1.0. Sum of all weights must equal 1.0 within a tolerance of 0.01. Null not allowed. |
[OUTPUT_SCHEMA] | Expected JSON structure for the comparison result. | {"winner": "A", "score_a": 0.72, "score_b": 0.48, "dimension_scores": {...}, "confidence": 0.85, "rationale": "..."} | Must be a valid JSON Schema object. Check that required fields include winner, score_a, score_b, and confidence. Schema must define enum constraint for winner field: ["A", "B", "TIE"]. Null not allowed. |
[POSITION_BIAS_CONTROL] | Flag indicating whether to apply position bias mitigation. | Must be a boolean. When true, the prompt includes instructions to ignore passage order. When false, position bias detection logic is omitted. Null not allowed. | |
[TRANSITIVITY_CHECK_CONTEXT] | Optional prior comparison results for transitivity validation across multiple pairs. | {"previous_comparisons": [{"winner": "A", "loser": "C", "margin": 0.15}]} | Must be a valid JSON object or null. If provided, check that previous_comparisons is an array of objects with winner, loser, and margin fields. Null allowed when no prior comparisons exist. |
Common Failure Modes
Pairwise comparison prompts are sensitive to subtle biases that can corrupt ranking quality. These are the most common failure modes and the specific guardrails to prevent them.
Position Bias Skews Judgment
What to watch: The model systematically favors Passage A over Passage B regardless of content quality, simply because of its position in the prompt. This destroys ranking validity. Guardrail: Randomize passage order for every comparison pair and run reciprocal comparisons (A vs B and B vs A). Flag pairs where reciprocal judgments conflict as unreliable.
Length Bias Overweights Verbose Passages
What to watch: Longer passages receive higher scores not because they are more relevant but because they contain more tokens that superficially match the query. This penalizes concise, high-precision evidence. Guardrail: Normalize scores by passage length or include a specificity-over-verbosity criterion in the scoring rubric. Test with length-matched negative controls.
Transitivity Violations Produce Circular Rankings
What to watch: The model ranks A > B, B > C, but then C > A, creating inconsistent rankings that cannot be resolved into a valid total order. This breaks downstream re-ranking pipelines. Guardrail: Run transitivity checks across all triplets in the comparison set. When violations are detected, fall back to a direct multi-passage ranking prompt or flag the set for human review.
Stylistic Mimicry Masks Content Quality
What to watch: Passages written in authoritative, academic, or confident prose receive higher scores than factually superior passages written in plain language. The model confuses tone with substance. Guardrail: Include explicit rubric criteria separating factual support from stylistic quality. Test with adversarial pairs where a well-written false passage competes against a poorly-written true passage.
Query Drift Dilutes Comparison Relevance
What to watch: Over multiple pairwise comparisons, the model gradually shifts its interpretation of what the query is asking, causing inconsistent scoring across the batch. Later comparisons use different implicit criteria than earlier ones. Guardrail: Anchor every comparison prompt with the original query and a fixed scoring rubric. Batch comparisons with periodic re-anchoring checks. Monitor score distributions for drift over time.
Tie-Breaking Failure Produces False Precision
What to watch: When two passages are genuinely equivalent in quality, the model invents spurious distinctions to force a ranking rather than declaring a tie. This injects noise into the ranking signal. Guardrail: Explicitly allow tie judgments in the output schema. Require the model to justify any claimed difference with specific evidence from the passages. Audit tie rates against human baseline expectations.
Evaluation Rubric
Criteria for testing the Pairwise Evidence Comparison Scoring Prompt before production deployment. Each row defines a pass standard, a failure signal, and a concrete test method to catch ranking errors, position bias, and transitivity violations.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Position Bias Detection | Preference for [PASSAGE_A] over [PASSAGE_B] is consistent when passage order is swapped in the prompt | Win rate for a passage changes by more than 15 percentage points when it appears first vs. second | Run 50 swapped-order pairs through the prompt; compute win-rate delta per position; flag if delta exceeds threshold |
Transitivity Consistency | If A > B and B > C, then A > C in at least 90% of triple comparisons | Rock-paper-scissors cycles detected where A > B, B > C, but C > A | Select 20 passage triples; run all three pairwise comparisons per triple; count cycle violations; fail if more than 2 cycles found |
Score Calibration Against Human Judgments | Model-assigned relative quality scores correlate with human expert rankings at Spearman ρ ≥ 0.75 | Spearman correlation below 0.75 or systematic over-scoring of verbose but irrelevant passages | Collect 100 human-labeled pairwise preferences; run prompt on same pairs; compute Spearman ρ between model scores and human preference rates |
Length Bias Resistance | Passage length does not predict win rate; win probability for longer passage is between 40% and 60% when content quality is controlled | Passages with more than 2x token count win more than 65% of comparisons against shorter passages of equal relevance | Create 30 length-contrast pairs where both passages have equivalent relevance scores; measure win rate by length; fail if longer-passage win rate exceeds 65% |
Relevance Discrimination | Prompt correctly identifies the more query-relevant passage in at least 85% of pairs with a clear relevance gap | Prompt selects the less relevant passage or returns a tie when one passage is clearly on-topic and the other is off-topic | Build 50 pairs with one clearly relevant and one clearly irrelevant passage per query; measure accuracy; fail below 85% |
Justification Grounding | Every justification sentence references specific content from the chosen passage, not generic quality claims | Justification contains phrases like 'better written' or 'more detailed' without citing specific passage content | Sample 30 outputs; manually check each justification sentence for a direct quote, paraphrase, or section reference from the passage; fail if more than 10% of sentences are ungrounded |
Tie Handling Appropriateness | Prompt returns a tie judgment when passages are genuinely equivalent in quality, with tie rate between 5% and 25% on balanced pairs | Tie rate is 0% on a balanced dataset or exceeds 50% on pairs with clear quality differences | Run on 50 balanced-quality pairs and 50 clear-difference pairs; measure tie rate in each set; fail if tie rate is 0% on balanced set or above 50% on clear-difference set |
Output Schema Compliance | Every response parses as valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed | Missing fields, wrong types, or unparseable JSON in more than 2% of responses | Run 200 comparisons; validate each output against the schema with a JSON schema validator; fail if parse error or schema violation rate exceeds 2% |
Implementation Harness Notes
How to wire the Pairwise Evidence Comparison Scoring Prompt into a production evaluation pipeline with validation, retries, and bias detection.
The Pairwise Evidence Comparison Scoring Prompt is designed to be called repeatedly in a tournament-style ranking loop, not as a single one-shot request. In practice, you will iterate over all unique pairs from a retrieved evidence set, calling the prompt for each pair to produce a relative quality judgment. The harness must manage state across these calls, aggregate the head-to-head results into a global ranking, and apply transitivity checks to detect inconsistent judgments before the scores are trusted downstream. This prompt is a building block for fine-grained re-ranking and calibration dataset creation, so the harness is responsible for ensuring the comparisons are fair, unbiased, and auditable.
Wire the prompt into your application as a stateless function that accepts two evidence passages and a query, then returns a structured JSON object with the winner, confidence, and reasoning. The harness should randomize the order of passages in each call to mitigate position bias—swap passage A and B positions in 50% of calls and normalize the output so the winner field always references the original passage IDs. Implement a validation layer that checks the returned JSON schema, confirms the winner is one of the two provided passage IDs, and rejects any response where the confidence score falls below a configurable threshold (start at 0.6 for high-stakes ranking). Log every comparison with a unique pair ID, the raw model response, and the validated output for audit trails and debugging. For model choice, use a model with strong reasoning capabilities (such as GPT-4o or Claude 3.5 Sonnet) and set temperature to 0 to maximize consistency across repeated comparisons. If you are processing large retrieval sets, batch the comparisons and implement a retry queue with exponential backoff for any pair that fails validation—do not silently drop failed comparisons or you will introduce ranking gaps.
After all pairwise comparisons complete, aggregate the results into a win-loss matrix and compute a global ranking using a simple win-count or Elo-style scoring system. Run transitivity checks: if A beats B and B beats C, verify that A beats C in the direct comparison. Flag any transitivity violations for human review or automatic re-scoring with a higher-confidence threshold. For calibration dataset creation, store the aggregated rankings alongside human-judgment baselines to measure alignment over time. Avoid wiring this prompt directly into user-facing latency-sensitive paths—pairwise comparison is inherently O(n²) and should run asynchronously in evaluation or offline re-ranking pipelines. The most common production failure is position bias leaking through despite randomization; monitor win rates by position slot to detect when the model favors the first passage regardless of content.
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
Start with the base pairwise comparison prompt and a small set of 10-20 passage pairs. Use a frontier model (GPT-4o, Claude 3.5 Sonnet) with temperature=0. Remove the transitivity check and position bias detection initially. Focus on getting consistent winner and rationale fields.
codeCompare these two evidence passages for query [QUERY]: Passage A: [PASSAGE_A] Passage B: [PASSAGE_B] Return JSON with: winner (A, B, or tie), rationale (1-2 sentences), confidence (0-1).
Watch for
- Position bias: model consistently prefers Passage A or the longer passage
- Vague rationales that don't cite specific evidence content
- Confidence scores that don't match rationale quality
- Missing schema validation on the output JSON

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