Why your query is the bottleneck
A RAG pipeline is only as good as its retrieved context. Most engineers spend days tuning chunk sizes and embedding models, then leave the query itself untouched โ despite the query being the single biggest lever on retrieval quality.
The core mismatch: a user's question is short, conversational, and vague. A document chunk is dense, domain-specific, and written for a different purpose. Vector similarity between those two is often misleading. A query like "what's the latency budget?" sits far in embedding space from a spec doc that says "end-to-end round-trip must not exceed 200 ms at p99".
Query rewriting bridges this gap by transforming the raw query โ using the LLM itself โ before retrieval happens. The four main techniques are HyDE, multi-query expansion, query decomposition, and step-back prompting. Each attacks a different failure mode.
