This prompt is designed for the specific job of re-ranking an initial retrieval set using multiple weighted evidence quality criteria. It is not a first-pass retrieval prompt. Use it when your vector store, keyword index, or hybrid retriever has already returned a candidate set of 10 to 50 passages and you need to order them by a composite score that balances relevance, recency, authority, specificity, and query alignment. The ideal user is a search engineer or RAG pipeline architect who has access to passage metadata—such as publication dates, source identifiers, or domain classifications—and needs an auditable, debuggable ranking before answer generation or evidence selection.
Prompt
Retrieval Set Re-Ranking Prompt with Weighted Criteria

When to Use This Prompt
A practical guide for search engineers and RAG pipeline architects on when to deploy a multi-factor re-ranking prompt and when to choose a simpler alternative.
The prompt produces a final ranked list with per-passage score breakdowns showing exactly how each criterion contributed to the overall ranking. This makes it suitable for production systems where you must log why one passage was chosen over another, debug ranking anomalies, or demonstrate to compliance reviewers that evidence selection follows a defined policy. You should wire this prompt after your initial retrieval step but before any answer synthesis or citation selection. The weighted criteria are configurable, so you can adjust the importance of recency for time-sensitive domains like news or finance, or increase the authority weight for regulated industries like healthcare or legal tech.
Do not use this prompt for single-factor relevance scoring, for filtering without ranking, or when you lack the metadata required for multi-factor assessment. If you only need to filter passages above a relevance threshold, a simpler threshold-based filtering prompt will be faster and cheaper. If your retrieval set is smaller than 5 passages, the overhead of multi-factor scoring may not be justified. This prompt also assumes you already have a defined set of weighted criteria; if you are still calibrating which factors matter for your domain, start with the Multi-Factor Evidence Weighting Prompt Template to establish your weights before deploying this re-ranking prompt in production.
Use Case Fit
Where this re-ranking prompt works and where it introduces risk. Use these cards to decide if weighted criteria re-ranking fits your pipeline or if a simpler approach is safer.
Good Fit: Multi-Signal Retrieval Pipelines
Use when: you have multiple retrieval sources (vector, keyword, hybrid) with incompatible score distributions, or you need to combine relevance, recency, and authority into a single ranked list. Guardrail: normalize raw scores before weighting to prevent one signal from dominating the final rank.
Bad Fit: Single-Source Retrieval with Calibrated Scores
Avoid when: your retriever already produces well-calibrated relevance scores and you don't need multi-factor weighting. Adding a re-ranking step here adds latency and cost without improving ranking quality. Guardrail: benchmark re-ranked results against raw retrieval scores before committing to the extra step.
Required Input: Configurable Weight Vector
What to watch: hardcoded weights that drift from actual user needs. A fixed weight for recency breaks when queries shift from breaking news to historical analysis. Guardrail: expose weight configuration as a runtime parameter, not a baked-in constant. Log weight vectors alongside results for audit.
Operational Risk: Latency Budget Blowout
Risk: scoring every passage on multiple criteria with an LLM call per passage can add seconds to retrieval latency, breaking user-facing SLAs. Guardrail: pre-filter to a manageable candidate set (top 20-50 passages) before re-ranking. Set a hard timeout and fall back to raw retrieval order if re-ranking exceeds budget.
Operational Risk: Criteria Weight Sensitivity
Risk: small changes in weight configuration can produce dramatically different rankings, making behavior unpredictable across deployments. Guardrail: run sensitivity analysis on weight changes before shipping. Flag configurations where a 10% weight shift reorders more than 30% of the top-10 results.
Bad Fit: Low-Latency Streaming Applications
Avoid when: your application requires sub-200ms end-to-end latency. LLM-based re-ranking with per-passage scoring and justification adds unacceptable delay. Guardrail: use a lightweight cross-encoder reranker for latency-sensitive paths. Reserve weighted-criteria LLM re-ranking for batch or async evaluation pipelines.
Copy-Ready Prompt Template
A reusable prompt for re-ranking a retrieval set using multiple weighted evidence quality criteria, producing a ranked list with per-passage score breakdowns.
This prompt template is designed to be copied directly into your application code, test suite, or prompt management platform. It accepts an initial retrieval set and a set of weighted criteria, then returns a re-ranked list where each passage includes a composite score and a breakdown showing how each criterion contributed. Replace every square-bracket placeholder with your actual data before sending the prompt to the model. The template is model-agnostic but assumes the target model can follow structured output instructions and produce valid JSON.
textYou are an evidence ranking specialist. Your task is to re-rank a set of retrieved passages using multiple weighted criteria. You will receive a query, a list of passages, and a set of scoring criteria with weights. For each passage, you must assign a score for every criterion, compute a weighted composite score, and return the passages in descending order of composite score. ## INPUT **Query:** [USER_QUERY] **Retrieved Passages:** [PASSAGE_LIST] **Scoring Criteria (with weights):** [CRITERIA_LIST] ## INSTRUCTIONS 1. For each passage, evaluate it against every criterion listed above. Assign a score from [SCORE_RANGE] for each criterion, where [SCORE_RANGE_DESCRIPTION]. 2. Compute the weighted composite score for each passage by multiplying each criterion score by its weight and summing the results. 3. Include a brief justification (1-2 sentences) for each criterion score, citing specific content from the passage. 4. Rank all passages in descending order of composite score. 5. If two passages have identical composite scores, break the tie using [TIEBREAK_RULE]. 6. Flag any passage that falls below the minimum threshold of [MINIMUM_THRESHOLD] with a `discard: true` field and a reason. ## OUTPUT FORMAT Return a JSON object with the following structure: { "ranked_passages": [ { "passage_id": "string", "composite_score": number, "rank": integer, "criteria_scores": { "[CRITERION_NAME]": { "score": number, "justification": "string" } }, "discard": boolean, "discard_reason": "string or null" } ], "ranking_metadata": { "total_passages": integer, "discarded_count": integer, "score_range_used": "string", "tiebreaks_applied": integer } } ## CONSTRAINTS [CONSTRAINTS] ## EXAMPLES [FEW_SHOT_EXAMPLES]
Adaptation guidance: Replace [USER_QUERY] with the original search query. [PASSAGE_LIST] should be a JSON array of objects, each containing at minimum an id and text field. [CRITERIA_LIST] must be a JSON array of objects with name and weight keys, where weights sum to 1.0. [SCORE_RANGE] and [SCORE_RANGE_DESCRIPTION] define your scoring scale—common choices are 0-10 or 1-5 with explicit anchors. [TIEBREAK_RULE] should specify a deterministic secondary sort, such as "prefer the passage with the higher relevance criterion score." [MINIMUM_THRESHOLD] is the composite score below which passages are discarded. [CONSTRAINTS] is where you add domain-specific rules, such as "penalize passages older than 90 days" or "require at least one citation from a peer-reviewed source." [FEW_SHOT_EXAMPLES] should include 2-3 worked examples showing the expected scoring behavior, especially for edge cases like near-miss passages or conflicting evidence.
Before deploying this prompt, validate that your model reliably produces the output schema. Run at least 20 test cases through the prompt and check for schema compliance, score range adherence, and tiebreak consistency. For high-stakes ranking pipelines, add a post-processing validation step that rejects malformed JSON, scores outside the defined range, or missing justifications. If the ranking output feeds directly into answer generation or user-facing results, implement a human review gate for the first several hundred production runs until score calibration is confirmed against human judgments.
Prompt Variables
Each placeholder must be populated and validated before the re-ranking prompt is sent. Missing or malformed inputs are the most common cause of ranking instability and score miscalibration in production.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[QUERY] | The original user question or search string that the retrieval set was fetched for | What are the side effects of atorvastatin compared to rosuvastatin? | Must be non-empty string. Check for truncation if query exceeds 2000 characters. Log original query for traceability. |
[RETRIEVAL_SET] | Array of passage objects from the initial retrieval step, each containing id, text, source, and optional metadata | [{"id":"doc-17","text":"Atorvastatin commonly causes...","source":"pubmed-3421","date":"2024-03-15"}] | Must be valid JSON array with 2-50 passages. Each passage requires id and text fields. Reject if text field is empty or null. Validate array length before sending. |
[CRITERIA_WEIGHTS] | Object mapping each scoring criterion to its weight in the final ranking formula. Weights should sum to 1.0 | {"relevance":0.40,"recency":0.20,"authority":0.25,"specificity":0.15} | Must be valid JSON object. All weight values must be floats between 0.0 and 1.0. Sum of all weights must equal 1.0 within 0.01 tolerance. Reject if any criterion weight is negative. |
[CRITERIA_DEFINITIONS] | Natural language definitions for each scoring criterion, explaining what the model should evaluate and how to assign scores | {"relevance":"How directly the passage answers the query. Score 1-10.","authority":"Source credibility based on publication type, author expertise, and peer-review status. Score 1-10."} | Must be valid JSON object with one definition per key in CRITERIA_WEIGHTS. Each definition must be a non-empty string. Missing definitions cause inconsistent scoring behavior. |
[SCORE_RANGE] | The numerical range for per-criterion scores, specified as min and max | {"min":1,"max":10} | Must be valid JSON object with integer min and max fields. Max must be greater than min. Range must be consistent across all criteria. Common ranges: 1-5, 1-10, 0-100. |
[OUTPUT_SCHEMA] | Expected JSON structure for the ranked output, including required fields and their types | {"ranked_passages":[{"id":"string","rank":"integer","total_score":"float","criterion_scores":{"relevance":"float"},"justification":"string"}]} | Must be valid JSON Schema or example structure. Validate that downstream consumers can parse this exact shape. Schema mismatch between prompt output and application code is a top-3 production failure mode. |
[MAX_RANKED_RESULTS] | Integer specifying how many top-ranked passages to return in the final output | 10 | Must be positive integer between 1 and length of RETRIEVAL_SET. If set higher than retrieval set length, return all passages. Null not allowed. Default to 10 if unspecified but log a warning. |
[RANKING_TIEBREAKER] | Rule for resolving score ties between passages, specified as a priority-ordered list of criteria | ["relevance","authority","recency"] | Must be non-empty array of criterion names matching keys in CRITERIA_WEIGHTS. Order matters. If omitted, model may use arbitrary tiebreaking, causing non-deterministic rankings across runs. |
Implementation Harness Notes
How to wire the re-ranking prompt into a RAG pipeline with validation, retries, and observability.
This prompt is designed to sit between your initial retrieval step and the final answer generation step in a RAG pipeline. It expects a pre-fetched set of candidate passages and a user query, and it returns a ranked list with per-criterion score breakdowns. The harness should treat this prompt as a scoring microservice: it receives a batch of passages, applies weighted criteria, and returns a structured ranking that downstream components can consume without re-parsing.
To integrate this into production, wrap the prompt call in a function that validates the output schema before passing results forward. The expected output is a JSON array of ranked passages, each containing a passage_id, rank, total_score, and a criteria_scores object with keys matching your configured weights (e.g., relevance, recency, authority, specificity). Implement a schema validator that checks: (1) all input passage IDs appear exactly once in the output, (2) ranks are sequential integers starting at 1, (3) total scores are numeric and within expected ranges, and (4) criteria score objects contain only the expected keys. If validation fails, retry once with the same input and a stronger constraint instruction appended to the prompt. If the second attempt also fails, log the malformed output and fall back to the original retrieval order with a warning flag.
For observability, log the input passage count, the output rank distribution, and the per-criterion score ranges on each call. This lets you detect criteria weight dominance—where one criterion (often relevance) overwhelms the others and makes the weighting effectively single-factor. Set up a periodic eval that runs a fixed query set through the re-ranker and checks rank stability: if re-ranking the same passages produces materially different orders across calls, your temperature may be too high or your prompt instructions too loose. For high-stakes domains, route a sample of re-ranked outputs to a human review queue where reviewers can flag misranked passages and feed corrections back into your eval dataset.
When wiring this into a full RAG pipeline, place the re-ranker after retrieval and before context window packing. If your initial retrieval returns more passages than fit in the model's context, use the re-ranked scores to select the top-N passages for answer generation. Avoid the temptation to re-rank the entire corpus—this prompt is designed for re-ranking a candidate set, not for primary retrieval. For latency-sensitive applications, consider batching multiple queries into a single re-ranking call if your prompt template supports it, but validate that batch size does not degrade ranking quality through attention dilution.
Common Failure Modes
Re-ranking with weighted criteria introduces complex failure modes beyond simple relevance scoring. These are the most common breaks in production and how to guard against them.
Single-Criterion Dominance
What to watch: One weight (e.g., recency) overwhelms all others, turning a multi-factor re-ranker into a single-signal sort. A fresh but irrelevant document outranks a slightly older, perfectly relevant one. Guardrail: Implement a minimum score floor for each criterion and run sensitivity analysis on weight configurations before deployment. Log per-criterion score distributions to detect dominance drift.
Score Scale Incompatibility
What to watch: Relevance scores on a 0-1 scale combined with authority scores on a 1-100 scale silently skew the weighted sum. The model treats all inputs as equally calibrated when they aren't. Guardrail: Normalize all sub-scores to a common scale (e.g., 0-1) before aggregation. Validate normalization with known edge cases and log pre-normalization and post-normalization values for audit.
Position Bias in Re-Ranking
What to watch: The model inflates scores for passages appearing earlier in the retrieval set, reproducing the original ranking rather than independently re-evaluating each passage. Guardrail: Randomize passage order before re-ranking and run A/B tests comparing original-order vs. shuffled-order scores. Flag cases where re-ranked order correlates strongly with input order.
Missing Evidence Due to Over-Filtering
What to watch: Threshold-based filtering removes passages that score low on one criterion but contain critical information not captured by the scoring rubric. The answer generator receives an empty or incomplete evidence set. Guardrail: Set permissive initial thresholds and log all filtered passages with their scores and exclusion reasons. Implement a fallback that relaxes thresholds when the surviving set is too small.
Weight Configuration Drift in Production
What to watch: Weights tuned on a golden dataset produce different ranking behavior in production as query patterns, document freshness, or source mix change. The re-ranker silently degrades. Guardrail: Monitor per-criterion score distributions and ranking stability metrics over time. Schedule periodic recalibration against production samples and set alerts when score distributions shift beyond configured bounds.
Unjustified Score Confidence
What to watch: The model assigns high-confidence scores to passages it cannot actually assess—for example, scoring authority highly for an unfamiliar source or rating specificity without understanding the domain. Guardrail: Require the prompt to output confidence intervals or uncertainty flags alongside scores. Cross-reference authority scores against a known source registry when available. Escalate low-certainty passages for human spot-checking.
Evaluation Rubric
Test the re-ranking prompt's output quality before production deployment. Each criterion targets a specific failure mode in retrieval re-ranking with weighted criteria. Run these checks against a golden dataset of 20-50 query-passage sets with known relevance judgments.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Ranking Stability | Top-3 passages remain identical across 5 repeated runs with temperature=0 | Top-3 order shifts by more than 1 position between runs | Run prompt 5 times on same input; measure Kendall tau distance between rankings |
Criteria Weight Sensitivity | Changing a single criterion weight by ±0.2 does not invert the top-ranked passage unless that criterion is the primary differentiator | Small weight change causes top passage to drop below rank 3 | Perturb each weight individually by ±0.1 and ±0.2; track top-passage identity changes |
Score Breakdown Completeness | Every returned passage has a non-null score for each declared criterion in [CRITERIA_WEIGHTS] | Missing criterion field or null score in any passage's breakdown | Schema validation: assert all keys from [CRITERIA_WEIGHTS] present in each passage's score object |
Relevance Discrimination | Passages labeled 'irrelevant' in golden dataset receive bottom-quartile scores | Irrelevant golden passage ranks in top half of scored results | Compare prompt scores against human-labeled relevance tiers; compute AUROC for relevant vs irrelevant |
Recency Weighting Accuracy | Passages published within [RECENCY_WINDOW] days receive higher recency sub-scores than older passages with equal relevance | Older passage outranks newer passage when relevance scores are within 0.1 of each other | Construct query pairs with recency as the only differentiator; verify score ordering |
Authority Signal Detection | Passages from [AUTHORITY_DOMAINS] receive authority sub-scores at least 0.2 higher than non-authority sources with equal relevance | Non-authority source outranks authority source when relevance difference is under 0.15 | Pairwise comparison of authority vs non-authority passages matched on relevance; measure score gap |
Output Schema Compliance | 100% of responses parse as valid JSON matching [OUTPUT_SCHEMA] without repair | JSON parse failure, missing required fields, or type mismatch in any field | Automated schema validation against [OUTPUT_SCHEMA] definition; count parse failures across 50 test runs |
Score Range Calibration | All sub-scores and final scores fall within [MIN_SCORE] to [MAX_SCORE] inclusive | Score outside declared range or NaN value in any score field | Assert min/max bounds on every numeric score field; flag any out-of-range or non-finite values |
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
Add strict JSON output schema, per-criterion score breakdowns, and validation retries. Include explicit weight coefficients for each criterion and require the model to output both raw scores and weighted totals. Wire in eval checks for ranking stability and criteria weight sensitivity.
codeRe-rank [PASSAGES] for query: [QUERY]. Apply these weights: relevance=0.4, recency=0.2, authority=0.2, specificity=0.2. For each passage, output: { "passage_id": "string", "scores": { "relevance": 0-10, "recency": 0-10, "authority": 0-10, "specificity": 0-10 }, "weighted_total": number, "justification": "string" } Return the full list sorted by weighted_total descending.
Watch for
- Silent format drift where the model drops score fields under load
- Missing human review gates for high-stakes ranking decisions
- Criteria weight sensitivity causing rank flips on borderline passages
- Score inflation on passages that appear early in the input list

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