One trick is to have a LLM hallucinate a document based on the query, and then embed that hallucinated document. Unfortunately this increases the latency since it incurs another round trip to the LLM.
One trick is to have a LLM hallucinate a document based on the query, and then embed that hallucinated document. Unfortunately this increases the latency since it incurs another round trip to the LLM.
If you could spot the need for it while streaming a response you could possibly even have it ready ahead of time
https://arxiv.org/abs/2212.10496
Summary —
HyDE is a new method for creating effective zero-shot dense retrieval systems that generates hypothetical documents based on queries and encodes them using an unsupervised contrastively learned encoder to identify relevant documents. It outperforms state-of-the-art unsupervised dense retrievers and performs strongly compared to fine-tuned retrievers across various tasks and languages.
Aleph Alpha provides an asymmetric embedding model which I believe is an attempt to resolve this issue (haven't looked into it much, just saw the entry in langchain's documentation)
I'm not following why you would want to do this? At that point, just asking the LLM without any additional context would/should produce the same (inaccurate) results.
E.g. Today I woke up at 9.am, had a light breakfast and then went on a run in Golden Gate Park.
What questions do you generate from this sentence?
where did you go this morning? When did you woke up this morning. What did you do after breakfast? What did you do today at Golden Gate Park.
GPT is all about probabilities. So the LLM know what might be most related answer of a doc chunk.
It works much better than embedding the whole sentence because "When did you woke up this morning" might not be very similar with "Today I woke up at 9.am, had a light breakfast and then went on a run in Golden Gate Park.".