This prompt is for RAG pipeline engineers and search architects who need to order multiple retrieved passages by relevance, specificity, and support strength for a given query. Use it when your retrieval step returns a flat, unranked set of documents and you need a scored, ordered list before answer generation or citation selection. The prompt produces a ranked list with numerical scores and a short rationale for each passage, making the evidence selection step explicit and auditable. This is the right tool when you need to justify why certain passages were prioritized over others, either for downstream model consumption or for human review of the ranking logic.
Prompt
Multi-Passage Evidence Ranking Prompt Template

When to Use This Prompt
A practical guide for RAG pipeline engineers and search architects on when to deploy multi-passage evidence ranking and when to choose a different tool.
Do not use this prompt when you have a single passage, when you need a binary relevant/not-relevant filter, or when your downstream task requires only the top-1 passage without explanation. This prompt assumes you have already retrieved candidate passages and need to impose order and justification on them. If your retrieval system already returns a scored list from a vector database or search engine, consider whether you need re-ranking with a different set of criteria—this prompt is for the case where retrieval scores are absent, untrustworthy, or insufficiently aligned with your specific evidence quality dimensions. For strict budget-constrained selection, use the Top-K Evidence Selection Prompt Template instead; for pairwise calibration, use the Pairwise Evidence Comparison Prompt.
Before wiring this into production, verify that your retrieval step is returning a diverse enough candidate set that ranking adds value. If your retrieval consistently returns only one or two relevant passages, ranking overhead is wasted latency and cost. Also consider whether your downstream answer generation model exhibits position bias—if it overweights early passages, your ranking order becomes load-bearing and requires additional evaluation. For high-stakes domains where ranking errors could produce misleading answers, pair this prompt with the Evidence Ranking Harness with Eval Checks Prompt to gate rankings before they reach users.
Use Case Fit
Where the Multi-Passage Evidence Ranking Prompt Template delivers value and where it introduces risk. Use these cards to decide if this prompt fits your pipeline before you integrate it.
Strong Fit: Post-Retrieval Ranking
Use when: You already have a retrieval step (vector, keyword, hybrid) returning more passages than you can fit in a context window. Guardrail: This prompt assumes retrieval already happened. Do not use it as a substitute for a search index or vector database.
Strong Fit: Structured Output Pipelines
Use when: Downstream answer generation or citation selection needs a ranked list with scores and rationale, not just a flat set of passages. Guardrail: Validate the output schema before passing ranked passages to the next step. A malformed ranking breaks everything downstream.
Bad Fit: Single-Passage or Trivial Retrieval
Avoid when: Your retrieval step returns only one or two passages, or when all passages are obviously relevant. Guardrail: Ranking overhead adds latency and cost. Skip ranking when the retrieval set is already small and uniformly relevant.
Bad Fit: Real-Time or Ultra-Low-Latency Systems
Avoid when: You need sub-100ms response times and cannot afford an extra model call between retrieval and generation. Guardrail: Consider a lightweight cross-encoder reranker or heuristic scoring instead of an LLM-based ranking pass for latency-sensitive paths.
Required Inputs
What you must provide: A query string, a list of retrieved passages with unique IDs, and optionally source metadata (date, authority, document type). Guardrail: Missing passage IDs make downstream citation linking impossible. Always include stable identifiers in the input schema.
Operational Risk: Position Bias
What to watch: LLMs often favor passages appearing first or last in the input list, skewing rankings toward retrieval order rather than true relevance. Guardrail: Randomize passage order before ranking, run multiple ranking passes with shuffled order, and test for position correlation in eval.
Copy-Ready Prompt Template
A reusable prompt template for ranking multiple evidence passages by relevance, specificity, and support strength, ready to be wired into a RAG pipeline.
This template is the core instruction set for a multi-passage evidence ranker. It expects a user query and a set of retrieved passages, then produces a ranked list with scores and rationale. The square-bracket placeholders are designed to be replaced by your application code at runtime, not by an end user. Before integrating this into production, you must define your output schema, scoring dimensions, and failure-handling logic.
textYou are an evidence ranking specialist. Your task is to evaluate and rank multiple text passages based on their relevance, specificity, and support strength for a given query. ## INPUT [QUERY] [PASSAGES] ## RANKING CRITERIA Rank each passage on a scale of 1-10 for each dimension below, then compute a weighted total score: - **Relevance (weight: 0.4):** How directly the passage addresses the core question or topic in the query. - **Specificity (weight: 0.3):** The level of concrete detail, facts, or data the passage provides. Vague or general statements score lower. - **Support Strength (weight: 0.3):** How strongly the passage's content can be used to answer or substantiate a claim related to the query. ## CONSTRAINTS [CONSTRAINTS] ## OUTPUT FORMAT Return a valid JSON object with the following structure. Do not include any text outside the JSON object. { "ranked_passages": [ { "passage_id": "string", "relevance_score": number, "specificity_score": number, "support_strength_score": number, "weighted_total": number, "rank": number, "rationale": "A one-sentence explanation of the ranking decision." } ], "unranked_passages": ["passage_id"], "ranking_notes": "A brief summary of any global observations, such as overall evidence quality or conflicts." } ## INSTRUCTIONS 1. Analyze the [QUERY] to understand the core information need. 2. For each passage in [PASSAGES], assign scores for relevance, specificity, and support strength. 3. Calculate the weighted total for each passage. 4. Sort passages by weighted total in descending order and assign a rank starting from 1. 5. If a passage is completely irrelevant or unparseable, place its ID in the `unranked_passages` array. 6. Adhere strictly to the [CONSTRAINTS] provided. 7. Output only the JSON object.
To adapt this template, replace [QUERY] with the user's original question, and [PASSAGES] with a pre-formatted string of your retrieved documents, each clearly delimited with an ID (e.g., [ID: doc_1] Content...). The [CONSTRAINTS] placeholder is critical for production control; inject rules like "Exclude passages older than 2023," "Prioritize peer-reviewed sources," or "Maximum of 5 ranked passages." If your application requires a different output schema, replace the JSON structure in the prompt, but ensure your downstream parser and validation logic are updated to match. For high-stakes domains, always route the final ranked list for human review before it is used to generate a user-facing answer.
Prompt Variables
Inputs the prompt needs to work reliably. Validate each before sending. Missing or malformed inputs are the most common cause of ranking failures in production.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[QUERY] | The user question or claim that evidence must be ranked against | What are the side effects of drug X? | Must be non-empty string. Check for vague queries under 10 chars; consider requesting clarification before ranking |
[PASSAGES] | Array of retrieved evidence passages to rank | [{"id":"p1","text":"Study shows..."},{"id":"p2","text":"Earlier research..."}] | Must be valid JSON array with 2+ objects. Each object requires 'id' (string) and 'text' (string). Reject if empty or single-passage |
[RANKING_CRITERIA] | Ordered list of dimensions to score passages on | ["relevance","specificity","authority","recency"] | Must be non-empty array of strings. Map each criterion to a scoring definition in the prompt. Default to relevance and specificity if not provided |
[OUTPUT_SCHEMA] | Expected JSON structure for ranked results | {"rankings":[{"id":"string","score":0.0-1.0,"tier":"high|medium|low","rationale":"string"}]} | Validate schema before prompt assembly. Include tier enum values and score range constraints. Reject if schema allows unbounded outputs |
[TOP_K] | Number of top passages to return in final ranking | 5 | Must be positive integer. Cap at retrieval set size. Warn if TOP_K exceeds available passages; default to all passages if null |
[SOURCE_METADATA] | Optional metadata for authority and recency weighting | {"p1":{"date":"2024-03","authority":"peer-reviewed","source":"PubMed"}} | If provided, must be valid JSON object keyed by passage ID. Null allowed. Validate date format (YYYY-MM) and authority enum values if used in scoring |
[CONSTRAINTS] | Hard rules the ranking must obey | ["no duplicate sources in top 3","minimum 2 distinct authors in top 5"] | Must be array of strings or null. Each constraint must be checkable programmatically. Reject constraints that require external knowledge not in [PASSAGES] or [SOURCE_METADATA] |
[POSITION_BIAS_CHECK] | Flag to enable position bias detection in ranking output | Must be boolean. When true, prompt includes instruction to justify why first-retrieved passage is not over-ranked. Set false for latency-sensitive paths |
Implementation Harness Notes
How to wire the multi-passage evidence ranking prompt into a production RAG pipeline with validation, retries, and evaluation checks.
The multi-passage evidence ranking prompt operates as a critical middleware step between retrieval and answer generation. In a typical RAG pipeline, you retrieve N passages (often 20–50), but your downstream answer generator can only consume K passages (often 3–10) due to context window or latency constraints. This prompt transforms an unsorted retrieval set into a ranked, scored, and justified list that downstream components can trust. The implementation harness must handle three concerns: input assembly (gathering passages, query, and optional metadata), output validation (ensuring the model returns a parseable ranking with required fields), and integration gating (deciding whether the ranking quality is sufficient to proceed or whether re-retrieval or human review is needed).
Wire the prompt into your application as a dedicated ranking service with a strict contract. On the input side, assemble a payload containing the user query, the list of retrieved passages (each with a unique passage ID, full text, and optional source metadata like publication date or authority tier), and any ranking constraints such as top-K count, diversity requirements, or recency weighting. On the output side, enforce a JSON schema that requires each ranked passage to include the passage ID, a relevance score (normalized 0.0–1.0), a strength tier (high/medium/low/insufficient), and a one-sentence selection rationale. Implement a validation layer that checks: (a) all output passage IDs exist in the input set, (b) scores are within range, (c) the ranking is non-empty, and (d) rationales are present and non-generic. If validation fails, retry once with the error message injected into the prompt as a correction hint. If the second attempt also fails, log the failure and fall back to a simpler ranking heuristic such as cosine similarity to the query embedding. For high-stakes domains like legal or medical evidence, add a human review step when confidence scores fall below a configurable threshold or when contradiction detection flags are raised.
Model choice matters for ranking consistency. Use a model with strong instruction-following and structured output capabilities—GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro are good starting points. Avoid smaller or older models that exhibit position bias (favoring the first or last passages) or length bias (favoring longer passages regardless of relevance). To mitigate position bias in the harness, randomize passage order in the input payload before sending it to the model. For latency-sensitive applications, consider batching multiple ranking requests or using a faster model for initial filtering followed by a more capable model for final ranking of the top candidates. Log every ranking request with the input passages, output ranking, validation results, and any retry attempts. This trace data is essential for debugging ranking failures, calibrating scoring thresholds, and building evaluation datasets for future prompt improvements. Before shipping, run the ranking harness against a golden dataset of query-passage pairs with known relevance judgments and measure ranking correlation metrics like NDCG or Kendall's tau to establish a quality baseline.
Expected Output Contract
Defines the strict JSON schema for the ranked evidence output. Each field includes validation rules to ensure the prompt's output can be parsed and trusted by downstream RAG components.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
ranked_passages | array of objects | Array must contain at least 1 item. If no passages meet the minimum relevance threshold, return an empty array. | |
ranked_passages[].passage_id | string | Must match an ID from the input [PASSAGES] array. Non-matching IDs should trigger a retry or filter. | |
ranked_passages[].relevance_score | number | Must be a float between 0.0 and 1.0 inclusive. Scores must be in descending order across the array. | |
ranked_passages[].strength_tier | string | Must be one of the enum values: 'high', 'medium', 'low'. 'high' tier passages must have a relevance_score >= 0.8. | |
ranked_passages[].rationale | string | Must be a non-empty string under 280 characters. Must reference specific content from the passage, not just generic praise. | |
ranked_passages[].key_quote | string | If provided, must be a verbatim substring found within the passage text. Null is allowed if no single quote is sufficient. | |
query_coverage_gap | boolean | Must be true if the top-K passages collectively fail to address a core aspect of [QUERY], otherwise false. Drives re-retrieval logic. | |
ranking_model_version | string | If provided, a self-reported identifier for the prompt version used. Useful for debugging drift in production logs. |
Common Failure Modes
Multi-passage evidence ranking fails in predictable ways. These are the most common failure modes in production RAG pipelines, with concrete guardrails to catch them before they degrade answer quality.
Position Bias Skews Top Ranks
What to watch: The model overweights passages at the beginning or end of the input list, assigning higher relevance scores based on position rather than content. This is especially dangerous when retrieval order correlates with document structure rather than true relevance. Guardrail: Randomize passage order before ranking, run multiple ranking passes with shuffled inputs, and compare score stability across permutations. Flag rankings where position explains more variance than content features.
Length Bias Favors Verbose Passages
What to watch: Longer passages receive inflated relevance scores because they contain more tokens that overlap with the query, even when shorter passages are more precise and directly supportive. This produces rankings that reward verbosity over specificity. Guardrail: Normalize relevance scores by passage length, include a conciseness dimension in your ranking rubric, and explicitly instruct the model to penalize passages that bury relevant information in filler content.
Authority Overfitting Ignores Content Relevance
What to watch: The model overweights source authority signals (domain, publisher, author credentials) and underweights whether the passage actually addresses the query. High-authority but tangentially relevant passages outrank lower-authority passages that directly answer the question. Guardrail: Separate authority assessment from relevance ranking into distinct scoring dimensions, require the model to justify each rank with specific passage content, and test rankings against authority-agnostic human judgments.
Query Misalignment Produces Surface-Level Matches
What to watch: The model ranks passages based on keyword overlap or superficial topic similarity rather than deep alignment with the query's actual information need. Passages about the same topic but answering a different question receive high scores. Guardrail: Include query intent clarification in the ranking prompt, require the model to restate what the query is actually asking before ranking, and add a specificity dimension that penalizes passages that are topically related but answer a different question.
Redundancy Clusters Waste Top-K Slots
What to watch: Multiple near-duplicate or semantically equivalent passages occupy top ranking positions, crowding out diverse evidence. The downstream answer generator sees the same information repeated and misses alternative perspectives or complementary details. Guardrail: Add a diversity constraint to the ranking prompt, implement post-ranking deduplication that selects the strongest representative from each cluster, and measure unique information coverage in the top-K set before passing to answer generation.
Score Calibration Drift Across Queries
What to watch: The model's internal score scale shifts between queries, making it impossible to set a consistent relevance threshold for downstream gating. A score of 0.7 on one query may indicate strong relevance while 0.7 on another indicates marginal relevance. Guardrail: Anchor scores to a fixed rubric with behavioral descriptions for each tier, include calibration examples in the prompt that demonstrate consistent scoring across query types, and monitor score distributions in production to detect drift.
Evaluation Rubric
Use this rubric to test the quality and reliability of the Multi-Passage Evidence Ranking prompt before shipping. Each criterion includes a pass standard, a failure signal, and a test method.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Ranking Stability | Top-3 passages are identical across 5 runs with temperature 0 | Top-3 order changes or passages drop out between runs | Run prompt 5 times with identical input; compare ranked lists |
Position Bias Resistance | Passage originally at position 7+ enters top-3 when it is the most relevant | Top-3 consists only of passages from the first 5 input positions regardless of relevance | Inject a highly relevant passage at a late position; verify it ranks appropriately |
Score Calibration | Relevance scores for clearly relevant passages are >= 0.8; irrelevant passages are <= 0.3 | Irrelevant passage scores above 0.6 or highly relevant passage scores below 0.5 | Use a golden dataset with known relevance labels; compare score distributions |
Rationale Grounding | Rationale text references specific passage content, not just the passage ID | Rationale is generic (e.g., 'this passage is relevant') or hallucinates content not in the passage | Manual review of 20 random rationales against source passages |
Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] exactly | JSON parse error, missing required fields, or extra fields present | Validate output against the schema with a JSON schema validator |
Length Bias Resistance | A short, highly relevant passage outranks a long, moderately relevant passage | Longer passages consistently receive higher scores regardless of relevance | Construct test pairs with controlled relevance and varying length; check rank order |
Contradiction Handling | Contradictory passages are both included in ranking with lower confidence scores noted | One contradictory passage is dropped entirely or both receive high confidence without conflict flag | Provide passages with known contradictions; verify both appear and conflict is noted |
Empty Input Handling | Returns an empty ranked list or a valid refusal when [PASSAGES] is empty | Hallucinates passages, throws an unhandled error, or returns malformed output | Submit prompt with empty passage list; check output structure and 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 ranking prompt and a small retrieval set (5-10 passages). Use natural language output instead of strict JSON schema. Focus on getting the ranking logic right before adding validation.
codeRank the following passages by relevance to the query: [QUERY] Passages: [PASSAGE_LIST] Return a ranked list with a short reason for each position.
Watch for
- Position bias: passages listed first in the input often get ranked higher regardless of content
- Length bias: longer passages may receive inflated relevance scores
- Missing edge cases: test with zero passages, one passage, and all-irrelevant 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