Home Knowledge Base Problem

Query rewriting transforms user queries to better match document format before retrieval. Problem: Users ask natural questions but documents are written in different style. "What causes headaches?" vs document "Headache etiology includes...". Techniques: LLM rewriting: Use model to rephrase query in document style, expand abbreviations, add context. Query expansion: Add synonyms, related terms, domain vocabulary. Decomposition: Break complex query into sub-queries. Correction: Fix typos, normalize terminology. HyDE approach: Generate hypothetical answer, use that for retrieval. Multi-query: Generate variants covering different phrasings. Implementation: Query → LLM rewriter → enhanced query → retrieval. Prompting: "Rewrite this question as it might appear in a technical document" or "Generate search terms for:". Evaluation: Compare retrieval metrics (recall@k, MRR) before/after rewriting. Trade-offs: Adds latency (LLM call), may introduce errors, cost per query. When essential: Complex questions, domain mismatch between users and documents, ambiguous queries. Significantly improves RAG retrieval quality.

query rewritingrag

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.