Skip to content
BENIBIX Learn

Query Rewriting

Also known as Query Transformation, Query Expansion (RAG), Query Reformulation

A vague question is made clear first. Then the search runs.

Think of it like

It is like a helper who asks what you mean. Then they look for that.

Example

Lucy asks the help bot "and for kids?" right after a question about ticket prices. The rewrite becomes "ticket prices for children", and the right page comes back.

Why it matters

People type short, messy questions. A cleaner search finds better chunks.

Definition

Query rewriting changes a user's question before the search runs. A model turns a short or vague question into a clearer search. It can fill in words from earlier in the chat, like who "he" is. It can split one question into two searches, or add other words for the same idea. The retriever then searches with the better version.
The question is cleaned up here, just before the search runs.

Common mistake

Rewriting so much that the meaning changes. Test that rewrites keep what the user asked.

Key takeaways

  1. 1
    Before the search. Fix the question first.
  2. 2
    Fill the gaps. Use the chat so far.
  3. 3
    Keep the meaning. Clearer, not different.