Skip to content
Back to the collection

Precise Zero-Shot Dense Retrieval without Relevance Labels

Luyu Gao, Xueguang Ma, Jimmy Lin, Jamie Callan

2022 · arXiv

Read the paper
HN score
1.5
Mentions
11
Readers
11
Months
7
What’s in a score?

From the abstract

While dense retrieval has been shown effective and efficient across tasks and languages, it remains difficult to create effective fully zero-shot dense retrieval systems when no relevance label is available. In this paper, we recognize the difficulty of zero-shot learning and encoding relevance. Instead, we propose to pivot through Hypothetical Document Embeddings~(HyDE). Given a query, HyDE first zero-shot instructs an instruction-following language model (e.g. InstructGPT) to generate a hypothetical document. The document captures relevance patterns but is unreal and may contain false details. Then, an unsupervised contrastively learned encoder~(e.g. Contriever) encodes the document into an embedding vector. This vector identifies a neighborhood in the corpus embedding space, where similar real documents are retrieved based on vector similarity. This second step ground the generated document to the actual corpus, with the encoder's dense bottleneck filtering out the incorrect details. Our experiments show that HyDE significantly outperforms the state-of-the-art unsupervised dense retriever Contriever and shows strong performance comparable to fine-tuned retrievers, across various tasks (e.g. web search, QA, fact verification) and languages~(e.g. sw, ko, ja).

Metadata: arXiv. Abstracts retain their original authors’ rights.

In the conversation

Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels

11 selected excerpts · 11 total mentions

postalcoder
Strong recommendation · rule
To add some context, this isn't that novel of an approach. A common approach to improve RAG results is to "expand" the underlying chunks using an llm, so as to increase the semantic surface area to match against. You can further improve your results by running query expansion using HyDE[1], though it's not always an improvement. I use it as a fallback. I'm not sure what Anthropic is introducing here. I looked at the cookbook code and it's just showing the process of producing said context, but there's no actual change to their API regarding "contextual retrieval". The one change is prompt caching, introduced a month back, which allows you to very cheaply add better…
Read the full comment
context to individual chunks by providing the entire (long) document as context. Caching is an awesome feature to expose to developers and I don't want to take anything away from that. However, other than that, the only thing I see introduced is just a cookbook on how to do a particular rag workflow. As an aside, Cohere may be my favorite API to work with. (no affiliation) Their RAG API is a delight, and unlike anything else provided by other providers. I highly recommend it. 1: https://arxiv.org/abs/2212.10496
pbronez
Neutral mention · rule
HyDE apparently means “Hypothetical Document Embeddings”, which seems to be a kind of generative query expansion/pre-processing https://arxiv.org/abs/2212.10496 https://github.com/texttron/hyde From the abstract: Given a query, HyDE first zero-shot instructs an instruction-following language model (e.g. InstructGPT) to generate a hypothetical document. The document captures relevance patterns but is unreal and may contain false details. Then, an unsupervised contrastively learned encoder~(e.g. Contriever) encodes the document into an embedding vector. This vector identifies a neighborhood in the corpus embedding space, where similar real documents are retrieved based on vector similarity. This second step ground the generated document to the actual corpus, with the encoder's dense bottleneck filtering out the incorrect details.
avereveard
Neutral mention · rule
I've tried Hyde and seems to work better. had to do it client side tho. asked chatgpt: "write one sentence explanation about this topic: solutions for postgres clustering" which returned "Solutions for PostgreSQL clustering involve implementing methods such as streaming replication or third-party tools like Patroni to manage and distribute database workloads across multiple servers for enhanced performance and fault tolerance." then I searched that: https://hackersearch.net/search?q=Solutions+for+PostgreSQL+c... and results are much better: 1. An overview of distributed Postgres architectures 2. A Technical Dive into PostgreSQL's replication mechanisms 3. Ways to capture…
Read the full comment
changes in Postgres hyde paper is here https://arxiv.org/abs/2212.10496 it's possible that openai embedding are simmetrical, if that the case you need to hallucinate some content and use that as base for the embedding distance calculation. or you can move to asymmetric embedding, or you can try prompting their embedding edit: prompting embedding seems to work, tried searching for “write an article about: solutions for postgres clustering” and results are much better https://hackersearch.net/search?q=write+an+article+about%3A+... you can try prepending "write an article about: " to all user searches :D
bayesian_limit
Neutral mention · rule
I could not help but notice the Contriever curve is so much higher on y-axis Recall than the other methods (figure 11 in https://arxiv.org/pdf/2307.03172.pdf). Has anyone come across more recent experiments, results, or papers related to this? I'm acquainted with the: - Contriever 2021 paper https://aclanthology.org/2021.eacl-main.74.pdf - Hyde 2022 https://arxiv.org/pdf/2212.10496.pdf My suspicion is some pre-logic such as is the user's question dense enough then use Hyde with chat history. If anyone has more recent experience with Contrievers, would love to learn more about it! Feel free to contact me directly on LinkedIn. https://www.linkedin.com/in/christybergman/
hobofan
Neutral mention · rule
If you know that your search queries will be actual questions (like in the example you listed), you can possibly use the HyDE[0] to create a hypothetical answer which will usually have an embedding that's closer to the RAG chunks you are looking for. It has the downside that an LLM (rather than just a embedding model) is used in the query path, but it has helped me multiple times in the past to strongly reduce problems with RAG like the ones you outlined, where it likes to latch onto individual words. [0]: https://arxiv.org/abs/2212.10496
d4rkp4ttern
Neutral mention · rule
Some people packaged this rather intuitive idea, named it Hyde (Hypothetical Document Embeddings) and wrote a paper about it — 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.
curo
Neutral mention · rule
Query (→ GPT3 completion) → vector db lookups → GPT3 synthesis The optional step two is used when the lookups are more closely related to an answer's latent space than the original query text. This approach is called HyDE (first published here: https://arxiv.org/abs/2212.10496). The synthesis is also optional. You can essentially summarize your lookups or refine them or do whatever you want at this stage. If you skipped steps 2 and 4, it's just a semantic search engine. If you skip step 2, you're either doing it for latency/performance reasons, or because the user query's embeddings are more similar to the docs in the vector db.
yayr
Neutral mention · rule
it is a result of trying to align the AI model after it has been trained using self-supervised learning with an addition human feedback step. OpenAI has a model / process called InstructLM or InstructGPT see e.g. https://arxiv.org/pdf/2212.10496.pdf https://arxiv.org/pdf/2203.02155.pdf also an approach to solve the alignment problem. https://en.wikipedia.org/wiki/AI_alignment
simonw
Neutral mention · rule
Yeah I'm happy with the results I got from embeddings so far. The areas I want to explore there are: 1. What's the ideal size of text to embed? I'm doing whole blog entries right now but I'm confident I can get better results if I divide them up into smaller chunks first - I'm just not sure how best to do that. 2. There's a trick called Hypothetical Document Embeddings (HyDE) where you ask GPT-3 to invent an answer to the user's question, embed THAT fictional answer, then use that embedding to find relevant documents in your corpus. https://arxiv.org/abs/2212.10496

Keep following the thread.

More in Language models

More from the same topics.

2017arXiv

The Case for Learned Index Structures

Tim Kraska, Alex Beutel, Ed H. Chi +2

Indexes are models: a B-Tree-Index can be seen as a model to map a key to the position of a record within a sorted array, a Hash-Index as a model to map a key to a position of a record within an unsorted array, and a BitMap-Index as a model to indicate if a data record exists or not.

19 mentions14 months
5HN score