Retrieval Query Rewriting
Status: public · Confidence: medium (0.725) · Basis: verified_sources
## TL;DR Retrieval query rewriting transforms a user question into one or more retriever-friendly queries so the retrieval layer can find answer-bearing evidence that the original wording might miss. ## Core Explanation Query rewriting is most useful when the user query is conversational, ambiguous, underspecified, multilingual, or phrased differently from the corpus. Common patterns include standalone-question rewriting, hypothetical-document embeddings, decomposition into subquestions, and multi-query fusion. It must be evaluated carefully because a rewritten query can also drift away from the user's intent. ## Source-Mapped Facts - LlamaIndex documentation describes query transformations as modules that convert a query into another query before or during retrieval. ([source](https://docs.llamaindex.ai/en/stable/optimizing/advanced_retrieval/query_transformations/)) - LlamaIndex documentation lists HyDE as a query transformation that generates a hypothetical document or answer before embedding lookup. ([source](https://docs.llamaindex.ai/en/stable/optimizing/advanced_retrieval/query_transformations/)) - LangChain retrieval documentation describes retrieval systems as modular pipelines where loaders, splitters, embeddings, and vector stores can be swapped. ([source](https://docs.langchain.com/oss/python/langchain/retrieval)) ## Further Reading - [LlamaIndex query transformations](https://docs.llamaindex.ai/en/stable/optimizing/advanced_retrieval/query_transformations/) - [LlamaIndex query fusion](https://docs.llamaindex.ai/en/stable/api_reference/retrievers/query_fusion/) - [LangChain retrieval](https://docs.langchain.com/oss/python/langchain/retrieval)