Retrieval-Augmented GenerationRAGQuery Transformation

What is query expansion in RAG?

Query expansion in RAG improves retrieval by adding related search terms or generating additional queries from the user's original question. The goal is to find relevant source passages that use different wording, while preserving the original intent.

How it works

  1. Read the original question: Identify the key concept, identifiers, constraints, and what information the user needs.
  2. Generate complementary terms or queries: Add useful synonyms, related phrases, acronym expansions, or alternative formulations.
  3. Search with the expansions: Run the original query and one or more expanded queries against lexical, dense, or hybrid indexes.
  4. Merge results: Deduplicate chunks, combine ranked candidate lists (for example, with Reciprocal Rank Fusion), and optionally rerank them against the original question.
  5. Generate an answer: Give the LLM only relevant, authorized evidence from the merged results.

Practical example

A user asks: “How do I get reimbursed for WFH equipment?”

Relevant policy documents might use “home-office expenses”, “remote work allowance”, or “equipment reimbursement” instead of “WFH.” Query expansion can search those variants and retrieve the correct policy even when the exact wording differs.

The system should preserve any explicit limits in the original query—such as country, effective date, employee group, or product ID—rather than broadening the question indiscriminately.

Common expansion techniques

  • Synonym or acronym expansion: Add WFH, work from home, and remote work where appropriate.
  • Domain dictionaries: Include known company, medical, legal, or product terminology.
  • LLM-generated multi-query retrieval: Produce several intent-preserving variations and fuse their retrieved results.
  • Pseudo-relevance feedback: Use terms from initially retrieved, likely relevant passages to refine or expand a second search. This must be evaluated carefully because early results can be wrong.

Query expansion versus query rewriting

  • Expansion: Enriches an existing search with related terms or additional query variants, often retaining the original.
  • Rewriting: Reformulates a question into a clearer or more search-friendly version, potentially replacing the original query.

They can overlap, and both may be used together.

Benefits and pitfalls

  • Better recall: Finds evidence missed because of vocabulary mismatch.
  • More robust acronym handling: Especially helpful in domain-specific documents.
  • Query drift: Overbroad or incorrect synonyms may retrieve unrelated passages.
  • Latency and cost: Running more queries and an LLM expander requires extra work.
  • Safety: Do not let generated expansions relax authorization, tenant boundaries, or the user's explicit constraints.

Compare approaches on an evaluation set using Recall@K, evidence precision, answer groundedness, and latency. Expansion is useful when it improves real queries—not automatically for every question.

Interview takeaway

Query expansion broadens retrieval using synonyms, domain terms, or multiple meaning-preserving query variants. Search the original and expanded queries, merge results, and rerank against the user's actual intent to improve recall without introducing irrelevant evidence.

#query expansion in RAG#multi query retrieval RAG#synonym expansion#query expansion versus rewriting#rag#query-expansion#multi-query#retrieval

Learning Sequence

Retrieval-Augmented Generation Curriculum

62% Completed
Up NextRAG

What is query decomposition in RAG?

Explore Related Questions

Deepen your understanding across related Retrieval-Augmented Generation topics.

Machinoai Logo
Machinoai

Your edge in the AI era. Deep dives into machine learning concepts, paper explainers, verified industry jobs, and developer tools.

© 2026 Machinoai. All rights reserved.