This prompt is for retrieval-augmented generation (RAG) teams who are drowning in verbose, low-signal chunks. The core job-to-be-done is maximizing answer-relevant information per token before synthesis. You have a set of retrieved passages—often overlapping, padded with boilerplate, or heavy on rhetorical fluff—and you need to select the subset that carries the highest density of verifiable, query-relevant facts. The ideal user is an AI engineer or search engineer building a QA system over technical documentation, compliance manuals, or scientific literature where every token of context counts against a hard context-window budget. You already have a retrieval step that returns candidate passages; this prompt sits between retrieval and answer generation, acting as a fact-density filter.
Prompt
Fact-Dense Passage Prioritization Prompt

When to Use This Prompt
Define the job, reader, and constraints for the Fact-Dense Passage Prioritization Prompt.
Do not use this prompt when your primary concern is source credibility, temporal freshness, or multi-perspective balance. It is not a relevance scorer—it assumes passages are already topically relevant. It is not a deduplication tool, though it naturally penalizes redundant content. It is not appropriate for conversational RAG where turn history should influence selection, nor for comparative questions where balanced representation matters more than raw fact density. If your documents are primarily narrative, opinion, or marketing prose, fact density becomes a noisy signal; this prompt works best when passages contain discrete, extractable claims, measurements, parameters, or technical specifications. For legal or financial systems, pair this with a source-credibility prompt and a conflict-resolution step; fact density alone does not protect against authoritative-sounding falsehoods from a single low-quality source.
Before deploying, define what 'fact density' means for your domain. In API documentation, it might be parameter-count per sentence. In clinical text, it might be discrete findings per passage. In engineering specs, it might be measurable constraints per chunk. Write five examples of high-density and low-density passages from your own corpus and use them as few-shot demonstrations. The prompt's output should feed directly into a token-budgeted selection step: take the top-K passages until you hit your context limit, then route the selected set to your synthesis prompt. Always log the excluded passages and their density scores for debugging retrieval quality and prompt drift over time.
Use Case Fit
Where the Fact-Dense Passage Prioritization Prompt delivers value and where it introduces risk. Use these cards to decide if this prompt matches your retrieval pipeline and operational constraints.
Strong Fit: Technical Documentation QA
Use when: your knowledge base contains dense technical manuals, API references, or specification documents where verbosity is the enemy. Why: the prompt rewards passages that pack maximum factual content per token, directly improving answer precision in engineering and scientific domains.
Poor Fit: Narrative or Conversational Content
Avoid when: your corpus includes long-form prose, customer stories, or conversational transcripts where context and narrative flow carry meaning. Risk: the prompt penalizes necessary exposition and transitional context, stripping away qualifiers that prevent misinterpretation.
Required Input: Pre-Retrieved Candidate Set
Guardrail: this prompt assumes you have already retrieved a candidate passage set from vector search, keyword search, or hybrid retrieval. It does not perform retrieval itself. Check: ensure your upstream retrieval recall is adequate before applying fact-density ranking, or you will optimize the ranking of irrelevant passages.
Operational Risk: Fact Density vs. Fact Correctness
What to watch: the prompt prioritizes density of factual claims, not their accuracy. A passage can be dense with incorrect facts and still rank highly. Guardrail: always pair this prompt with a downstream grounding or fact-verification step before answer synthesis. Never treat density as a proxy for truth.
Token Budget Sensitivity
What to watch: fact-dense passages may still be long. If your downstream synthesis model has a tight context window, high-density ranking can accidentally select passages that individually consume too many tokens. Guardrail: combine this prompt with a Top-K selection step that enforces a hard token budget after ranking, not before.
Domain Calibration Requirement
What to watch: what counts as 'fact-dense' varies by domain. A legal contract and a Python library doc have different density signatures. Guardrail: calibrate your density criteria with domain-expert annotated examples before deploying. Run eval on golden datasets to confirm the prompt's density scoring aligns with human judgments of usefulness.
Copy-Ready Prompt Template
A reusable prompt template for ranking passages by factual density, ready to copy, adapt, and integrate into a RAG pipeline.
The following prompt template is designed to be dropped into a retrieval-augmented generation (RAG) pipeline after initial retrieval but before answer synthesis. Its job is to re-rank a set of candidate passages so that those with the highest concentration of unique, verifiable facts per token appear first. This maximizes the answer-relevant information available within a constrained context window. The template uses square-bracket placeholders for all dynamic inputs, making it straightforward to parameterize in code. Before using this prompt in production, you must define the expected output schema, validation rules, and evaluation criteria described in the sections that follow.
textYou are a fact-density analyst. Your task is to re-rank a set of retrieved passages so that passages with the highest concentration of unique, verifiable facts appear first. Prioritize passages that introduce new information not already covered by higher-ranked passages. Penalize verbose, redundant, or filler-heavy content. ## INPUT Query: [USER_QUERY] Passages to rank: [PASSAGE_LIST] ## DEFINITIONS - **Fact**: A specific, verifiable claim that can be checked against the passage text. Examples include numeric values, dates, named entities, causal relationships, and technical specifications. - **Fact Density**: The number of unique facts divided by the token count of the passage. Higher is better. - **Information Gain**: The number of facts in a passage that are not already present in passages ranked above it. ## CONSTRAINTS [CONSTRAINTS] ## OUTPUT FORMAT Return a JSON object with the following structure: [OUTPUT_SCHEMA] ## EXAMPLES [EXAMPLES] ## INSTRUCTIONS 1. For each passage, count the distinct, verifiable facts it contains. 2. Compute a fact-density score: facts / token_count. 3. Sort passages by fact density in descending order. 4. When passages have similar density scores, break ties by prioritizing passages with higher information gain relative to already-ranked passages. 5. Exclude any passage that contains zero verifiable facts or is entirely redundant with higher-ranked passages. Mark excluded passages with an exclusion reason. 6. Return the ranked list with scores, justifications, and exclusion reasons in the specified output format.
To adapt this template for your system, replace each square-bracket placeholder with concrete values at runtime. [USER_QUERY] should be the original user question, used as a relevance anchor. [PASSAGE_LIST] should be a formatted list of retrieved passages, each with a unique identifier and its full text. [CONSTRAINTS] can include token budgets, minimum density thresholds, or domain-specific fact definitions. [OUTPUT_SCHEMA] must be a strict JSON schema your application can validate. [EXAMPLES] should include at least two few-shot demonstrations showing a passage list, the expected ranking, and the reasoning. If your domain involves regulated content, add a constraint requiring that all ranked facts be directly attributable to the source passage text, and log the full ranking trace for audit. Do not deploy this prompt without first running the evaluation harness described in the testing section of this playbook.
Prompt Variables
Required and optional inputs for the Fact-Dense Passage Prioritization Prompt. Each variable must be populated before the prompt is assembled and sent to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[QUERY] | The user question or information need that drives passage selection | What are the failure modes of lithium-ion batteries in cold weather? | Non-empty string check. Must contain at least one interrogative or information-seeking phrase. Reject if only stopwords or under 10 characters. |
[PASSAGES] | Array of retrieved candidate passages to rank by factual density | [{"id": "doc_12_chunk_4", "text": "Lithium-ion batteries experience reduced ionic conductivity below 0°C due to..."}, ...] | Must be a valid JSON array with 2-50 objects. Each object requires 'id' (string) and 'text' (string, min 50 chars). Reject if array is empty or any text field is null. |
[PASSAGE_COUNT] | Target number of top passages to return after prioritization | 5 | Integer between 1 and 20. Must not exceed the length of [PASSAGES]. Default to 5 if unset. Reject if negative or zero. |
[MAX_TOKENS_PER_PASSAGE] | Token budget ceiling for any single passage included in the output | 512 | Integer between 128 and 4096. Used to exclude passages that would dominate the context window. Reject if below 64 or above 8192. |
[DOMAIN] | Optional domain label to calibrate what counts as a fact for density scoring | battery_engineering | String matching a known domain taxonomy entry or null. If provided, must be one of the pre-registered domain slugs. Null allowed; model will use general factual density heuristics. |
[OUTPUT_SCHEMA] | JSON schema the model must conform to in its response | {"type": "object", "properties": {"ranked_passages": [...]}, "required": ["ranked_passages"]} | Must be a valid JSON Schema object. Validate with a schema parser before injection. Reject if schema is malformed or missing required 'ranked_passages' field. |
[EXCLUSION_CRITERIA] | Rules for passages that should be dropped before ranking | Exclude passages that are purely navigational boilerplate, copyright notices, or contain only table-of-contents entries. | String or null. If provided, must be a declarative sentence or bullet list under 500 chars. Null allowed; model will apply default noise-filtering heuristics. |
Common Failure Modes
Fact-dense passage prioritization fails in predictable ways. Here are the most common failure modes and how to guard against them before they reach production.
Confusing Keyword Density with Fact Density
What to watch: The model ranks passages higher because they repeat query terms frequently, not because they contain more verifiable facts. A passage mentioning 'API latency' ten times may score above one with five distinct latency causes and their thresholds. Guardrail: Include explicit definitions and contrastive examples in the prompt that distinguish term frequency from factual richness. Add an eval check that compares fact count per passage against the model's ranking score.
Penalizing Necessary Context as Verbose
What to watch: The prompt over-penalizes longer passages, dropping context-rich paragraphs that explain prerequisites, constraints, or edge cases essential for correct answer synthesis. A passage defining a protocol version before listing its error codes gets discarded as 'verbose.' Guardrail: Add a 'contextual necessity' dimension to the ranking criteria. Require the model to distinguish between redundant exposition and prerequisite framing. Test with passages where removing context breaks downstream answer correctness.
Collapsing Near-Duplicate Fact Sets
What to watch: Multiple passages contain overlapping but non-identical facts. The model selects only one and discards the rest, losing complementary details like version-specific behavior, platform differences, or edge-case qualifiers. Guardrail: Add a deduplication step that measures information gain, not just similarity. Require the model to explain what each selected passage adds that prior selections lack. Test with document sets where critical details are spread across similar-looking chunks.
Overfitting to a Single Document Structure
What to watch: The model learns to prefer passages that match the structure of the first few highly-ranked documents—tables, bulleted lists, API reference format—and undervalues fact-dense prose, troubleshooting guides, or changelogs that use different formatting. Guardrail: Include diverse document structures in few-shot examples. Add a 'format-agnostic' instruction that explicitly directs the model to evaluate factual content independent of presentation style. Test with mixed-format retrieval sets.
Ignoring Temporal Relevance in Fact Density Scoring
What to watch: A passage dense with facts about a deprecated API version scores higher than a sparse but current passage describing the replacement. The model treats all facts as equally valuable regardless of recency or version applicability. Guardrail: Add a temporal-weighting dimension that considers document dates, version markers, and deprecation notices. Require the model to flag when high-density passages contain superseded information. Test with versioned documentation sets where newer sparse passages should outrank older dense ones.
Silently Dropping Low-Confidence but Critical Passages
What to watch: The model assigns low fact-density scores to passages containing safety warnings, prerequisites, or known limitations because they don't match the 'information-rich' pattern it learned. These passages get excluded, and the downstream answer omits critical constraints. Guardrail: Add a 'safety and constraint preservation' rule that prevents exclusion of passages containing warning language, preconditions, or limitation statements regardless of density score. Implement a post-selection check that scans excluded passages for risk-signaling terms.
Evaluation Rubric
Use this rubric to test the Fact-Dense Passage Prioritization Prompt before shipping. Each criterion targets a specific failure mode, from rewarding keyword spam to missing dense technical content. Run these checks on a golden dataset of passage-query pairs with known fact-density labels.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Fact Density vs. Keyword Frequency | Passages ranked higher for fact density than for keyword repetition. A passage with 5 unique facts ranks above a passage repeating 1 fact 5 times. | Top-ranked passage has high keyword overlap but low unique fact count. Ranking correlates with TF-IDF score rather than fact count. | Compare ranking output against a hand-labeled set where fact count and keyword frequency are intentionally decoupled. |
Verbosity Penalty | A concise passage with 3 facts ranks above a verbose passage with 3 facts and 200 extra filler words. | Longer passages systematically outrank shorter ones with equivalent factual content. Ranking correlates with word count. | Pair passages with identical fact counts but different lengths. Verify the shorter passage ranks higher. |
Redundancy Filtering | When two passages contain the same facts, only the most concise or authoritative one appears in the top K. | Top K contains near-duplicate passages with overlapping fact sets. Information gain plateaus after first few results. | Cluster passages by Jaccard similarity of fact sets. Verify that top K contains at most one passage per cluster. |
Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA]. Every ranked passage includes a fact_density_score and justification. | Output is missing required fields, contains unparseable JSON, or uses wrong types for scores. | Validate output against the JSON schema. Run schema check on 100 varied inputs and require 100% parse success. |
Score Calibration | fact_density_score correlates with human-labeled fact counts (Spearman ρ > 0.8). Score differences reflect real density differences. | Scores are compressed in a narrow range (e.g., all 0.7-0.9) or show no monotonic relationship with actual fact count. | Compute Spearman rank correlation between model-assigned scores and human fact-count labels on a 50-item test set. |
Domain Terminology Handling | Domain-specific terms are recognized as distinct facts, not treated as synonyms. 'Tensile strength' and 'yield strength' count as separate facts. | Technical passages with dense domain terminology score lower than general-audience passages with simpler vocabulary. | Curate a test set of paired passages from technical documentation. Verify that domain-dense passages score higher than simplified equivalents with fewer facts. |
Empty or Near-Empty Passage Handling | Passages with zero extractable facts receive the lowest scores and are ranked last. Justification explicitly notes absence of factual content. | Empty passages receive mid-range scores or are omitted without explanation. Ranking includes noise passages above fact-bearing ones. | Include empty strings, whitespace-only, and boilerplate passages in the test set. Verify they occupy the bottom ranks with score ≤ 0.1. |
Implementation Harness Notes
How to wire the Fact-Dense Passage Prioritization Prompt into a production RAG pipeline with validation, retries, and observability.
This prompt is designed to sit between retrieval and answer synthesis in a RAG pipeline. It accepts a set of retrieved passages and a user query, then re-ranks them by factual density—maximizing unique, verifiable claims per token while deprioritizing verbose or redundant content. The output is an ordered list of passage IDs with density scores and justifications. You should call this prompt after initial retrieval and before context window packing, using its output to select the top-K passages that fit your token budget.
Integration pattern: Wrap the prompt in a function that accepts query, passages (list of objects with id, text, and optional source_metadata), and top_k. The function should construct the prompt with these inputs, call your model, and parse the JSON output. Validation is critical: validate that every returned passage_id exists in the input set, that density scores are numeric and within expected ranges, and that justifications are non-empty strings. If validation fails, retry once with the validation errors appended to the prompt as additional context. After two failures, fall back to a simpler relevance-only ranking prompt or log the failure for manual review. Model choice: Use a model with strong instruction-following and JSON output capabilities (e.g., GPT-4o, Claude 3.5 Sonnet). Avoid smaller models that may conflate keyword frequency with factual density.
Observability and evals: Log every invocation with the input passage count, output ranking, density scores, and validation status. Run periodic eval checks comparing the prompt's density rankings against human judgments on a golden dataset of passage sets where factual density has been manually annotated. Watch for failure modes: the prompt may over-prioritize list-heavy passages, penalize necessary context-setting sentences, or miss implicit facts that require inference. If you observe these patterns, add counterexamples to the prompt's few-shot examples or adjust the density definition in the constraints. When not to use this prompt: Skip it when retrieval already returns fewer passages than your context window can hold, when latency budgets are extremely tight, or when the downstream task requires narrative coherence over information density. In those cases, a simpler relevance ranking or direct context packing is more appropriate.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a small set of 5-10 passages. Remove the strict JSON output contract and ask for a ranked list with brief justifications. Use a frontier model with default temperature (0.3-0.5) to observe ranking behavior before locking down the schema.
codeRank these passages by factual density. For each passage, give a score (1-10) and one sentence explaining why. Passages: [PASSAGE_LIST]
Watch for
- Confusing keyword frequency with factual density—passages heavy on boilerplate may score higher than they should
- Inconsistent scoring scales across runs
- No handling of ties or near-duplicates

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