mediumRAG & Vector DatabasesReviewed Jul 8, 2026

What are query rewriting and query expansion, and how do they improve retrieval?

User queries are often short, ambiguous, or use different vocabulary than the documents. Query rewriting transforms the query before retrieval: resolving conversational context (turning 'what about its pricing?' into a standalone question), correcting typos, or decomposing a multi-part question into sub-queries retrieved separately. Query expansion adds related terms or generates multiple query variants to widen recall. A popular technique is HyDE (Hypothetical Document Embeddings): the LLM drafts a hypothetical answer, and you embed that instead of the raw question, because the fake answer sits closer to real answer passages in embedding space. Multi-query retrieval generates several paraphrases and unions the results. These methods trade extra LLM latency/cost for better recall, and are especially valuable for underspecified or conversational queries.

query-rewritingquery-expansionretrieval

More RAG & Vector Databases questions

See all RAG & Vector Databases questions →