惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
U
Unit 42
aimingoo的专栏
aimingoo的专栏
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Announcements
Recent Announcements
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
博客园_首页
M
MIT News - Artificial intelligence
博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
IT之家
IT之家
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
D
Docker
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News

博客园 - Zhentiw

[GenAI] Migration Plan: Flat API → Layered Architecture [Skill] Frontend Design Skill Claude Code Hooks: Complete Guide [GenAI] About Indexing [GenAI] Indexing overview [Vibe Coding] 降低大模型幻觉 - 重试机制 [Vibe coding] 降低大模型幻觉 - JSON 安全输出提示词 [Node.js] WebSocket基础知识 [LangGraph] 应用结构 [LangGrpah] Unit testing [LangGraph] Functional API [LangGraph] 中断注意事项 [LangGraph] 中断相关细节 [LangGrpah] 静态断点 [LangGrpah] 非阻塞式中断 [LangGraph] 阻塞式中断 [LangGraph] 语义搜索 [LangGraph] 长期记忆 [LangGraph] 管理短期记忆 [LangGraph] 自定义checkpointer [LangGraph] 短期记忆 [LangGraph] 时间旅行 [LangGraph] checkpoint常用API [LangGraph] 元数据标记 [LangGraph] 流 [Vitest] mockClear, mockReset, mockRestore [LangGraph] 将子图添加为节点
[GenAI] Pre-retieval overview
Zhentiw · 2026-06-01 · via 博客园 - Zhentiw

Content

  • Query Rewrite
  • Query Expand
  • Multi-query
  • Query Decomposition
  • HyDE

Query Rewrite

Query Rewrite is a rewirting strategy. It means: without changing the user's core intent, rewrite the original query to make it more precise, clearer, and more suitable for retrieval.

Original user query:

Apple 15 battery life how

Rewritten query:

How is the battery life performance of the iPhone 15?

This does not change the actual question. It only turns a colloquial, vague, and incomplete expression into a more complete and standardized search query.

Query Expand

The core idea is: add more context or related terms to the original question, while ususally still expanding around one search request.

For example, the user asks:

Laptop keeps shutting down, what should I do?

After expansion, it may become:

Laptop keeps shutting down, causes, solutions, blue screen, freezing, overheating, driver issues

The key point here is that related terms are added, such as:

shutdown, blue screen, driver, overheating

Multi-query

The core idea is: generate multiple queries from different angles, retrieve results separately, and then merge the results.

For example, the user asks:

How to improve R&D team efficiency?

The system generates multiple queries:

Methods to improve R&D team efficiency
Best practices for improving software team collaboration efficiency
R&D process optimization OKR sprint code review
Common bottlenecks affecting R&D efficiency

This is not just “adding more keywords.” Instead, it generates multiple ways of asking the question from different perspectives.

Query Decomposition

It can be understood as: breaking down a quetion that is too broad, too complex, or hard to retrieve directly into several smaller, more specific, and easier-to-retrieve questions.

For example, the user asks:

Which company is more worth joining, Company A or Company B?

This question is difficult to retrieve directly, because “more worth joining” is too broad.

The system may first decompose it into several sub-questions:

What is the salary level at Company A?
What is the salary level at Company B?
What is the overtime situation at Company A?
What is the overtime situation at Company B?
What is the growth prospect of Company A?
What is the growth prospect of Company B?

What's the difference between Query Decomposition & Multi-query?

Multi-query: The core goal is: for the same question, grenerate several alternative phrasings or retrieval angles, so the system can retrieve more of the relevant content.

Query Decomposition: The core goal is:  a complex question naturally contains multi sub-questions, so the system first breaks it down and then retrieves each part separately.

HyDE (Hypothetical Document Embeddings)

First let the modal genearte a hypothetical answer/document, then use that generated content to perform vector retrieval.

Why doing this?

Because the user's original query is often short, colloquial, and information-poor, so it may not directly match the most relevant content.

Therefore, the system adds an intermediate step:

  1. Based on the user's question, let the LLMK first write a piece of content that may appear in the correct answer
  2. Use this generated content for vector retrieval
  3. Retrieve the truly relevant documents.

Example:

User question:

Why is RAG more suitable than fine-tuning for knowledge bases that are updated frequently?

HyDE first asks the model to generate a hypothetical answer, for example:

RAG is more suitable for frequently updated knowledge bases because it does not require retraining the model. You only need to update the external knowledge base. In contrast, fine-tuning usually requires retraining or redeployment, which is more costly and has a longer update cycle.

The key difference:

Normal retrieval: retrieve using the “question”
HyDE: retrieve using “a draft that looks like the answer”

HyDE can improve retrieval because the hypothetical answer often contains richer semantic signals than the original question, such as:

frequently updated knowledge base
no retraining
external knowledge base
fine-tuning
redeployment
cost
update cycle

HyDE adds one extra generation step, which makes the pipeline longer.

With HyDE, the process becomes:

  1. First, let the model generate a hypothetical answer
  2. Use that hypothetical answer for retrieval
  3. Then generate the final answer

This introduces:

  • Higher latency
  • Higher cost
  • More system complexity

My understanding is that all four are retrieval pre-processing techniques, but they solve different problems.

Query Rewrite mainly solves the problem of user queries being poorly expressed, incomplete, or too colloquial.

Essentially, it rewrites the query to make it clearer and more precise, without changing the user’s core intent.

Multi-query generates multiple phrasings or retrieval angles for the same question.
Its goal is to improve recall. It is suitable when the query is short, can be expressed in many ways, or may miss relevant documents.

Query Decomposition breaks a complex question into several sub-questions.
It is suitable for comparative, composite, or multi-constraint questions, such as: “What is the difference between A and B?” or “Which one is more suitable for a certain scenario?”

HyDE is slightly different. It does not simply rewrite the query.
Instead, it first generates a hypothetical answer or hypothetical document, then uses that generated text for retrieval.
It is suitable when the user query and the knowledge base documents have a large wording gap, or when direct vector retrieval is unstable.