Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

RAG Query Expansion with HyDE and Multi-Query Rewriting

AI summary

This tutorial demonstrates how HyDE and multi-query rewriting can expand retrieval entry points for complete queries whose wording differs from knowledge-base documents. Using PostgreSQL 16, pgvector 0.8, bge-m3, and RRF fusion, the author reports that multi-query expansion plus the original query achieved 86% recall@5, compared with 72% without expansion and 80% for HyDE alone, though at higher latency. The evaluation covers 100 queries from the author's device knowledge base and therefore is not a general benchmark.

In-depth insight

The article provides reproducible implementation and evaluation patterns for improving RAG retrieval while emphasizing intent drift, duplicate chunks, extra latency, and the need to trigger expansion selectively.

上一篇解决了多轮对话里的指代和省略:先把「它多少钱」还原成独立 query,再送检索。但独立 query 也不天然适合检索。

用户说「设备老是卡住」,文档写的是「设备响应超时」;用户说「打印有黑道」,文档写的是「输出页面出现纵向条纹」。问题很完整,向量检索却可能因为措辞差异捞不到目标文档。

这类问题该做查询扩展:用 HyDE 或多 query 改写增加检索入口。这篇沿用前面的 pgvector + bge-m3 环境,给出最小实现、RRF 融合代码和一组分类型评测,最后说清两套方案怎么选。

一、先分清:查询重写和查询扩展不是一回事

这两个技术经常混在一起,实际解决的问题不同:

技术输入的问题目标输出
查询重写(上一篇)「它多少钱」,离开上下文无法理解补全指代和省略一个独立 query
查询扩展(本篇)「设备老是卡住」,语义完整但措辞不好检索增加与用户措辞不同的检索入口假设答案或多个 query 变体

#HyDE#Reciprocal Rank Fusion#pgvector#bge-m3#PostgreSQL 16

Original · 8 min readRead the original
Group chat

No comments yet. Start the conversation.