This prompt is designed for RAG pipelines that must answer comparative questions such as 'Compare Product A and Product B on security features' or 'What are the differences between Framework X and Framework Y for real-time data processing?' Standard evidence selection prompts often exhibit a proximity bias, selecting passages that heavily favor one entity while ignoring another. This prompt enforces balanced representation by requiring the model to select and rank evidence for each entity in the comparison before synthesis.
Prompt
Evidence Selection for Comparative Questions Prompt

When to Use This Prompt
Understand the job-to-be-done, ideal user, and boundaries for the balanced evidence selection prompt.
Use this prompt when your application must produce fair, multi-sided comparisons from a knowledge base, when you need to detect missing evidence for one side of a comparison, and when downstream answer generation depends on unbiased evidence selection. It is particularly valuable for product comparison features, competitive analysis tools, framework evaluation assistants, and any Q&A system where users expect both sides of a comparison to be represented. The prompt works best with retrieval sets that contain passages about all entities being compared; if your knowledge base is heavily skewed toward one entity, the prompt will surface that gap rather than fabricate balance.
Do not use this prompt for single-entity questions ('What are the features of Product A?'), for ranking tasks that don't involve comparison, or when your context window is too small to hold evidence for multiple entities. It is also not a substitute for retrieval quality—if your retriever cannot find relevant passages for one side of the comparison, the prompt will correctly flag the gap but cannot invent missing evidence. For high-stakes comparisons in regulated domains, always pair this prompt with human review of the balanced evidence set before answer synthesis.
Use Case Fit
Where the Evidence Selection for Comparative Questions prompt delivers value and where it introduces risk. Use this to decide if the prompt fits your product workflow before integrating it into a RAG pipeline.
Good Fit: Balanced Multi-Entity Comparison
Use when: the user asks to compare two or more products, options, or entities and you need evidence that fairly represents each side. Guardrail: explicitly require equal passage allocation per entity in the output schema to prevent the model from favoring the first or most-mentioned subject.
Bad Fit: Single-Entity Deep Dive
Avoid when: the question focuses on a single product, person, or concept without comparison intent. Guardrail: route single-entity questions to a standard relevance ranking prompt instead. Using a comparative prompt here wastes tokens and can force artificial contrasts where none exist.
Required Inputs: Entity List and Balanced Corpus
Risk: the prompt cannot enforce balance if the retrieval corpus itself is skewed toward one entity. Guardrail: pre-check that retrieved passages contain at least N passages per entity before invoking the prompt. If one entity has zero evidence, flag the gap and abstain from comparison rather than fabricating parity.
Operational Risk: Selection Bias Drift
Risk: the model may systematically favor the entity mentioned first in the query or the one with more fluent-sounding passages. Guardrail: randomize entity order in the prompt template and run eval checks for representation balance across multiple query phrasings before shipping.
Operational Risk: Missing Entity Detection
Risk: the user asks to compare three entities but retrieval only returns evidence for two. The model may silently drop the third. Guardrail: include an explicit output field for missing_entities and require the model to report any comparison target with zero selected passages before synthesis.
Scale Limit: Token Budget Contention
Risk: comparative prompts need passages for every entity, which can exceed context windows for many-entity comparisons. Guardrail: cap the number of comparable entities (e.g., max 5) and enforce a per-entity passage budget. If the cap is exceeded, prompt the user to narrow the comparison scope.
Copy-Ready Prompt Template
The reusable prompt with square-bracket placeholders. Wire this into your evidence selection step before answer synthesis.
This prompt template performs balanced evidence selection for comparative questions. It is designed to be inserted into your RAG pipeline after retrieval and before answer synthesis. The prompt forces the model to explicitly select and rank passages that fairly represent all entities mentioned in the query, not just the first or most prominent one. Use it when your product surfaces side-by-side comparisons—product comparisons, vendor evaluations, protocol differences, or any multi-entity Q&A where selection bias toward a single subject would break the user experience.
textYou are an evidence selection system for a comparative question-answering application. Your job is to select and rank the most relevant passages from the retrieved context to support a fair, balanced comparison. ## INPUT Query: [QUERY] Entities mentioned in the query: [ENTITIES] Retrieved passages: [PASSAGES] ## CONSTRAINTS - You must select at least one passage for each entity in [ENTITIES] if any relevant passage exists. - If no relevant passage exists for an entity, mark it as MISSING and explain why. - Do not select more than [MAX_PASSAGES] total passages. - Prefer passages that directly compare entities over passages that discuss only one. - When multiple passages cover the same fact, select the most credible source based on [CREDIBILITY_CRITERIA]. - Exclude passages that are duplicates, near-duplicates, or contain no comparative information. ## OUTPUT_SCHEMA Return a JSON object with this structure: { "selected_passages": [ { "passage_id": "string", "entity_coverage": ["entity_name"], "relevance_score": 0.0-1.0, "selection_reason": "string", "passage_text": "string" } ], "entity_balance": { "entity_name": { "passage_count": integer, "status": "COVERED" | "UNDERREPRESENTED" | "MISSING" } }, "excluded_passages": [ { "passage_id": "string", "exclusion_reason": "string" } ], "selection_summary": "string" } ## RISK_LEVEL [RISK_LEVEL]
Adaptation notes: Replace [CREDIBILITY_CRITERIA] with your domain-specific rules—for example, prefer peer-reviewed sources, official documentation, or recency-weighted authority. The [ENTITIES] field should be populated by an upstream entity extraction step; if you don't have one, add an instruction for the model to extract entities from the query first. The [RISK_LEVEL] field controls how conservative the selection should be: set it to HIGH for regulated domains where missing evidence must block answer generation, or LOW for exploratory comparisons where partial coverage is acceptable. After selection, validate the output JSON against the schema before passing it to your synthesis prompt. If the entity_balance field shows any entity as MISSING and your risk level is HIGH, route to a human reviewer or trigger an abstention response rather than synthesizing an unbalanced answer.
Prompt Variables
Inputs the Evidence Selection for Comparative Questions prompt needs to work reliably. Validate these before sending the prompt to prevent selection bias and missing-entity failures.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[ENTITIES_TO_COMPARE] | List of entities, products, or options being compared | ["Product A", "Product B", "Product C"] | Must contain 2+ distinct entities. Reject if single entity or duplicates detected. Parse as array and verify count >= 2. |
[COMPARISON_DIMENSIONS] | Explicit dimensions or criteria for comparison | ["pricing", "scalability", "security compliance", "integration ease"] | Must be non-empty array. Each dimension must be a non-empty string. Reject if dimensions are vague (e.g., 'stuff', 'things'). Minimum 2 dimensions recommended for meaningful comparison. |
[RETRIEVED_PASSAGES] | Full set of retrieved passages from all sources | [{"id": "doc1_chunk3", "text": "...", "source": "vendor_docs", "entity": "Product A"}] | Must include passages for each entity in [ENTITIES_TO_COMPARE]. Validate that every entity has at least one passage. Flag if entity coverage ratio < 0.5 (fewer than half of entities have evidence). |
[PASSAGE_METADATA] | Source metadata for credibility and recency assessment | {"source_type": "official_docs", "date": "2024-11-15", "authority": "vendor"} | Required fields: source_type, date. Validate date is parseable and not null. Reject passages with missing source_type. Flag passages older than [STALENESS_THRESHOLD_DAYS] if set. |
[MAX_PASSAGES_PER_ENTITY] | Upper bound on passages selected per entity to prevent imbalance | 3 | Must be positive integer. Default to 5 if not specified. Used to enforce representation balance. Reject if set to 0 or negative. |
[MIN_PASSAGES_PER_ENTITY] | Minimum passages required per entity before answering | 1 | Must be positive integer <= [MAX_PASSAGES_PER_ENTITY]. Default to 1. If any entity has fewer than this, trigger insufficient-evidence abort rather than biased selection. |
[STALENESS_THRESHOLD_DAYS] | Maximum age in days for evidence to be considered current | 365 | Optional. If set, passages older than threshold receive freshness penalty in ranking. Validate as positive integer. Null means no staleness filtering. |
[OUTPUT_SCHEMA] | Expected JSON structure for selected evidence output | {"selected_passages": [], "excluded_passages": [], "balance_report": {}} | Must be valid JSON Schema or example structure. Validate that schema includes fields for selected passages, excluded passages with reasons, and per-entity selection counts for balance verification. |
Implementation Harness Notes
How to wire the Evidence Selection for Comparative Questions prompt into a production RAG pipeline with validation, retries, and balance enforcement.
This prompt is designed to sit between retrieval and answer synthesis in a comparative Q&A pipeline. It expects a list of entities to compare (e.g., 'Product A, Product B, Product C') and a set of retrieved passages. The harness must enforce representation balance: if the prompt returns evidence skewed toward one entity, the harness should either re-query retrieval with entity-specific filters or flag the output for human review before synthesis proceeds. Do not pass unbalanced evidence selection directly to an answer generation prompt without inspection.
Integration follows a standard RAG pattern: the application receives a comparative query, extracts entity names via a lightweight NER or structured extraction call, retrieves passages for each entity (ideally in parallel with equal top_k limits), concatenates them into the [RETRIEVED_PASSAGES] placeholder, and invokes this prompt. The output schema should be a JSON array of selected passages with entity, passage_id, relevance_score, and selection_rationale fields. Validate the response with a JSON schema validator. If the output fails schema validation, retry once with the error message appended to the prompt. If it fails twice, log the raw output and escalate to a human reviewer.
The most common production failure mode is entity imbalance: the model selects 8 passages for one product and 1 for another. Implement a post-processing balance check that counts selections per entity and rejects outputs where any entity has fewer than min_passages_per_entity (typically 2). When imbalance is detected, do not silently proceed. Instead, route to a fallback path: either re-run the prompt with explicit per-entity passage quotas in the [CONSTRAINTS] block, or use a simpler per-entity selection prompt for each entity individually and merge results. Log imbalance events with entity counts and query text for prompt improvement cycles.
For model choice, use a model with strong instruction-following and JSON mode support (GPT-4o, Claude 3.5 Sonnet, or equivalent). Set temperature=0 or very low to maximize selection consistency. If your retrieval system returns more than 20 passages, pre-filter to the top 15 by vector similarity score before invoking this prompt to stay within context window limits and reduce selection noise. For high-stakes domains (legal, clinical, financial), always require human review of the selected evidence set before answer synthesis, and log the full selection rationale for audit trails.
Common Failure Modes
What breaks first when selecting evidence for comparative questions and how to guard against it.
Selection Bias Toward First Entity
What to watch: The model disproportionately selects evidence about the first entity mentioned in the query, underrepresenting comparison targets. This creates lopsided answers that appear comprehensive but silently omit counter-evidence. Guardrail: Require equal passage counts per entity in the output schema and validate with a post-selection entity-mention count check. If counts are skewed beyond a 60/40 threshold, trigger a re-selection pass with explicit balance instructions.
Missing Entity Blind Spot
What to watch: One or more comparison entities receive zero selected passages, often because retrieval failed for that entity or the model ignored low-confidence results. The downstream answer then fabricates comparisons from thin air. Guardrail: Add a pre-selection entity enumeration step that verifies every query entity has at least one candidate passage in the retrieval set. If not, abort selection and return a missing_evidence flag with the uncovered entities listed.
False Equivalence in Evidence Weighting
What to watch: The model treats all selected passages as equally credible regardless of source authority, recency, or relevance disparity. A marketing page and a peer-reviewed study get equal weight, producing misleading comparisons. Guardrail: Include source credibility metadata in each passage and require the selection prompt to output a credibility_weight per passage. Validate that high-credibility sources are not crowded out by low-credibility filler.
Confirmation Bias in Evidence Selection
What to watch: The model preferentially selects passages that confirm a known or implied preference, ignoring contradictory evidence even when it is highly relevant. This is especially dangerous when the query contains implicit framing. Guardrail: Add a counter-evidence requirement to the prompt: 'For each entity, select at least one passage that presents a limitation, drawback, or unfavorable comparison.' Validate output contains both favorable and unfavorable passages per entity.
Context Window Overflow and Truncation
What to watch: The selection prompt plus retrieved passages exceeds the model's context window, causing silent truncation of later passages. Entities appearing later in the retrieval set are systematically dropped before selection even begins. Guardrail: Implement a pre-flight token count check. If the retrieval set exceeds 80% of the context window, apply a lightweight deduplication and coarse relevance filter before the selection prompt. Log truncation events with entity distribution before and after.
Selection Drift Across Prompt Versions
What to watch: A prompt update intended to improve one comparison dimension silently degrades selection balance, entity coverage, or credibility weighting. Without regression tests, the degradation is discovered only through user complaints. Guardrail: Maintain a golden dataset of comparative queries with expected entity coverage ratios and credibility distributions. Run selection output through automated eval on every prompt change and block deployment if balance metrics regress beyond threshold.
Evaluation Rubric
Run these checks on a golden dataset of comparative queries with known relevant passages. Each criterion targets a specific failure mode in evidence selection for comparative questions.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Entity Representation Balance | Each entity in [COMPARISON_ENTITIES] has at least one passage selected in [SELECTED_EVIDENCE] | One entity has zero passages selected while others have multiple | Count unique entity mentions in selected passages; assert min count >= 1 per entity |
Selection Bias Score | No single entity accounts for more than 60% of total selected passages when comparing 2+ entities | One entity dominates with >60% of selected passages | Calculate passage-to-entity mapping; assert max entity share <= 0.6 for multi-entity comparisons |
Missing Entity Detection | [MISSING_ENTITIES] output is non-empty when retrieval set lacks passages for any entity in [COMPARISON_ENTITIES] | Missing entity list is empty despite retrieval gap confirmed in golden dataset | Compare [MISSING_ENTITIES] against golden dataset expected gaps; assert recall >= 0.9 |
Relevance Precision | At least 80% of [SELECTED_EVIDENCE] passages are labeled relevant in golden dataset | More than 20% of selected passages are irrelevant or off-topic per human judgment | Compute precision = relevant_selected / total_selected; assert precision >= 0.8 |
Comparative Coverage | Selected passages cover all [COMPARISON_DIMENSIONS] specified in the query | One or more comparison dimensions have zero supporting passages selected | Map selected passages to comparison dimensions; assert coverage count == len([COMPARISON_DIMENSIONS]) |
Source Diversity Compliance | [SELECTED_EVIDENCE] draws from at least [MIN_SOURCES] distinct sources when available in retrieval set | All selected passages come from a single source despite multiple sources in retrieval set | Count distinct source IDs in selected passages; assert count >= min([MIN_SOURCES], available_sources) |
Confidence Threshold Adherence | No passage with [CONFIDENCE_SCORE] below [MIN_CONFIDENCE] appears in [SELECTED_EVIDENCE] | Low-confidence passage included in final selection | Scan all selected passage confidence scores; assert min(score) >= [MIN_CONFIDENCE] |
Exclusion Justification Completeness | Every excluded passage from top-K retrieval set has a non-empty [EXCLUSION_REASON] when [INCLUDE_EXCLUSION_LOG] is true | Excluded passages missing justification strings or justification is empty | Assert len([EXCLUDED_PASSAGES]) == len([EXCLUSION_REASONS]); assert all reasons are non-null and non-empty |
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 prompt and a small set of 3-5 comparison entities. Use a simple JSON output contract with selected_evidence and excluded_evidence arrays. Skip strict schema validation during early iteration. Focus on getting balanced representation before adding scoring or ranking fields.
Prompt modification
Replace the output schema with a lightweight version:
json{ "entities_compared": ["[ENTITY_A]", "[ENTITY_B]"], "selected_evidence": [ {"entity": "[ENTITY_NAME]", "passage_id": "[ID]", "relevance": "[BRIEF_NOTE]"} ], "excluded_evidence": [ {"passage_id": "[ID]", "exclusion_reason": "[BRIEF_NOTE]"} ] }
Watch for
- Selection bias toward the first entity mentioned in the query
- Uneven evidence counts across compared entities
- Missing entity detection when one side has zero relevant passages

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