This prompt is for search engineers and RAG system designers who need to detect when a user query is asking for a condensed overview or synthesis of a topic, rather than a specific fact, comparison, or step-by-step procedure. The prompt rewrites the original query to favor broad-coverage passages that span multiple facets of the topic. Use this prompt as a pre-retrieval step in a RAG pipeline when your knowledge base contains long-form documents, reports, or articles and you need to ensure the retrieval step surfaces diverse, representative context instead of a single dense passage.
Prompt
Summarization Intent Query Rewrite Prompt Template

When to Use This Prompt
A pre-retrieval step for detecting summarization intent and rewriting queries to favor broad-coverage passages over narrow fact matches.
The ideal deployment point is immediately after query intake and before any vector or keyword search execution. The rewritten query should be passed to your retrieval backend, and the coverage breadth indicator can be used downstream to adjust retrieval parameters—for example, increasing the top_k value or enabling diversity reranking when the indicator signals a broad-coverage need. Do not use this prompt for factoid lookups, troubleshooting, or procedural how-to queries; those intents require different rewriting strategies that anchor on entities, error signatures, or sequential action language respectively. Misapplying this prompt to a factoid query will dilute retrieval precision and surface irrelevant overview passages when the user needed a single definitive answer.
Before integrating this prompt into production, build a small evaluation set of 20–30 queries with human-labeled intent (summarization vs. non-summarization) and verify that the prompt correctly classifies intent and produces rewrites that improve retrieval diversity metrics. Common failure modes include misclassifying comparison queries as summarization requests and producing rewrites that are too vague to retrieve useful content. If your knowledge base is primarily short-form or highly structured (e.g., API reference docs, database records), this prompt may add latency without improving retrieval quality—test on your actual corpus before committing to the pipeline.
Use Case Fit
Where the Summarization Intent Query Rewrite prompt works and where it does not.
Good Fit
Use when: the user asks for an overview, summary, gist, or high-level explanation of a broad topic. Guardrail: verify that the rewritten query expands scope rather than narrowing to a single fact.
Bad Fit
Avoid when: the user needs a specific fact, a single code snippet, or a precise date. Guardrail: route to the Factual Lookup or Code Example intent prompt instead of forcing a coverage-oriented rewrite.
Required Inputs
What to watch: missing or ambiguous user query. Guardrail: require a non-empty [USER_QUERY] before invoking the prompt. If the query is only a topic keyword, append an explicit summarization signal before rewriting.
Operational Risk
What to watch: the rewritten query retrieves documents that all cover the same narrow subtopic, producing a pseudo-summary. Guardrail: add a coverage breadth indicator to the output and test retrieval diversity across multiple facets.
Latency Sensitivity
What to watch: summarization rewrites that trigger broad retrieval across many partitions can increase latency. Guardrail: set a maximum partition fan-out and prefer hybrid retrieval with a dense vector index tuned for topical diversity.
Over-Summarization Risk
What to watch: the prompt rewrites every query as a summarization request, even when the user wants depth. Guardrail: pair with an intent classifier upstream and only apply this prompt when summarization intent confidence exceeds the threshold.
Copy-Ready Prompt Template
A ready-to-use prompt for detecting summarization intent and rewriting a user query to maximize broad-coverage retrieval.
This prompt template is designed to be placed in your system instructions or as a pre-retrieval rewriting step. Its job is to analyze a user's query, determine if they want a condensed overview or summary, and if so, rewrite the query to favor documents that provide broad, multi-faceted coverage rather than a single, dense fact. The output includes a rewritten query string and a coverage breadth indicator, which your application can use to adjust retrieval parameters like the number of documents fetched or the diversity threshold.
textYou are a query rewriting agent for a retrieval system. Your task is to analyze the user's query and determine if the underlying intent is summarization: the user wants a condensed, high-level overview of a topic, not a specific fact, a step-by-step procedure, or a comparison. If the intent is summarization, rewrite the query to optimize for broad-coverage retrieval. The rewritten query should: - Use general, encompassing terms instead of narrow, specific ones. - Target introductory, overview, or abstract-type content. - Be structured to retrieve documents that cover multiple facets of the topic. - Avoid terms that would bias retrieval toward a single, dense passage. If the intent is NOT summarization, return the original query unchanged and set the coverage indicator to 'none'. [INPUT] User Query: [USER_QUERY] [OUTPUT_SCHEMA] Return a valid JSON object with the following fields: { "intent_detected": "summarization" | "other", "rewritten_query": "string", "coverage_breadth": "broad" | "focused" | "none" } [CONSTRAINTS] - Do not add information not present in the original query. - Do not change the core subject of the query. - The rewritten query must be a single, self-contained string. - If intent is not summarization, rewritten_query must be the original [USER_QUERY].
To adapt this template, replace the [USER_QUERY] placeholder with your application's user input. The [OUTPUT_SCHEMA] is critical for your downstream parser; ensure your application code validates the JSON structure and handles the coverage_breadth field to dynamically set retrieval parameters. For high-stakes applications, log the intent_detected and rewritten_query for offline evaluation to monitor for intent drift. Next, you should pair this prompt with an evaluation harness that tests whether the rewritten queries actually retrieve a more diverse set of documents than the original query.
Prompt Variables
Required inputs for the Summarization Intent Query Rewrite Prompt Template. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[USER_QUERY] | The raw user question to analyze for summarization intent | Tell me about renewable energy trends | Non-empty string; max 2000 chars; must contain at least one verb; reject if only punctuation or whitespace |
[RETRIEVAL_CORPUS_DESCRIPTION] | Describes the document collection to guide query formulation toward broad-coverage passages | A corpus of 50,000 research papers, news articles, and policy briefs on energy topics from 2020-2025 | Non-empty string; should mention document types and topical scope; used to calibrate coverage breadth indicator |
[COVERAGE_BREADTH_THRESHOLD] | Numeric threshold for deciding whether the rewritten query should target broad or narrow retrieval | 0.7 | Float between 0.0 and 1.0; values above threshold trigger broad-coverage query expansion; default 0.6 if not specified |
[MAX_QUERY_LENGTH] | Character limit for the rewritten query to prevent overly long retrieval strings | 300 | Integer between 50 and 1000; rewritten query exceeding this limit should be truncated with core terms preserved |
[INTENT_TAXONOMY_VERSION] | Identifies which version of the intent classification schema to use for consistent labeling | v2.1 | String matching a known taxonomy version in your system; reject unknown versions; ensures downstream routing consistency |
[OUTPUT_FORMAT] | Specifies the structure of the expected output for parsing in the application harness | JSON with fields: rewritten_query, coverage_breadth_indicator, intent_confidence | Must be one of: JSON, JSON_LINES, or STRING; JSON requires schema validation; STRING requires post-hoc parsing |
[FALLBACK_BEHAVIOR] | Instruction for what to return when summarization intent confidence is below threshold | return_original_query_with_null_indicator | Must be one of: return_original_query, return_empty, return_clarification_request, or return_original_query_with_null_indicator; prevents silent failures |
Implementation Harness Notes
How to wire the Summarization Intent Query Rewrite prompt into a production RAG retrieval pipeline.
Integrating this prompt into an application requires treating it as a pre-retrieval transformation step, not a standalone chatbot. The prompt receives a raw user query and returns a rewritten query plus a coverage breadth indicator. The application harness must validate this output before passing it to the retrieval backend. A minimal harness accepts the user query, injects it into the [USER_QUERY] placeholder, calls the model, parses the JSON response, extracts the rewritten_query field, and forwards it to your vector or hybrid search index. The coverage_breadth field should be logged for observability but can also be used to dynamically adjust retrieval parameters—for example, increasing the top_k value when breadth is 'high' to ensure sufficient document diversity.
Validation is the first line of defense against production drift. The harness must confirm that the model returned valid JSON, that rewritten_query is a non-empty string, and that coverage_breadth is one of the expected enum values ('low', 'medium', 'high'). If validation fails, implement a retry with a stricter system instruction that emphasizes JSON-only output. For high-throughput systems, consider a lightweight regex or JSON Schema validator before the parsed output enters the retrieval path. Log every rewrite attempt—original query, rewritten query, breadth indicator, model used, and latency—so that query drift and intent misclassification can be diagnosed later. If the model consistently rewrites summarization queries as narrow factoid lookups, the eval harness should catch this and trigger a prompt revision.
Model choice matters for this task. The prompt requires intent detection and constrained generation, which most frontier models handle well, but smaller or older models may conflate summarization intent with factual lookup. Test across your candidate models using a golden dataset of summarization queries paired with expected breadth indicators. If using a model that does not reliably produce JSON, wrap the prompt output in a repair step or use structured output APIs (e.g., OpenAI's JSON mode, Claude's tool use with a defined schema). For latency-sensitive applications, consider routing only queries above a certain length or complexity threshold to this rewrite step, while passing short, unambiguous queries directly to retrieval. The coverage_breadth field can also feed into a downstream re-ranker that prioritizes diverse passages when breadth is high, closing the loop between intent detection and result quality.
Expected Output Contract
Defines the exact fields, types, and validation rules for the output generated by the Summarization Intent Query Rewrite prompt. Use this contract to build a parser, validator, or eval harness before integrating the prompt into a retrieval pipeline.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
rewritten_query | string | Must be a non-empty string. Should contain broad-coverage terms and avoid narrow entity anchors. Validate that the string differs from the original [USER_QUERY] by at least one token. | |
coverage_breadth_indicator | string (enum) | Must be one of: 'broad', 'moderate', 'narrow'. Validate against the allowed enum set. If 'narrow' is returned, flag for human review as it may indicate intent misclassification. | |
detected_intent | string | Must equal 'summarization'. Validate with an exact string match. Any other value indicates a routing failure upstream. | |
intent_confidence | number (float) | Must be a float between 0.0 and 1.0 inclusive. Validate range. If below 0.7, the output should be routed to a clarification or fallback workflow instead of direct retrieval. | |
removed_detail_entities | array of strings | If present, must be a valid JSON array of strings. Each string should represent a specific entity or detail that was intentionally de-emphasized to favor breadth. Validate that no item is an empty string. | |
target_document_types | array of strings | If present, must be a valid JSON array of strings. Suggested values include 'overview', 'summary', 'abstract', 'introduction'. Validate that each item is a non-empty string. Null or empty array is acceptable. | |
rationale | string | If present, must be a non-empty string explaining why the query was rewritten for summarization. Validate that the string is not just a repetition of the original query. Null is acceptable for latency-sensitive paths. |
Common Failure Modes
What breaks first when rewriting queries for summarization intent and how to prevent retrieval failures in production.
Over-Broadening Loses the Topic
What to watch: The rewrite expands for coverage breadth but strips the core subject, retrieving documents about the general domain rather than the specific topic. A query about 'summarize the Q3 product launch' becomes 'product launches' and returns irrelevant historical content. Guardrail: Validate that the rewritten query retains all key entities and constraints from the original. Use an entity preservation check before retrieval execution.
Coverage Breadth Indicator Miscalibration
What to watch: The coverage breadth indicator signals 'broad' when the user actually needs a focused summary of a narrow topic, or signals 'narrow' when the user expects a comprehensive overview. This misroutes retrieval to the wrong index partition or result count threshold. Guardrail: Implement a confidence threshold on the breadth indicator. If confidence is below 0.8, default to a balanced retrieval strategy that fetches both broad and narrow candidate sets and merges results.
Summarization Intent Confused with Factual Lookup
What to watch: The intent classifier mistakes a summarization request for a factual lookup, rewriting the query to target a single dense passage instead of multiple facet-spanning documents. 'Summarize the security incident response process' becomes 'security incident response process definition' and retrieves only the glossary entry. Guardrail: Add a secondary intent verification step that checks for summarization signal words (summarize, overview, recap, digest) and overrides the rewrite strategy when detected, regardless of the primary classifier output.
Facet Collapse in Retrieved Documents
What to watch: The rewritten query retrieves multiple documents, but they all cover the same facet or perspective, producing a summary that appears comprehensive but is actually one-dimensional. A query about a product launch retrieves only marketing documents and misses engineering, sales, and customer support perspectives. Guardrail: Post-retrieval, cluster documents by source type or section and verify that at least N distinct facets are represented. If facet diversity is below threshold, issue a secondary retrieval query explicitly targeting missing facets.
Temporal Scope Drift
What to watch: The user asks for a summary of recent or time-bounded information, but the rewrite drops temporal constraints in favor of breadth, retrieving outdated documents. 'Summarize this quarter's performance' becomes 'performance summary' and pulls in years of irrelevant data. Guardrail: Extract and preserve all temporal expressions from the original query. If the rewrite removes a date range or relative time expression, flag for review or automatically reinsert the constraint into the retrieval filter.
Empty Result Set from Over-Constrained Rewrite
What to watch: The rewrite adds coverage breadth requirements that are too strict for the available corpus, producing a query that returns zero results because no document set satisfies all facet constraints simultaneously. Guardrail: Implement a fallback chain: if the broad-coverage query returns fewer than K results, progressively relax facet requirements and retry retrieval. Log each relaxation step for observability into corpus gaps.
Evaluation Rubric
Use this rubric to test the quality of the summarization intent query rewrite before integrating it into a production retrieval pipeline. Each criterion targets a specific failure mode common to coverage-oriented rewrites.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Intent Classification Accuracy | Intent label is 'summarization' when the user asks for an overview, gist, or condensed explanation of a broad topic. | Intent is misclassified as 'factual_lookup' or 'comparison' when the user wants a summary. | Run against a golden set of 50 summarization-intent queries and 50 non-summarization queries. Require precision >= 0.95 and recall >= 0.90. |
Coverage Breadth Indicator Validity | The [COVERAGE_BREADTH] field is 'broad' for multi-facet topics and 'focused' for single-subject overviews. | [COVERAGE_BREADTH] is 'focused' when the original query requires synthesis across multiple themes, or 'broad' when the topic is narrow. | Manually label 30 queries with expected breadth. Require exact match accuracy >= 0.85 against human labels. |
Query Term Expansion for Recall | The rewritten query contains 3+ distinct topical facets or synonym clusters from the original query to improve broad recall. | The rewritten query is a verbatim copy of the input or adds only one generic term, failing to expand coverage. | Compute the Jaccard distance between the set of key terms in the original and rewritten query. Require a distance >= 0.3 for broad-coverage rewrites. |
Absence of Specificity Drift | The rewritten query avoids adding narrow constraints, specific entities, or precise date filters not present in the original request. | The rewritten query injects a specific year, person, or narrow technical term that would exclude relevant general passages. | Use an LLM-as-judge to compare the original and rewritten query. Flag any added named entities or date ranges. Require zero unsupported specificity injections. |
Retrieval Result Diversity | Top-10 retrieved documents span at least 3 distinct subtopics or document sections relevant to the summary request. | All top-10 documents come from a single section or repeat the same narrow angle, indicating a failure to broaden retrieval. | Embed top-10 retrieved passages, cluster with cosine similarity, and count clusters at threshold 0.7. Require >= 3 clusters for broad queries. |
Factual Preservation Check | All verifiable facts in the original query are preserved in the rewritten query without alteration. | The rewritten query changes a date, name, or constraint from the original, altering the factual scope of retrieval. | Extract entities and numeric values from both queries. Require exact set match. Flag any additions or deletions for human review. |
Output Schema Compliance | The output is valid JSON containing exactly the fields [ORIGINAL_QUERY], [REWRITTEN_QUERY], [INTENT], and [COVERAGE_BREADTH]. | Output is missing a required field, contains extra fields, or is not parseable as JSON. | Validate with a JSON schema check in the harness. Reject any response that fails structural validation and trigger a retry. |
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 and minimal post-processing. Focus on getting the rewritten_query and coverage_breadth fields to populate consistently. Skip strict schema validation initially—just eyeball whether the rewritten query is broader than the original and whether the breadth indicator makes sense.
Add a lightweight harness that logs the original query, the rewritten query, and the coverage breadth flag so you can spot-check 20–30 examples before hardening.
Watch for
- The model producing a rewritten query that is narrower than the original (defeats the purpose)
coverage_breadthvalues that don't match the actual query expansion behavior- Over-summarization in the rewrite that drops key entities or constraints from the user's question

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