Unlike generic summarization, which distills a document's main points, query-focused summarization uses the user's query as a relevance signal to bias content selection. The resulting summary synthesizes only the passages that are semantically relevant to the posed question, effectively performing a form of cross-document alignment and multi-document fusion when applied across a corpus. This technique relies on salience scoring mechanisms, such as Maximum Marginal Relevance (MMR), to balance query relevance against information redundancy.
Glossary
Query-Focused Summarization

What is Query-Focused Summarization?
Query-focused summarization is the task of generating a concise summary that directly answers a specific natural language question or addresses a defined information need, rather than providing a generic overview of a document's content.
In legal AI, this capability is critical for extracting ratio decidendi from case law or isolating specific clause-level summaries from contracts. The process often integrates Retrieval-Augmented Generation (RAG) to first retrieve relevant text chunks, then applies an abstractive model to synthesize an answer. Ensuring factual consistency is paramount, often requiring source attribution and Natural Language Inference (NLI) to verify that the generated summary is strictly entailed by the source material and contains no hallucinated content.
Key Features of Query-Focused Summarization
Query-focused summarization diverges from generic summarization by conditioning the output on a specific information need. The following features define how these systems achieve targeted, relevant condensation.
Query-Conditioned Salience
Unlike generic summarization which relies on global document statistics, query-focused systems dynamically recalculate salience scores based on semantic similarity to the user's query. A passage about 'venue' might be low-salience in a generic contract summary but becomes the highest-priority text when the query is 'Where must disputes be arbitrated?' This is typically implemented via cross-attention mechanisms between the query embedding and the source document tokens, or by using Maximum Marginal Relevance (MMR) to balance query relevance against redundancy.
Maximum Marginal Relevance (MMR)
A foundational algorithm for query-focused extractive summarization that greedily selects passages by optimizing a linear combination of two factors:
- Relevance: Cosine similarity between the candidate passage and the user's query
- Novelty: Penalty for similarity to already-selected passages (1 - max similarity to summary)
The λ parameter (typically 0.5-0.7) controls the trade-off. High λ favors relevance; low λ favors diversity. This prevents the summary from repeating the same information and ensures broad coverage of the query's aspects.
Cross-Document Synthesis
In multi-document settings, query-focused summarization must perform cross-document alignment to identify passages discussing the same entity or event across distinct sources. The system must then fuse this information, resolving contradictions and eliminating redundancy. For legal applications, this means synthesizing a coherent answer from multiple cases, statutes, and secondary sources—each with different precedential weight. Source attribution becomes critical here, linking each claim back to its origin document with precise citation.
Faithfulness Verification via NLI
A query-focused summary must remain factually consistent with source documents regardless of how the query reframes the topic. Modern systems employ Natural Language Inference (NLI) models as a post-hoc verification step: each atomic fact in the summary is treated as a hypothesis, and the source text serves as the premise. The NLI model classifies each fact as entailed, contradicted, or neutral. A high contradiction rate triggers regeneration. This is especially critical in legal contexts where a single hallucinated holding could misrepresent binding precedent.
Chain-of-Density Prompting
An iterative prompting technique that produces increasingly information-dense summaries without increasing length. The process:
- Step 1: Generate an initial entity-sparse summary
- Step 2: Identify 1-3 missing salient entities not yet covered
- Step 3: Rewrite the summary to incorporate those entities while maintaining the same word count
- Repeat for 5 iterations This yields summaries with high entity density—critical for legal queries where missing a specific party, date, or clause reference renders the summary useless for downstream tasks.
Atomic Fact Decomposition
A granular evaluation method where the generated summary is decomposed into minimal, self-contained factual claims—each a single subject-predicate-object triple. Each atomic fact is independently verified against the source document. For example, 'The court ruled that the patent was invalid due to prior art' decomposes into: (1) The court issued a ruling, (2) The ruling concerned a patent, (3) The patent was found invalid, (4) The grounds were prior art. This fine-grained verification catches partial hallucinations that sentence-level evaluation misses.
Frequently Asked Questions
Query-focused summarization is a specialized information retrieval task that generates a concise answer tailored to a user's specific natural language question, rather than providing a generic document overview. The following questions address the core mechanisms, evaluation methods, and architectural considerations for deploying this technology in high-stakes legal environments.
Query-focused summarization is the task of generating a summary that directly answers a specific natural language question or addresses a defined information need, rather than providing a general overview of a document's content. Unlike generic summarization, which identifies globally salient sentences, query-focused systems use the user's question as a relevance signal to bias content selection and generation. This is achieved through attention mechanisms that weight source tokens based on their semantic similarity to the query, often using Maximum Marginal Relevance (MMR) to balance query relevance against redundancy. In legal contexts, this allows a system to extract only the passages discussing a specific breach of contract rather than summarizing the entire 100-page agreement.
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.
Related Terms
Query-focused summarization relies on a constellation of supporting techniques to ensure relevance, factual consistency, and efficient processing of long legal documents.
Maximum Marginal Relevance (MMR)
A foundational algorithm for query-focused summarization that selects passages by balancing two competing objectives: relevance to the user's query and novelty relative to already-selected content. The algorithm uses a tunable lambda parameter to control the trade-off.
- Relevance: Measured via cosine similarity between a candidate passage and the query
- Redundancy Penalty: Subtracts the maximum similarity between the candidate and any already-selected passage
- Greedy Selection: Iteratively builds the summary by picking the highest-scoring remaining passage
This prevents the common failure mode where a summary repeatedly restates the same fact while omitting other critical information.
Salience Scoring
The process of assigning a numerical weight to sentences, clauses, or passages based on their importance to the specific query rather than to the document as a whole. Unlike generic summarization, query-focused salience is context-dependent.
- TF-IDF Overlap: Measures lexical similarity between query terms and candidate text
- Semantic Embedding Similarity: Uses dense vector representations to capture conceptual relevance beyond exact keyword match
- Positional Bias: Legal documents often place key holdings in specific structural locations
- Entity-Centric Scoring: Boosts sentences mentioning parties, statutes, or legal concepts named in the query
Effective salience scoring is the primary differentiator between a generic summary and one that answers a specific legal question.
Factual Consistency Verification
A critical post-generation step that validates whether every claim in a query-focused summary is entailed by the source document. This is especially vital in legal contexts where fabricated case citations or misstated holdings carry severe professional consequences.
- Natural Language Inference (NLI): Treats each summary sentence as a hypothesis and checks if the source text entails it
- Atomic Fact Decomposition: Breaks summary sentences into minimal claims for granular verification
- Source Attribution: Links each factual assertion back to its precise span in the original document
- Hallucination Rate: Quantifies the percentage of generated tokens that lack grounding in the source
Without this layer, query-focused systems risk producing highly relevant but legally false answers.
Cross-Document Alignment
The task of identifying and linking semantically related passages across multiple legal documents that address the same query. This is essential when synthesizing an answer from a corpus of cases, statutes, and secondary sources.
- Entity Linking: Resolves mentions of the same legal entity, statute, or doctrine across documents
- Coreference Resolution: Identifies all expressions referring to the same real-world party or concept
- Temporal Alignment: Orders events across documents into a coherent chronological sequence
- Conflict Detection: Flags contradictory holdings or factual assertions between sources
Cross-document alignment transforms a collection of individual summaries into a coherent, multi-source synthesis that captures the full legal landscape relevant to the query.
Chain-of-Density Prompting
An iterative prompting technique that generates increasingly information-dense summaries without increasing length. Starting from an initial sparse summary, each iteration identifies missing salient entities and fuses them into the text.
- Entity Identification: Locates key legal entities, doctrines, and facts not yet included
- Fusion Editing: Rewrites the summary to incorporate new entities while maintaining concision
- Density Constraint: Enforces a fixed token budget across iterations
- Legal Adaptation: Prioritizes inclusion of case names, statutory citations, and procedural postures
This technique is particularly effective for query-focused legal summarization where users need maximum informational yield from a constrained reading time.
Hierarchical Summarization
A strategy for handling legal documents that exceed a model's context window by recursively summarizing chunks and then synthesizing those intermediate summaries. This enables query-focused summarization of entire multi-hundred-page contracts or appellate records.
- Chunk-Level Summarization: Each section is summarized independently with respect to the query
- Intermediate Fusion: Chunk summaries are merged into a coherent intermediate representation
- Final Synthesis: The merged intermediate summary is refined into the final query-focused output
- Context Retention: Critical cross-chunk dependencies are preserved through overlapping windows
This approach is essential for legal AI systems operating on full case files rather than isolated excerpts.

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