Skip to main content
InterviewHubPRO
Section Overview
Q40

Question 40 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

80%
Vector DBs & RAG (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

Advanced RAG Query Transformations: Query Rewriting, HyDE, and Multi-Query Generation.

senior LevelMost AskedForms

In Simple Words: Raw user queries are often vague, keyword-sparse, or poorly worded for semantic matching:

  • Query Rewriting: An LLM reformulates the user prompt into a clear, standalone search query resolving pronouns and past conversational context.
  • HyDE (Hypothetical Document Embeddings):
    1. Feed the user prompt to an LLM: "Write a hypothetical passage that answers this question".
    2. Embed the generated hypothetical answer, not the user question!
    3. The hypothetical answer lives in "document space" rather than "query space", dramatically improving cosine similarity matches with real source documents.
  • Multi-Query Expansion: Generates 3-5 distinct keyword and semantic variations of the query, executes them in parallel, and merges candidate chunks via reciprocal rank fusion.