Inferensys

Prompt

Evidence Ranking Failure Mode Catalog Prompt

A diagnostic prompt playbook for RAG quality engineers to systematically test evidence ranking pipelines against known failure modes and produce a structured failure analysis report.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
PROMPT PLAYBOOK

When to Use This Prompt

Diagnose ranking inconsistencies by testing your evidence pipeline against four canonical failure modes.

This prompt is a diagnostic tool for RAG quality and reliability engineers who need to audit their evidence ranking pipeline. It tests a set of retrieved passages against four canonical failure modes: position bias (favoring first or last passages), length bias (favoring longer passages over concise evidence), authority overfitting (overweighting source reputation at the expense of content relevance), and query misalignment (ranking passages that match keywords but miss the user's actual information need). Use this prompt when you are debugging ranking inconsistencies, calibrating a new ranker, or building a regression test suite for your retrieval pipeline. It is not a replacement for your production ranking prompt; it is a diagnostic probe that reveals where your ranking logic breaks under controlled conditions.

To use this prompt effectively, you must provide a controlled input set: a fixed query, a curated list of passages deliberately constructed to expose the four failure modes, and the ranking output from your system under test. The prompt does not rank passages itself—it analyzes the ranking decisions your system already made. This means you need to run your production ranking prompt first, capture its output, and then feed both the input passages and the resulting ranking into this diagnostic prompt. The output is a structured failure analysis report that identifies which biases are present, which passages were misranked, and how severe each failure is. This separation of concerns—ranking versus auditing—keeps the diagnostic independent of your production logic.

Do not use this prompt as your primary ranking mechanism. It is designed for offline analysis, regression testing, and pre-release evaluation, not for serving real user traffic. The prompt expects carefully constructed adversarial examples; running it on arbitrary production traffic will produce noisy, unactionable results. Instead, integrate it into your evaluation harness: run it against a golden dataset of failure-mode test cases before every ranking model or prompt update, and gate deployment on whether the failure analysis report shows regression. For high-stakes domains like medical or legal search, pair this diagnostic with human review of flagged cases before accepting the analysis as ground truth. After running the analysis, feed the identified failure patterns back into your ranking prompt design or reranking logic to close the loop.

PRACTICAL GUARDRAILS

Use Case Fit

Where this diagnostic prompt delivers value and where it falls short. Use these cards to decide if the Evidence Ranking Failure Mode Catalog Prompt belongs in your pipeline.

01

Good Fit: Pre-Production Ranking Audits

Use when: You are about to ship a new ranker, re-ranker, or retrieval pipeline and need a systematic failure mode audit before real users depend on it. Guardrail: Run the catalog prompt against a curated set of known-bias queries and compare the failure report against your acceptance criteria before enabling the pipeline in production.

02

Good Fit: Regression Testing After Model or Index Changes

Use when: You swap embedding models, change vector indexes, or update chunking strategies and need to verify that ranking quality hasn't silently degraded. Guardrail: Maintain a golden query set with expected failure-mode baselines. Run the diagnostic after every infrastructure change and diff the failure reports.

03

Bad Fit: Real-Time Ranking Decisions

Avoid when: You need a prompt that ranks evidence for live user queries in production. This diagnostic prompt analyzes failure patterns, it does not produce ranked evidence lists. Guardrail: Use the Multi-Passage Evidence Ranking Prompt Template or Top-K Evidence Selection Prompt for production ranking. Reserve this catalog prompt for offline quality engineering.

04

Bad Fit: Single-Passage or Trivial Retrieval Sets

Avoid when: Your retrieval pipeline returns only one or two passages per query, or the evidence set is too small to exhibit ranking failure modes like position bias or authority overfitting. Guardrail: Ensure your test queries return at least 5-10 passages with variation in length, source, and position before running the diagnostic. Sparse sets produce noisy failure reports.

05

Required Input: Diverse Retrieval Results with Metadata

Risk: Running the diagnostic on homogeneous retrieval results masks failure modes. If all passages come from one source or have similar lengths, position bias and authority overfitting won't surface. Guardrail: Feed the prompt retrieval results from multiple queries, sources, and document types. Include passage position, length, source authority metadata, and the original query for each set.

06

Operational Risk: Over-Reliance on a Single Diagnostic Run

Risk: Teams treat a single failure mode report as a permanent clean bill of health. Ranking pipelines drift as models, indexes, and content change. Guardrail: Schedule recurring diagnostic runs (weekly or per-deployment) and track failure mode scores over time. Treat the catalog prompt as a continuous monitoring tool, not a one-time gate.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A diagnostic prompt that tests your evidence ranking pipeline against known failure modes and produces a structured failure analysis report.

This prompt is designed to be run as a diagnostic, not as a production ranker. Feed it a retrieval set, a query, and a reference ranking, and it will systematically probe for position bias, length bias, authority overfitting, query misalignment, and other common ranking failure modes. The output is a structured failure analysis report you can use to debug your ranking pipeline before it affects downstream answer generation.

text
You are an evidence ranking diagnostic system. Your job is to analyze a set of retrieved passages against a query and a reference ranking to identify failure modes in the ranking pipeline.

## INPUTS
- Query: [QUERY]
- Retrieved Passages (unordered): [RETRIEVAL_SET]
- Reference Ranking (ground truth order): [REFERENCE_RANKING]
- Ranking Method Under Test: [RANKING_METHOD]

## FAILURE MODES TO CHECK
1. **Position Bias**: Does passage order in the input influence ranking output? Check if early-position passages receive inflated scores regardless of relevance.
2. **Length Bias**: Do longer passages receive systematically higher or lower scores? Compare score-to-length correlation.
3. **Authority Overfitting**: Are passages from high-authority sources ranked above more relevant passages from lower-authority sources? Flag cases where authority signal overrides content relevance.
4. **Query Misalignment**: Do any highly-ranked passages match query keywords but miss the underlying intent? Identify lexical matches that are semantically off-target.
5. **Redundancy Blindness**: Does the ranking surface near-duplicate passages without penalizing redundancy? Flag clusters of semantically equivalent passages occupying top slots.
6. **Coverage Collapse**: Does the top-K ranking cover all required aspects of the query, or does it over-index on one sub-topic? Check for missing query facets.
7. **Score Calibration Drift**: Are relevance scores inflated or compressed relative to the reference? Measure score distribution against reference expectations.

## OUTPUT SCHEMA
Return a JSON object with this structure:
{
  "analysis_summary": {
    "total_passages": <int>,
    "failure_modes_detected": <int>,
    "overall_severity": "low" | "medium" | "high" | "critical",
    "ranking_fidelity_score": <float 0.0-1.0>
  },
  "failure_mode_results": [
    {
      "failure_mode": <string>,
      "detected": <boolean>,
      "severity": "none" | "low" | "medium" | "high",
      "affected_passage_ids": [<string>],
      "description": <string explaining what went wrong>,
      "evidence": <string with specific examples from the ranking>,
      "recommended_action": <string>
    }
  ],
  "ranking_comparison": {
    "reference_order": [<string passage IDs>],
    "observed_order": [<string passage IDs>],
    "kendall_tau_distance": <float>,
    "top_k_overlap_at_5": <float>,
    "top_k_overlap_at_10": <float>
  },
  "calibration_analysis": {
    "mean_score": <float>,
    "score_variance": <float>,
    "score_range": [<float min>, <float max>],
    "calibration_issues": [<string>]
  }
}

## CONSTRAINTS
- Compare the observed ranking against the reference ranking, not against your own judgment of relevance.
- Flag every passage where ranking position deviates from reference by more than 2 positions.
- If the reference ranking is incomplete or ambiguous, note this as a limitation in the analysis.
- Do not re-rank the passages. Your output is a diagnostic report, not a corrected ranking.
- For each detected failure mode, provide at least one concrete example with passage IDs.

To adapt this template, replace [QUERY] with the user question that produced the retrieval set, [RETRIEVAL_SET] with the full unordered list of passages including their IDs and source metadata, [REFERENCE_RANKING] with your ground-truth ordering, and [RANKING_METHOD] with a label identifying the ranker under test (e.g., bm25, cross-encoder-v2, llm-rerank-gpt-4). Run this diagnostic before shipping ranking changes and gate deployment on the ranking_fidelity_score and overall_severity fields. For high-severity findings, fix the ranking pipeline and re-run the diagnostic before promoting to production.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be populated for the diagnostic to produce reliable results.

PlaceholderPurposeExampleValidation Notes

[RANKING_SYSTEM_DESCRIPTION]

Describes the evidence ranking pipeline under test, including model, retrieval method, and intended behavior.

Production RAG ranker using Cohere Rerank v3 over a hybrid search retrieval set of 50 passages from an internal knowledge base.

Must be a non-empty string. Should include enough detail to distinguish the system from a generic ranker. Validate with a length check (>50 chars).

[QUERY]

The user question or search query for which evidence was retrieved and ranked.

What are the side effects of the latest firmware update for the Atlas 9000 sensor?

Must be a non-empty string. Should represent a realistic query for the domain. Validate that it is not a keyword dump or empty.

[RANKED_PASSAGES]

The top-K evidence passages output by the ranking system, in the order they were ranked, including scores and source metadata.

A JSON array of 10 passage objects, each with 'id', 'text', 'score', and 'source' fields.

Must be a valid JSON array with 5-20 objects. Each object must contain 'id', 'text', and 'score' fields. Validate schema compliance and score range (e.g., 0.0-1.0).

[FAILURE_MODE_CATALOG]

A predefined list of known ranking failure modes to test against, such as position bias or length bias.

['position_bias', 'length_bias', 'authority_overfitting', 'query_misalignment', 'redundancy_clustering']

Must be a non-empty JSON array of strings. Each string must match a known failure mode key from the diagnostic's internal catalog. Validate against an allowed list.

[GROUND_TRUTH_ORDER]

An optional expert-annotated ideal ranking for a subset of passages, used for calibration checks.

[3, 7, 1, 5] (representing the correct order of passage IDs for the top 4 most relevant passages)

Can be null. If provided, must be a JSON array of unique passage IDs that exist in [RANKED_PASSAGES]. Validate ID existence and array uniqueness.

[DOMAIN_CONTEXT]

Optional context about the domain, terminology, or user intent to calibrate the failure mode analysis.

The user is a field technician troubleshooting an industrial sensor. Authoritative sources are official manufacturer documentation and peer-reviewed engineering standards.

Can be null. If provided, must be a non-empty string. Validate that it adds specific domain constraints, not just generic instructions.

[OUTPUT_SCHEMA]

The required JSON structure for the failure analysis report, defining the shape of the diagnostic output.

{ 'failure_analysis': [ { 'mode': 'string', 'detected': 'boolean', 'confidence': 'float', 'affected_passages': ['string'], 'explanation': 'string' } ], 'overall_health': 'string' }

Must be a valid JSON Schema object. Validate that it defines required fields and types for the analysis report. A parse check on the schema itself is required before use.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Evidence Ranking Failure Mode Catalog Prompt into a production RAG evaluation pipeline with validation, logging, and gating logic.

This prompt is a diagnostic tool, not a production ranker. It should be wired into your offline evaluation pipeline, triggered against a golden dataset of query-evidence pairs with known failure modes. The harness must supply the prompt with a [QUERY], a [RETRIEVED_PASSAGES] list (each with an ID, text, and optional metadata like source, date, and authority score), and a [FAILURE_MODE_CATALOG] that defines the specific biases to test for—position bias, length bias, authority overfitting, and query misalignment. The output is a structured failure analysis report, not a ranked list, so the harness should parse the JSON output and compare detected failures against expected ground-truth labels in your evaluation set.

For implementation, wrap the prompt call in a function that accepts a test case object and returns a structured result. Validate the output against a strict JSON schema that requires failure_mode_detected (boolean), failure_type (enum matching your catalog), affected_passage_ids (array of strings), and explanation (string). If the model returns malformed JSON, implement a single retry with the error message injected as a [PREVIOUS_OUTPUT_ERROR] constraint. Log every invocation—including the raw prompt, model response, parse success/failure, and detected-vs-expected failure comparison—to your observability platform. For model choice, use a capable instruction-following model (GPT-4o, Claude 3.5 Sonnet, or equivalent) with temperature set to 0 for deterministic diagnostic output. Do not use this prompt in a user-facing request path; it is designed for offline analysis and should be gated behind an eval job scheduler.

The harness should also implement a coverage check: after running the prompt across your evaluation set, aggregate results to identify which failure modes are most frequently detected and which are systematically missed by your production ranker. If the prompt flags authority overfitting in 40% of test cases but your production ranker has no authority signal, that's a clear signal to add source trustworthiness weighting. Avoid the temptation to use this prompt's output as a real-time ranking correction—it is a measurement instrument, not a repair tool. The next step after running this diagnostic is to feed the failure analysis into your ranker improvement backlog, not into your request pipeline.

IMPLEMENTATION TABLE

Expected Output Contract

The structured diagnostic report this prompt should produce. Each field must be validated before the report is considered complete. Missing or malformed fields should trigger a retry or repair step.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (uuid)

Must parse as valid UUID v4. Reject if null or malformed.

analysis_timestamp

string (ISO 8601)

Must parse as valid ISO 8601 datetime. Must be within 5 minutes of system clock at generation time.

ranking_pipeline_version

string

Must match pattern 'v[0-9]+.[0-9]+.[0-9]+'. Reject if empty or 'unknown'.

total_passages_analyzed

integer

Must be >= 1 and <= [MAX_PASSAGES]. Must equal count of items in failure_instances array.

failure_mode_catalog

array of objects

Each object must contain mode_id (string), mode_label (string), detected (boolean), and severity (enum: low, medium, high, critical). Array must not be empty.

failure_instances

array of objects

Each object must contain passage_id (string), failure_mode_id (string matching a catalog entry), evidence_snippet (string, max 500 chars), and explanation (string, max 300 chars). Array length must equal total_passages_analyzed.

position_bias_score

number (float 0.0-1.0)

Must be between 0.0 and 1.0 inclusive. Null not allowed. Score of 0.0 indicates no position bias detected.

length_bias_score

number (float 0.0-1.0)

Must be between 0.0 and 1.0 inclusive. Null not allowed. Score of 0.0 indicates no length bias detected.

authority_overfitting_score

number (float 0.0-1.0)

Must be between 0.0 and 1.0 inclusive. Null not allowed. Score of 0.0 indicates no authority overfitting detected.

query_misalignment_score

number (float 0.0-1.0)

Must be between 0.0 and 1.0 inclusive. Null not allowed. Score of 0.0 indicates perfect alignment.

overall_severity

string (enum)

Must be one of: 'low', 'medium', 'high', 'critical'. Determined by highest severity across all detected failure modes.

recommended_actions

array of strings

Must contain at least 1 item if overall_severity is 'medium' or higher. Each string must be <= 200 chars. Empty array allowed only when overall_severity is 'low'.

requires_human_review

boolean

Must be true if overall_severity is 'high' or 'critical'. Must be false if overall_severity is 'low' and no individual failure mode has severity 'high' or above.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when using the Evidence Ranking Failure Mode Catalog Prompt and how to guard against it.

01

Position Bias Skews Rankings

What to watch: The model over-ranks passages appearing first or last in the input list, ignoring content relevance. This is a well-known transformer attention bias. Guardrail: Randomize passage order before sending to the prompt. Run the ranking twice with reversed order and flag passages whose rank changes by more than 2 positions.

02

Length Bias Favors Verbose Passages

What to watch: Longer passages receive higher relevance scores regardless of content quality because the model equates length with informativeness. Guardrail: Normalize passage lengths before ranking. Include a length-penalty instruction in the prompt and validate that short, high-specificity passages aren't systematically under-ranked.

03

Authority Overfitting to Recognizable Sources

What to watch: The model assigns inflated scores to passages from well-known domains (e.g., wikipedia.org, nih.gov) while undervaluing equally relevant content from less recognizable sources. Guardrail: Strip or anonymize source metadata during ranking. Run a separate authority assessment pass after content-based ranking is complete.

04

Query Misalignment Drift

What to watch: The ranking drifts toward passages that match surface-level keywords rather than the underlying information need, especially with ambiguous queries. Guardrail: Include an explicit query-intent decomposition step before ranking. Validate that top-ranked passages address the decomposed sub-questions, not just keyword overlap.

05

Failure Mode Blind Spots in the Catalog

What to watch: The diagnostic prompt only tests for failure modes explicitly listed in its catalog. Novel failure patterns in your domain go undetected. Guardrail: Regularly update the failure mode catalog with production incidents. Run a parallel open-ended failure analysis prompt that asks 'what else could go wrong here?' and compare results.

06

Score Calibration Collapse

What to watch: All passages receive clustered scores in a narrow range (e.g., 0.7-0.9), making the ranking effectively random. The model avoids committing to low scores. Guardrail: Force a tiered scoring system with explicit low-score anchors. Include calibration examples showing passages that deserve scores of 0.2, 0.5, and 0.9. Validate score variance in output.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating whether the Evidence Ranking Failure Mode Catalog Prompt produces a reliable diagnostic report. Use these checks before trusting the report's findings to debug your ranking pipeline.

CriterionPass StandardFailure SignalTest Method

Failure Mode Coverage

Report identifies at least 4 of 5 known failure modes: position bias, length bias, authority overfitting, query misalignment, and recency bias

Report omits a major failure mode present in the test set or fabricates a non-existent mode

Run prompt against a curated retrieval set with known, injected failure modes; verify all injected modes appear in output

Evidence Attribution

Every claimed failure instance references a specific passage ID or rank position from [RANKED_EVIDENCE]

Report makes generic claims like 'some passages are over-ranked' without citing specific passage IDs

Parse output for passage ID references; confirm each failure claim maps to an element in the input ranking

Severity Calibration

Severity labels (critical/high/medium/low) are consistent with the magnitude of ranking error in the test set

A minor position swap is labeled critical or a top-3 inversion is labeled low severity

Inject ranking errors of known magnitude; check that severity labels correlate with error magnitude using a pre-defined mapping

Root Cause Accuracy

Root cause explanations correctly identify the mechanism (e.g., 'position 1 boost' not 'bad retrieval') for injected failures

Root cause misattributes the failure mechanism or provides a generic explanation like 'model error'

Inject failures with known root causes; compare reported root cause against ground truth; require exact mechanism match for critical failures

False Positive Rate

Report flags zero failure modes when evaluated against a correctly ranked, unbiased evidence set

Report claims failure modes exist in a clean ranking with no injected biases

Run prompt against a golden ranking set with no known failures; pass if zero failure modes are reported

Output Schema Compliance

Output strictly matches [OUTPUT_SCHEMA] with all required fields present and correctly typed

Missing required fields, extra fields, or type mismatches (e.g., string where array is expected)

Validate output against JSON Schema; fail on any schema violation; retry once on failure before rejecting

Actionability of Recommendations

Each reported failure mode includes at least one concrete, testable remediation step (e.g., 'apply position debiasing with alpha=0.3')

Recommendations are vague (e.g., 'improve ranking') or missing entirely for a reported failure

Human review or LLM-as-judge check: does each recommendation specify a parameter, method, or configuration change that can be implemented?

Cross-Mode Interaction Detection

Report identifies when two failure modes interact (e.g., position bias amplifying authority overfitting) if present in test set

Report treats all failure modes as independent when test set contains known interactions

Inject a retrieval set with interacting failure modes; check output for interaction acknowledgment in the analysis section

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base failure mode catalog and a small retrieval set (10-20 passages). Remove the structured JSON output requirement and ask for a plain-text diagnostic summary. Use a single known failure mode (e.g., position bias) rather than the full catalog. Run against 3-5 queries with obvious ranking problems.

code
Analyze this ranked evidence list for position bias only.
Query: [QUERY]
Ranked passages: [PASSAGES]
Describe any position bias you detect.

Watch for

  • The model may invent failure modes that aren't present
  • Without schema constraints, output format will drift across runs
  • Small test sets won't surface rare failure modes like authority overfitting
  • No baseline metrics exist yet, so results are qualitative only
Prasad Kumkar

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.