ingFang SC", " ingFang TC", " ingFang HK", "Microsoft Yahei", "Microsoft JhengHei";font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.064px;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">前言:问题改写是 RAG 系统中不可或缺的“桥梁”技术,它连接了“用户语言”与“知识库语言”,显著提升了检索的相关性和系统整体性能。掌握并合理应用问题改写方法,是构建高效、智能 RAG 应用的关键一步。ingFang SC", " ingFang TC", " ingFang HK", "Microsoft Yahei", "Microsoft JhengHei";font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.064px;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">1、问题改写(Query Rewriting/Transformation)简介ingFang SC", " ingFang TC", " ingFang HK", "Microsoft Yahei", "Microsoft JhengHei";font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.064px;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">问题改写(Query Rewriting/Transformation)是信息检索、对话系统和RAG(检索增强生成)中的关键技术,旨在对用户原始问题进行转换、分解或增强,以提高检索效果或理解准确性。2、为什么问题改写在 RAG 中如此重要?在原始的 RAG 流程中,用户提问后,系统直接使用该问题去检索知识库。但实际中,用户的问题可能存在: 这些问题会导致检索失败或召回不相关文档。问题改写的作用就是优化原始查询,使其更适合检索系统(尤其是向量数据库或搜索引擎)理解与匹配。
3、问题改写在 RAG 中的常见方法
ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"> | | | |
|---|
|
| | 通过添加同义词、近义表达或相关术语,扩大检索覆盖范围 | |
| | 将口语化、模糊表述转化为更清晰、标准的表达,提升检索准确性 | “这玩意儿好用吗?” → “这款产品用户体验如何?” |
| 对话历史融合(History Integration) | 整合上下文信息,解决对话中的指代问题,明确检索对象 | 历史:“特斯拉 Model Y” 问:“续航多少?” → “特斯拉 Model Y 续航多少?” |
| | 将复杂的多跳问题拆解为多个简单的单跳问题,分步检索后整合结果 | “比较 A 和 B 的优缺点” → 分别检索 A 的优点、A 的缺点、B 的优点、B 的缺点 |
| | 先生成假设性回答,再通过其向量检索相似的真实文档,优化检索相关性 | “光合作用的过程?” → 生成回答 → 向量化检索相似真实文档 |
| | 提取问题中的实体、类别、属性等关键信息,用于结构化过滤检索结果 | “找一部科幻类、诺兰导演的电影” → 过滤 genre = 科幻,director = 诺兰 |
| | 用不同句式或表达方式重述问题,保持语义不变的同时优化检索适配性 | “怎么安装 Python?” → “Python 的安装步骤是什么?” |