ModelRefs / Query Rewriting — AI Glossary

Query Rewriting — AI Glossary

Transforming the user's raw query into a better-formulated retrieval query before searching the vector database. Three query-side techniques get conflated.

Overview

Query rewriting addresses ambiguous, conversational, or incomplete user queries that retrieve poorly. Techniques: rephrasing for keyword clarity, conversation condensation (merging history into one query), LLM-generated alternate forms. LlamaIndex's QueryTransform and LangChain's MultiQueryRetriever implement this pattern.

Reference details

Topicrag
Last reviewed2026-06-24

Commonly confused with

Three query-side techniques get conflated. Rewriting *replaces* the query with a better-formed one — resolving "what about the second one" against the conversation, or turning a question into search-shaped text. Expansion *adds* terms or variants. Decomposition *splits* it into several queries. Rewriting is the one that fixes an under-specified or conversational query; the others fix a query that is clear but too narrow.

Continue your research

Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Query Rewriting — AI Glossary.

Frequently asked questions

What is Query Rewriting?

Transforming the user's raw query into a better-formulated retrieval query before searching the vector database.

What concepts are related to Query Rewriting?

Closely related concepts include query expansion, query decomposition, advanced rag.