M7-022M7: Retrieval, Ranking & RecSysHybrid Retrieval & RRF FusionHard
⚡Flashcard Drill➔Mastery:
Explain Query Rewriting and Expansion Techniques in Modern Information Retrieval
🎯 Active Recall Self-Check (Draft First, Verify After)
Login-free practice tracker: recall core answer, audit pitfalls, and log review status.
Step 1 · Draft your concise answer & assumptions
Step 2 · Check Pitfalls & Follow-up Inquiries
📐 Mathematical Definition
⚡ One-Sentence Core Answer
Query rewriting refines, disambiguates, and decomposes user queries, while query expansion appends synonyms and related terms; techniques range from classical pseudo-relevance feedback (PRF) to LLM-generated hypothetical documents (HyDE).
📌 Key Takeaways
- •Rewriting vs. expansion: Rewriting transforms flawed queries (spelling correction, coreference resolution, multi-hop decomposition); expansion adds relevant vocabulary.
- •Query drift hazard: Over-aggressive expansion introduces irrelevant topical associations, degrading precision.
- •Generative methods (HyDE): LLMs generate hypothetical answer passages that dense retrievers use as rich semantic search vectors.
📐 Mathematical Derivations
Systematic & Methodological Formulation: Query Transformation Strategies.
(1) Classical Pseudo-Relevance Feedback (PRF / RM3):
Assumes top- retrieved documents from an initial BM25 search are pseudo-relevant. It estimates a feedback language model :
The expanded query model is a linear interpolation between original query model and feedback model :
Top expanded terms with highest probability are appended to the original query.
(2) Hypothetical Document Embeddings (HyDE, Gao et al., 2022):
For complex queries where direct question-document similarity is weak:
- Step 1: Instruct an LLM to generate a zero-shot hypothetical answer . (Even if factually incorrect, its language and topical structure mirror real target documents).
- Step 2: Encode the hypothetical document: .
- Step 3: Retrieve real documents via vector similarity .
(3) Multi-Turn Conversational Coreference & Disambiguation:
In conversational search, user queries contain elliptical references: . An LLM rewriter conditions on session history :
(1) Classical Pseudo-Relevance Feedback (PRF / RM3):
Assumes top- retrieved documents from an initial BM25 search are pseudo-relevant. It estimates a feedback language model :
The expanded query model is a linear interpolation between original query model and feedback model :
Top expanded terms with highest probability are appended to the original query.
(2) Hypothetical Document Embeddings (HyDE, Gao et al., 2022):
For complex queries where direct question-document similarity is weak:
- Step 1: Instruct an LLM to generate a zero-shot hypothetical answer . (Even if factually incorrect, its language and topical structure mirror real target documents).
- Step 2: Encode the hypothetical document: .
- Step 3: Retrieve real documents via vector similarity .
(3) Multi-Turn Conversational Coreference & Disambiguation:
In conversational search, user queries contain elliptical references: . An LLM rewriter conditions on session history :
🏭 Production Trade-offs
In-Depth Analysis & Engineering Trade-offs: ① The query drift risk—if the initial retrieval or LLM hallucination is topically flawed, PRF or HyDE severely magnifies the error, pulling irrelevant documents into the recall set; selective rewriting based on query ambiguity confidence is critical. ② Latency overhead of LLM rewriting—calling a 7B LLM to rewrite or expand queries introduces 100–300ms latency, making it unsuitable for 50ms search SLAs; production search deploys distilled 100M-parameter sequence-to-sequence models or cached rewrite dictionaries for online paths. ③ Exact keyword preservation—rewriting must never alter or drop critical technical tokens (product SKUs, error numbers, exact names); production rewriters lock recognized named entities. ④ Multi-query parallel search—generating 3 diverse query reformulations and executing parallel searches followed by RRF fusion significantly improves recall on ambiguous queries at the cost of 3x search compute. ⑤ HyDE vs. query-to-query dense retrieval—HyDE bridges the asymmetric question-passage gap by converting search into a symmetric document-to-document match, excelling at complex analytical queries. ⑥ Interview takeaway—distinguish query rewriting (spelling, coreference, intent decomposition) from query expansion (synonym injection, PRF, HyDE), explain the query drift failure mode, and discuss latency mitigation strategies.
⚠️ Common Interview Pitfalls
- ✕Applying blind query expansion to specific, long-tail technical queries, introducing semantic drift and degrading precision.
- ✕Deploying heavy generative LLM rewriters directly on synchronous latency-critical search pipelines without aggressive caching or distillation.
- ✕Permitting query rewriting models to alter or discard exact entity identifiers (e.g., error codes, model numbers).
🎯 Interviewer Follow-up Inquiries
- ?Why does HyDE succeed in retrieving relevant documents even when the generated hypothetical passage contains factual hallucinations?
- ?How can a search system detect query ambiguity to decide whether to trigger query expansion dynamically?
- ?What distillation techniques compress 7B LLM conversational query rewriting into a sub-10ms latency budget?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚