This prompt is for document intelligence engineers and RAG pipeline architects who need to rank sections, chunks, or passages from a long document by their relevance to a specific query. It produces ordered salience scores with key excerpt identification and includes coverage checks to prevent missing critical sections. Use this when your retrieval step returns a large set of candidate passages from a single long document and you need to prioritize which sections to include in a context window for downstream answer generation or summarization.
Prompt
Passage Salience Ranking Prompt for Long Documents

When to Use This Prompt
Defines the ideal use case, required inputs, and boundaries for the passage salience ranking prompt in long-document RAG pipelines.
This prompt is not a replacement for initial vector or keyword retrieval. It assumes you already have a candidate set of passages from a single document and need to rank them by salience before context assembly. The ideal user has already run a broad retrieval step—likely returning 20 to 50 candidate chunks from a contract, technical manual, regulatory filing, or research paper—and now faces a context window budget that can only hold 5 to 10 of those chunks. The prompt's job is to prevent the most relevant passage from being crowded out by superficially similar but less salient neighbors. It works best when the document has clear structural boundaries (sections, clauses, chapters) and the query requires synthesizing information that may be distributed across non-adjacent parts of the document.
Do not use this prompt when you need to compare passages across multiple documents—that requires cross-document evidence ranking with authority weighting, not single-document salience. Do not use it as a standalone retrieval step on a raw document without prior chunking and candidate retrieval. Do not use it when the query can be answered from a single obvious passage; the overhead of ranking is wasted when retrieval precision is already perfect. Do not use it for real-time streaming applications where the ranking latency would violate response time SLAs. Finally, do not use it without a coverage check: the prompt includes explicit instructions to flag any document sections that appear relevant but were missing from the candidate set, and skipping that check risks silent omissions in high-stakes document review workflows.
Use Case Fit
Where Passage Salience Ranking fits, where it breaks, and what you need before you start.
Good Fit: Long-Form Document Analysis
Use when: You have a single long document (contract, report, manual) and need to rank its internal sections by relevance to a specific query. Guardrail: The prompt expects a single document split into chunks, not a mixed retrieval set from multiple sources.
Bad Fit: Real-Time Web Search Results
Avoid when: Your passages come from a diverse, multi-source search index with varying authority, freshness, and format. Guardrail: Use a Cross-Encoder Reranking or Source Credibility Weighting prompt instead. This prompt assumes a single coherent document, not a heterogeneous corpus.
Required Inputs
What you need: A pre-chunked document with stable section identifiers, a clear user query, and a defined output schema for salience scores. Guardrail: Without stable chunk IDs, you cannot map scores back to source locations for downstream citation or answer generation.
Operational Risk: Missing Critical Sections
What to watch: The model ranks passages by query relevance but may omit sections that are contextually vital for a complete answer. Guardrail: Add a coverage check step that verifies all document sections are accounted for and flags any gaps before answer generation.
Latency and Cost Sensitivity
What to watch: Ranking every passage in a very long document (e.g., 200+ chunks) with pairwise reasoning can be slow and expensive. Guardrail: Pre-filter with a lightweight keyword or embedding step to reduce the candidate set before invoking the salience ranking prompt.
Score Calibration Drift
What to watch: Salience scores may drift in meaning across different documents or queries, making it hard to set a consistent threshold for inclusion. Guardrail: Calibrate scores against a golden set of query-document pairs with known relevant sections, and monitor score distributions in production.
Copy-Ready Prompt Template
A reusable prompt for ranking document passages by salience to a query, with placeholders for inputs, constraints, and output schema.
This prompt template is designed for document intelligence engineers who need to rank sections or chunks from long documents by their relevance to a specific query. It produces ordered salience scores with key excerpt identification and includes coverage checks to prevent missing critical sections. The template uses square-bracket placeholders that must be replaced with actual values before sending to the model. Each placeholder serves a specific purpose: [QUERY] defines what you're looking for, [PASSAGES] contains the document chunks to rank, [OUTPUT_SCHEMA] specifies the expected JSON structure, [CONSTRAINTS] enforces ranking rules and coverage requirements, and [RISK_LEVEL] adjusts the model's behavior for high-stakes domains.
textYou are a document intelligence system that ranks passages from long documents by their relevance to a query. Your task is to produce an ordered salience ranking with supporting evidence and coverage verification. ## Query [QUERY] ## Passages to Rank [PASSAGES] ## Output Schema Return a JSON object with this exact structure: { "ranked_passages": [ { "passage_id": "string", "salience_score": number (0.0 to 1.0), "rank": integer, "key_excerpt": "string (most relevant quote from the passage)", "relevance_rationale": "string (why this passage matters to the query)" } ], "coverage_assessment": { "query_aspects_covered": ["string"], "query_aspects_missing": ["string"], "overall_coverage_score": number (0.0 to 1.0), "recommendation": "string (whether additional retrieval is needed)" } } ## Constraints [CONSTRAINTS] ## Risk Level [RISK_LEVEL] ## Instructions 1. Read all passages carefully before ranking. 2. Assign salience scores based on direct relevance to the query, not general topic similarity. 3. For each passage, extract the single most relevant quote as the key_excerpt. 4. Rank passages in descending order of salience (highest score = rank 1). 5. After ranking, assess whether all aspects of the query are covered by the ranked set. 6. Flag any query aspects that lack supporting passages. 7. If coverage is incomplete, recommend whether additional retrieval is needed. 8. Do not fabricate information not present in the passages.
To adapt this template for your use case, replace each placeholder with concrete values. For [QUERY], provide the exact question or search intent. For [PASSAGES], supply the document chunks as a structured list with unique IDs—this is critical for traceability in downstream systems. The [CONSTRAINTS] placeholder should be replaced with domain-specific ranking rules, such as prioritizing recent passages, penalizing redundant content, or enforcing minimum coverage thresholds. For [RISK_LEVEL], use 'low' for exploratory ranking, 'medium' for production RAG pipelines where ranking errors degrade answer quality, or 'high' for regulated domains where missing critical sections creates compliance risk. In high-risk scenarios, always add a human review step before the ranked output feeds into answer generation or decision support systems. Validate the output against your expected schema before passing it downstream, and log salience scores for observability into ranking quality over time.
Prompt Variables
Required inputs for the Passage Salience Ranking Prompt. Each variable must be validated before the prompt is assembled to prevent ranking failures, missing sections, and unbounded token consumption.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[QUERY] | The user question or information need driving the salience ranking | What are the safety requirements for lithium battery storage in data centers? | Must be non-empty string. Check for vague queries under 10 chars; flag for human review if query lacks specific entities or constraints. |
[DOCUMENT_TITLE] | Document-level metadata to ground the model in the source identity | Data Center Power Infrastructure Standards v3.2 | Required string. If null, use filename or 'Untitled Document'. Validate against source system metadata to prevent hallucinated titles. |
[PASSAGES] | Array of passage objects containing id, text, and optional section metadata | [{"id":"p4","text":"Lithium batteries must...","section":"3.2 Storage"}] | Must be valid JSON array with 2-100 objects. Each object requires non-empty 'id' and 'text' fields. Reject if any passage text exceeds 8000 tokens; split oversized passages before injection. |
[PASSAGE_COUNT] | Total number of passages in the input set for coverage verification | 47 | Must be positive integer matching the length of [PASSAGES] array. Mismatch triggers assembly error. Used to detect truncation during prompt construction. |
[MAX_RANKED_PASSAGES] | Upper bound on how many passages the model should return in the ranked output | 15 | Must be integer between 5 and 50. If [PASSAGE_COUNT] is less than this value, set to [PASSAGE_COUNT]. Prevents the model from fabricating passages when the input set is small. |
[OUTPUT_SCHEMA] | JSON schema defining the expected output structure for ranked passages | {"type":"object","properties":{"ranked_passages":{"type":"array"}}} | Must be valid JSON Schema. Validate parse before prompt assembly. Include required fields: passage_id, salience_score, key_excerpt, relevance_rationale. Reject schemas missing salience_score range constraints. |
[COVERAGE_CHECK] | Boolean flag enabling a secondary output that identifies document sections with zero representation in the ranked set | Must be boolean. When true, output schema must include a 'coverage_gaps' field listing section identifiers absent from ranked results. False allows omission of coverage analysis. | |
[SALIENCE_THRESHOLD] | Minimum salience score for a passage to be considered relevant enough to include | 0.35 | Must be float between 0.0 and 1.0. If null, default to 0.0. Used to filter ranked output and trigger 'insufficient evidence' flag when no passages exceed threshold. Validate against calibration dataset for domain-specific tuning. |
Implementation Harness Notes
How to wire the Passage Salience Ranking Prompt into a production document intelligence pipeline with validation, retries, and coverage checks.
Integrating the Passage Salience Ranking Prompt into an application requires more than a single API call. The prompt is designed to be a stateless scoring function within a larger document processing pipeline. The typical harness receives a long document, chunks it into sections or passages, and then calls the LLM with the prompt template for each chunk or in batches, depending on context window limits. The application layer is responsible for chunking strategy, deduplication, and assembling the final ranked list from individual LLM responses. Do not rely on the model to handle documents larger than its context window; pre-chunking is mandatory.
Validation and Output Contract: The prompt instructs the model to produce a JSON object with salience_score, key_excerpts, and rationale. The application harness must validate this schema strictly. Use a JSON schema validator to confirm the presence and types of all required fields. The salience_score must be a number between 0.0 and 1.0. If validation fails, implement a single retry by feeding the raw model output and the validation error back into a repair prompt (see the Output Repair and Validation Prompts pillar). After one retry, discard the chunk's score or flag it for human review rather than entering an infinite retry loop. Log all validation failures to monitor prompt drift over time.
Coverage Check and Assembly: A critical failure mode for long documents is missing a vital section entirely. After all chunks are scored, the harness should execute a coverage check. This can be a secondary LLM call that receives the original query, a list of all chunk titles or identifiers, and the top-N ranked chunks. The coverage check prompt asks: 'Are there any sections not in the top-N that are likely critical to answering the query?' If the coverage check flags a missed section, it should be inserted into the ranked list with an explanation. The final output of the harness is an ordered list of passages with scores, excerpts, and a coverage_verified boolean flag. For high-stakes document review, always route the final ranked list and coverage report to a human reviewer before using it to generate a downstream answer or summary.
Expected Output Contract
Define the exact JSON structure, field types, and validation rules for the salience ranking output. Use this contract to build a parser, validator, and retry logic in your application harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
ranked_passages | Array of objects | Array must contain at least 1 item. If no passages are relevant, return an empty array. Validate array length against input passage count. | |
ranked_passages[].passage_id | String | Must exactly match a [PASSAGE_ID] from the input. Parse check: no generated or hallucinated IDs allowed. | |
ranked_passages[].salience_score | Number (0.0 to 1.0) | Must be a float between 0.0 and 1.0 inclusive. Higher score indicates greater relevance. Schema check: reject non-numeric or out-of-range values. | |
ranked_passages[].key_excerpt | String | Must be a verbatim substring from the original passage text. Citation check: verify excerpt exists in the source passage. If no specific excerpt stands out, use the first sentence. | |
ranked_passages[].relevance_rationale | String | Must contain a concise explanation (1-2 sentences) linking the passage to the [QUERY]. Null not allowed. Length check: minimum 20 characters. | |
coverage_gaps | Array of strings | If present, each string must describe a topic or question aspect from [QUERY] not covered by any passage. Null allowed when coverage is complete. Approval required if gaps are critical. | |
low_confidence_flag | Boolean | Set to true if any top-ranked passage has a salience score below 0.5, or if coverage_gaps contains items. Used to trigger human review or fallback in the application harness. |
Common Failure Modes
Salience ranking over long documents introduces distinct failure modes beyond standard passage relevance. These cards cover what breaks first when ranking sections from lengthy source material and how to guard against it.
Position Bias Toward Opening Sections
What to watch: The model over-ranks passages from the document's introduction or early sections, even when later sections contain more specific, query-relevant detail. This is a known attention bias in long-context ranking. Guardrail: Shuffle passage order before ranking, strip section numbering, or run a two-pass approach where the first pass identifies candidate sections and the second pass re-ranks them in randomized order.
Length Bias Favoring Longer Passages
What to watch: Longer sections receive higher salience scores simply because they contain more tokens, not because they are more relevant. This inflates scores for verbose background sections while penalizing concise, high-signal excerpts. Guardrail: Normalize scores by passage length, set a maximum passage size before ranking, or use a pairwise comparison prompt that asks the model to choose between two passages of similar length.
Coverage Gaps from Overconfident Top-K Selection
What to watch: The model assigns high scores to the top few passages and near-zero scores to everything else, missing critical sections that contain complementary or contradictory information. This is especially dangerous in compliance, legal, or medical document review. Guardrail: Implement a coverage check that verifies all query aspects are addressed by the selected passages. If coverage is incomplete, force a second retrieval pass with explicit instructions to find missing information.
Query Term Overlap Masquerading as Relevance
What to watch: Passages that share many keywords with the query receive inflated salience scores even when they discuss a different topic or context. This is common in technical documents where the same terminology appears across unrelated sections. Guardrail: Require the model to output a one-sentence justification for each score that explains conceptual relevance, not just lexical overlap. Validate justifications against a rubric that penalizes keyword-matching rationales.
Temporal Staleness in Long Documents
What to watch: Older sections of a long document—such as deprecated procedures, outdated policies, or superseded findings—receive high salience scores because they match the query structure, but the information is no longer valid. This is critical in living documents like runbooks, policy manuals, or regulatory filings. Guardrail: Include document metadata timestamps in each passage and add a temporal relevance constraint to the prompt. Flag passages older than a configurable threshold for human review before using them in downstream generation.
Failure to Rank Supporting Evidence Over Claims
What to watch: The model ranks sections that make bold claims or conclusions higher than sections that contain the underlying evidence, data tables, or methodology. Downstream answer generation then cites conclusions without the supporting foundation. Guardrail: Add an evidence-density preference to the prompt that instructs the model to prioritize passages containing data, citations, methodology descriptions, or primary source references over summary or conclusion sections.
Evaluation Rubric
Use this rubric to test the Passage Salience Ranking prompt before shipping. Each criterion targets a known failure mode in long-document salience ranking, such as missing critical sections, over-ranking verbose but irrelevant chunks, or producing uncalibrated scores.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Critical Section Recall | All sections containing the answer to [QUERY] appear in the top-K ranked passages (K defined by [CONTEXT_WINDOW_SIZE]). | A known answer-bearing section is ranked below the cutoff threshold or omitted entirely. | Run against a golden dataset of 20+ long documents with labeled answer-bearing sections. Measure recall@K. Require recall@K >= 0.95. |
Salience Score Calibration | Score distribution separates clearly relevant passages (score > 0.7) from irrelevant ones (score < 0.3). No score clustering in a narrow band. | All passages receive scores between 0.4 and 0.6, providing no useful ranking signal. | Plot score histogram across 50+ queries. Check for bimodal distribution. Flag if > 80% of scores fall in [0.3, 0.7]. |
Excerpt Grounding | Every extracted key excerpt in [OUTPUT] is a verbatim substring of the source passage or a minimal, faithful paraphrase with a character-level span citation. | An excerpt contains a claim, date, or figure not present in the source passage. | Use substring matching and an LLM-as-judge faithfulness check. Flag any excerpt with < 90% token overlap against the source passage. |
Coverage Completeness | The ranked list covers all distinct topics required to fully answer [QUERY] without major information gaps. | The top-K passages all address the same subtopic, missing a second required dimension of the query. | For multi-aspect queries, manually label required subtopics. Verify each subtopic is represented in the top-K. Fail if any subtopic is absent. |
Ordering Stability | Re-running the prompt with the same [DOCUMENT] and [QUERY] but shuffled passage input order produces the same top-5 ranking. | The top-ranked passage changes when input order is randomized. | Run 5 trials with shuffled input order. Require identical top-5 set across all trials. Flag any rank permutation within top-5. |
Length Bias Resistance | Passage length does not correlate with salience score. Short, high-relevance passages outrank long, low-relevance ones. | The longest passages consistently receive the highest scores regardless of relevance. | Compute Pearson correlation between passage token count and salience score across 100+ passages. Require |r| < 0.3. Spot-check with adversarial long-irrelevant passages. |
Null Handling | When no passage is relevant to [QUERY], the prompt returns an empty ranked list or a single entry with score 0.0 and a null excerpt. | The prompt hallucinates a relevant excerpt or assigns a moderate score to an irrelevant passage. | Test with 10 queries known to have zero relevant passages in the document. Require empty list or score 0.0. Fail on any score > 0.1. |
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
Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and a small test set of 10-20 long documents. Remove strict output schema requirements initially; accept natural-language ranked lists. Focus on whether the model correctly identifies the most salient passages for 5 diverse queries.
Simplify the output format to:
code1. [Passage ID] - Salience: HIGH/MEDIUM/LOW Key Excerpt: "[sentence]" Reason: [one-line justification]
Watch for
- Position bias: passages at the start or end of long documents may be over-ranked.
- Missing coverage checks: the model may rank passages highly without confirming all query aspects are addressed.
- Overly broad instructions that produce inconsistent salience definitions across runs.

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