What is Query Transformation


Users often don’t know exactly what they want
To optimize Retrieval-Augmented Generation( RAG) “Query Transformation”
comes in play. We adjust the users query to an appropriate level of abstraction
User’s query maybe too abstract (“Kuch achha bana do.”) or too specific (“Kal subah 7:43 AM pe besan ka chilla banao, jisme exactly 1.5 green chilli ka paste ho, aur 2mm mota ho.”)
In Query Transformation we refine the query, making it more focused or broad enough to give better result
Example
Mom said: “Vha se Vo le aao”
If you try to directly execute the command you will end up with wrong thing, Instead
Think about the Query, analyse it
Know about the context
Where is mom?
If she’s in the kitchen preparing aamras, and there’s no sugar on the table, “Vha se vo le aao” probably means “Bring some sugar from the Top Shelf.”
Alternate Approach
You could ask “Mom, what exactly do you want”
but this is a little risky like mom may get angry
In technical way users get annoyed by follow-up questions, too many clarification may degrade user experience
Once you get the intended meaning you can execute the command and most probably get the best result
Now our goal is clear to give better anwer/output we have to make the query better
Which can be done by following techniques:
Parallel Query
Query Decomposition
Step Back
Hypothetical Document Embedding
Subscribe to my newsletter
Read articles from Sanidhya Soni directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
