Query expansion is an information retrieval technique that reformulates a seed query by adding semantically related terms, synonyms, or morphological variants to bridge the vocabulary gap between user intent and document indexing. In legal search, this process often leverages domain-specific resources like the West Key Number System or generated text from a language model to capture conceptually relevant documents that lack exact keyword overlap.
Glossary
Query Expansion

What is Query Expansion?
Query expansion is a technique that augments a user's original search query with related terms or synonyms to improve recall, often using legal thesauri or generated text to capture broader relevant documents.
The mechanism typically operates through automatic local analysis—deriving expansion terms from top-ranked documents in an initial retrieval pass—or global analysis using pre-built legal thesauri and ontologies. When integrated with dense retrieval and hybrid search pipelines, query expansion mitigates the brittleness of sparse lexical matching, ensuring that a search for "slip and fall" also retrieves documents referencing "premises liability" or "trip hazard."
Key Techniques for Legal Query Expansion
Query expansion augments a user's original search with related terms to bridge the vocabulary gap between lay queries and precise legal terminology, dramatically improving recall in dense document collections.
Synonym Expansion via Legal Thesauri
Leverages curated legal dictionaries and thesauri to map user terms to canonical legal concepts.
- Mechanism: A lookup table maps 'car accident' to 'motor vehicle collision' and 'automobile tort'
- Source: Resources like the Legal Thesaurus or Westlaw's Key Number System
- Strength: High precision; terms are vetted legal synonyms
- Limitation: Static lists cannot capture novel or slang terms
- Example: Expanding 'slip and fall' to 'premises liability' and 'tortious negligence'
Generated Query Expansion with LLMs
Uses a language model to generate hypothetical legal questions or keywords that a relevant document would answer.
- Mechanism: Prompt an LLM to produce n variations of the query in formal legal language
- Technique: Often paired with HyDE (Hypothetical Document Embeddings) to generate a synthetic answer, then embed that answer for retrieval
- Strength: Captures conceptual relationships beyond simple synonyms
- Risk: Can introduce hallucinated legal concepts if not grounded
- Example: User query 'boss didn't pay overtime' generates 'Fair Labor Standards Act overtime violation claim'
Relevance Feedback & Pseudo-Relevance Feedback
Iteratively refines the query by extracting key terms from initially retrieved documents assumed to be relevant.
- Pseudo-Relevance Feedback (PRF): Automatically treats the top-k results from an initial search as relevant
- Process: Extract distinctive terms (using TF-IDF or BM25 weights) from those top documents and append them to the original query
- Strength: Adapts the query to the specific corpus vocabulary
- Risk: Query drift if the initial top results are not actually relevant
- Example: A search for 'patent infringement' might expand to include 'doctrine of equivalents' and 'claims construction' after PRF
Embedding-Based Query Expansion
Expands the query vector by traversing the embedding space to find semantically proximate legal concepts.
- Mechanism: Encode the query, then find the nearest-neighbor terms in a legal-specific embedding space
- Implementation: Use a Legal-BERT or BGE model fine-tuned on legal corpora to ensure domain alignment
- Strength: Captures deep semantic relationships (e.g., 'indemnification' is close to 'hold harmless')
- Nuance: Requires a high-quality legal embedding model to avoid spurious correlations
- Example: A query vector for 'board fiduciary duty' pulls in 'duty of care', 'duty of loyalty', and 'business judgment rule'
Knowledge Graph Traversal
Expands queries by traversing relationships in a structured legal knowledge graph to include connected entities and doctrines.
- Mechanism: Identify the entity in the query, then traverse 1-hop or 2-hop relationships in the graph
- Graph Schema: Nodes are statutes, cases, doctrines; edges are 'cites', 'interprets', 'overturns'
- Strength: Adds high-precision, logically connected legal concepts
- Example: Querying 'Miranda rights' traverses to 'Fifth Amendment', 'custodial interrogation', and 'Miranda v. Arizona'
Contextual Query Expansion with Document Metadata
Augments the query using structured metadata filters like jurisdiction, date range, or court level to constrain and focus the expansion.
- Mechanism: Pre-filter the corpus before expansion or append metadata tokens to the query string
- Application: A query for 'non-compete clauses' is expanded differently if the jurisdiction filter is 'California' vs. 'Texas'
- Strength: Prevents expansion into irrelevant legal domains
- Implementation: Combine with hybrid search to apply metadata filters to both sparse and dense retrieval paths
- Example: Adding '9th Circuit' and '2020-2024' to a query for 'privacy rights'
Frequently Asked Questions
Answers to common questions about augmenting legal search queries with related terms and concepts to improve retrieval recall and precision.
Query expansion is an information retrieval technique that augments a user's original search query with additional, semantically related terms to improve recall. The process works by analyzing the initial query and appending synonyms, hypernyms, hyponyms, or conceptually linked phrases that appear in a controlled vocabulary or are statistically derived from a document corpus. In a legal context, a query for "breach of contract" might be automatically expanded to include "material breach," "anticipatory repudiation," "non-performance," and "fundamental breach." The expanded query is then submitted to the retrieval engine, which matches against a broader set of potentially relevant documents that use different terminology to describe the same legal concept. This is particularly critical in law, where practitioners use jurisdiction-specific jargon, Latin phrases, and statutory language that may not match the exact keywords a researcher initially types.
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 expansion in legal AI relies on a constellation of retrieval, embedding, and ranking techniques. The following concepts form the technical foundation for broadening search recall without sacrificing precision.
Hybrid Search
A retrieval architecture that executes sparse lexical (BM25) and dense semantic searches in parallel and fuses their results. Query expansion terms are often injected into the sparse query to capture exact keyword variants, while the dense vector handles conceptual synonyms. This dual-path approach leverages the complementary strengths of both methods for legal document discovery.
Synthetic Query Generation
A data augmentation method that uses a language model to generate plausible queries for unlabeled legal documents. For query expansion, this technique can produce alternative phrasings of a user's original query—including statutory citations, Latin terms, and procedural synonyms—creating training pairs that teach retrieval models to map diverse legal language to the same relevant documents.
Reciprocal Rank Fusion (RRF)
An algorithm that combines ranked result lists from multiple retrieval systems by computing a reciprocal rank score. When query expansion generates multiple query variants, each variant can be executed independently and their results merged via RRF without requiring score calibration. This is particularly effective when combining exact citation searches with semantic paraphrase searches.
Cross-Encoder Reranker
A two-stage retrieval refinement model that jointly encodes a query and candidate document to compute a fine-grained relevance score. After query expansion broadens the initial recall set, a cross-encoder reranker re-evaluates each document against the original query, filtering out false positives introduced by overly aggressive expansion and improving final precision.
Legal-BERT
A domain-specific BERT model pre-trained on legal corpora including case law, legislation, and contracts. When used for query expansion, Legal-BERT can generate contextually appropriate legal synonyms and related concepts that a general-domain model would miss—such as expanding 'breach' to include 'non-performance,' 'repudiation,' and 'material violation' based on contractual usage patterns.
Semantic Chunking
A document segmentation strategy that splits text based on semantic boundaries rather than fixed token counts. Effective query expansion depends on well-chunked documents because expansion terms must align with coherent legal provisions. Poor chunking that fragments clauses across boundaries will cause expansion terms to match irrelevant passages, degrading retrieval quality.

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