What is Query Expansion?
Query expansion is a retrieval technique that augments the original user query with additional terms, synonyms, related concepts, or alternative phrasings to improve retrieval coverage and recall. Rather than searching only for the exact query terms or embedding, expanded queries cast a wider net, increasing the likelihood of finding relevant information that might be expressed differently than the user's query. This addresses the vocabulary mismatch problem where relevant documents use different terminology than the query.
Expansion can be implemented through various approaches: adding synonyms from thesauri or word embeddings, including morphological variations (plurals, tenses), generating related queries using an LLM, extracting key concepts and adding related terms, or using pseudo-relevance feedback where an initial search's top results inform query expansion. Some systems generate multiple query variations and combine results from all of them, while others selectively add high-confidence expansions to the original query.
Query expansion is particularly valuable in RAG systems where improving recall (finding all relevant information) is important, even if it comes with some precision tradeoff. It helps handle cases where users might not know the exact terminology used in documents or express queries informally. However, excessive expansion can introduce noise and retrieve irrelevant results, so expansion strategies must balance improved coverage against maintaining focus. Modern implementations often use LLMs to generate contextually appropriate query expansions.