Sobes.tech
Middle — Senior

What is HyDE (Hypothetical Document Embeddings)?

sobes.tech AI

Answer from AI

HyDE (Hypothetical Document Embeddings) is a method used in systems with large language models (LLMs) and Retrieval-Augmented Generation (RAG). The idea is to first generate a hypothetical document or answer to a query using the LLM, and then obtain an embedding of this generated text for searching or matching with real documents.

Thus, instead of directly searching by the original query, the system first forms an "imaginary" document that reflects the query's meaning, and then performs the search based on it. This helps improve search quality and relevance, especially when queries are complex or ambiguous.

Example application:

  • User inputs a question.
  • LLM generates a hypothetical answer or document for this question.
  • The generated text is converted into a vector (embedding).
  • The document database is searched based on the proximity of embeddings.

This increases the efficiency of Retrieval-Augmented Generation, allowing better linking of queries with relevant information.