AIOps Peach

RAG Optimization · Module 03

Query Transformations

Rewrite the question before searching: hypothetical document embeddings, decomposing a complex question, multi-query, step-back prompting and routing.

Học tương tác →

Học xong bạn làm được

Bài học

  1. Query Transformations: HyDE

    Real users type short, context-free or multi-part questions, such as "remote work", whose vectors do not match detailed documents. Query transformation uses an LLM to rewrite, expand or break down the question before searching. HyDE asks the LLM for a hypothetical answer and searches with its embedding, bridging the asymmetry between short questions and long documents.

  2. Query Decomposition

    A complex question that compares or aggregates information from several sources has a vector stuck between topics. Query decomposition has an LLM break it into single-intent sub-questions, retrieves for each one, and synthesises the results into one answer. Query transformation as a whole acts as an intelligent editor of the user's question.

  3. Additional Query Transformation Techniques: Multi-Query and Step-Back

    Multi-query generation has the LLM write 3-5 phrasings of a question, searches with each and merges and de-duplicates the results, raising recall. Step-back prompting first asks a more abstract question, so retrieval finds the principles that the specific answer depends on.

  4. Query Routing

    Query routing is a pre-retrieval decision rather than a transformation - a lightweight LLM classifier sends each query to the backend that suits it - vector store for semantic similarity, web search such as Tavily for current events, SQL for aggregation over structured records, code search for exact symbols. Without it, every query hits one backend and some fail silently.

  5. Assignment: Query Transformation

    Query Transformation with HyDE and Decomposition