25One call

Query rewriting

Have a model rewrite the user’s query, with the conversation so far, before searching with it.

Also called Rewrite-Retrieve-Read

Ma et al., ElevenLabs, Elastic, Microsoft

rewritten queryUser’s queryContextDialoguehistoryModel callQueryrewritingCodeRetrieverModel callLLM
How to read this

The problem

The user’s words, often leaning on earlier turns, are not the query the retriever needs.

there is inevitably a gap between the input text and the knowledge that is really needed to query.
Ma et al.Query Rewriting for Retrieval-Augmented Large Language Models
Most user requests reference prior turns, so the system needs to collapse dialogue history into a precise, self-contained query.
ElevenLabsHow we engineered RAG to be 50% fasterSep 12, 2025

Therefore

In front of the retriever, a step of rewriting the input is added, filling the gap between the given input and retrieval need
Ma et al.Query Rewriting for Retrieval-Augmented Large Language Models
Query rewriting … is the process of transforming a user's query into a more effective one, adding more terms and refining search results.
MicrosoftRewrite queries with semantic ranker in Azure AI Search (preview)

In use

ElevenLabs

In our system, we add a query rewriting step first, collapsing dialogue history into a precise, self-contained query before retrieval.
ElevenLabsHow we engineered RAG to be 50% fasterSep 12, 2025

Azure AI Search

The Foundry IQ service sends the search query (or a variation of it) to a generative model that generates alternative queries.
MicrosoftRewrite queries with semantic ranker in Azure AI Search (preview)

Where it breaks

A rewrite can drop the exact terms a search needed, and leaning on it too much can lower relevance.

The rewritten queries might not contain all of the exact terms the original query had. This might impact search results if the query was highly specific and required exact matches for unique identifiers or product codes.
MicrosoftRewrite queries with semantic ranker in Azure AI Search (preview)
We observed that overreliance on LLM output reduced relevance.
ElasticQuery rewriting strategies for LLMs and search engines to improve resultsJan 30, 2026

Sources

  1. Query Rewriting for Retrieval-Augmented Large Language ModelsXinbei Ma, Yeyun Gong, Pengcheng He, Hai Zhao, Nan Duan, Ma et al.
    We present Rewrite-Retrieve-Read, a pipeline that improves the retrieval-augmented LLM from the perspective of query rewriting.
  2. How we engineered RAG to be 50% fasterElevenLabs, Sep 12, 2025
  3. Query rewriting strategies for LLMs and search engines to improve resultsChristina Nasika, Emilia Garcia Casademont, Elastic, Jan 30, 2026
  4. Rewrite queries with semantic ranker in Azure AI Search (preview)Microsoft

Added Nov 14, 2026