liveBook · Manning

Hypothetical question embedding

As explained in Essential GraphRAG

Hypothetical question embedding is a retrieval strategy that embeds questions a document could answer and matches user queries against those question embeddings.

Hypothetical question embedding improves retrieval by representing each document chunk through questions it can answer rather than only through its original wording. An LLM or chatbot conversation history can supply those questions. At query time, the system embeds the user’s question, finds semantically similar precomputed question embeddings, and retrieves the documents containing the answers. section 3.0

A practical implementation follows this sequence:

  • Identify questions that each document or chunk can answer. section 3.0
  • Generate questions with an LLM or derive them from chatbot conversation history, then precompute their embeddings. section 3.0
  • Embed each user query, search for nearest question vectors, and return the associated documents. section 3.0

Matching a user question

A document that answers “What did Leopold study at the University of California?” can store that hypothetical question as vector [1,2,3,0,5]. A semantically similar user query retrieves the document through the question vector rather than matching the document’s original wording. section 3.0

Figure 3.2 Hypothetical question and parent document retriever strategies
figure

Compare hypothetical question embeddings with parent document embeddings and child-chunk retrieval. section 3.0

How Essential GraphRAG covers it

How deep it goes
Explains question generation, embedding, nearest-neighbor matching, and document retrieval without detailing parameter choices.
Examples
Uses an LLM-generated Leopold question, its vector representation, and chatbot conversation history as question sources.
What it assumes
Assumes familiarity with document embeddings, query embeddings, nearest-neighbor search, and LLM-generated questions.
What you can do after
Apply it via vector retrieval: generate answerable questions, embed them, match user queries, and retrieve source documents.
How it connects
Connects vector retrieval with query rewriting, hypothetical document retrieval, and parent document retrieval.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Essential GraphRAG. The section links point to the parts of the book it draws on.