AI / LlamaIndex Interview Questions
What is HyDE and how does it help retrieval?
HyDE (Hypothetical Document Embeddings) is a query transformation technique where, instead of embedding the user's raw question directly, an LLM first generates a hypothetical answer to that question, and it's the embedding of that generated answer that gets used for similarity search.
The idea addresses a real gap: questions and answers are often phrased very differently. A question like "How do I fix a memory leak in Node.js?" may not embed close to a passage that reads "Use --inspect and Chrome DevTools to profile heap snapshots," even though the passage answers it, because questions and technical explanations don't share much surface vocabulary.
By embedding a hypothetical answer instead of the bare question, HyDE searches in the same style of language the target documents are likely written in, which can improve recall on queries where phrasing mismatch is the main obstacle, at the cost of one extra LLM call before retrieval even starts.
More Related questions...