AI Engineering · interactive
Query rewriting and HyDE
People ask in their own words; documents use product words. Search with the question as typed and the right page may never come back. Let a model rewrite the question first, or even write a fake answer and search with that.
User typed
it keeps saying no when i try to pay??
Search query sent (As typed)
it keeps saying no when i try to pay??
#1Why a payment is declinedthe answer0 words shared
#2Updating your billing address0 words shared
#3Refund timing0 words shared
#4Exporting your data0 words shared
#5Single sign-on0 words shared
#6API rate limits0 words shared
Nothing in the help centre shares a single word with the question as typed, so the right page never comes back.
Question
Search with
Search with exactly what the user wrote.
1 2 3 4 Only the top results reach the model. A page at #5 might as well not exist. HyDE can also mislead: if the fake answer is wrong, it finds documents about the wrong thing.
- it keeps saying no when i try to pay??As typed: — · Rewritten: #1 · HyDE: #1
- how do i get all my stuff into a spreadsheetAs typed: — · Rewritten: #1 · HyDE: #1
- the api stopped answering after a whileAs typed: #1 · Rewritten: #1 · HyDE: #1
In production
Tools and technologies
Most RAG frameworks can rewrite or expand the query before retrieval with one setting.
Not tied to one language — use these names when you search docs or design a system.