返回顶部
热门问答 更多热门问答
技术文章 更多技术文章

RichRAG框架:为用户提供丰富全面且令人满意的回答

[复制链接]
链载Ai 显示全部楼层 发表于 4 小时前 |阅读模式 打印 上一主题 下一主题
检索增强型生成(RAG)使LLMs能够利用检索到的可靠信息,从而返回更可靠的响应。现有研究主要关注需要简洁明确答案的特定问题,但用户意图通常是复杂和多方面的,需要丰富和全面的答案
一个多方面查询需要全面回答的情境示例

为了解决这一重要但未被充分探索的问题,提出了一种名为RichRAG的新型RAG框架:
  • 子方面探索器:识别输入问题潜在的子方面。
  • 多方面检索器:构建与这些子方面相关的多样化外部文档候选池。
  • 生成式列表智能排序器:关键模块,为最终生成器提供最有价值的文档排名列表。
RichRAG的整体框架。在底部描述了排名器的训练阶段

ingFang SC", miui, "Hiragino Sans GB", "Microsoft Yahei", sans-serif;font-size: 14px;letter-spacing: 0.5px;text-align: start;text-wrap: wrap;background-color: rgb(49, 49, 58);margin-bottom: 8px;">1 问题定义
在基本的RAG设置中,包含知识库C、固定检索器R和作为生成器的固定LLM G。对于多方面的问题q,其下属的各个方面表示为S={s1, ..., sn},这些子方面有相应的子回答A={a1, ..., an}。目标是使RichRAG生成的回答r不仅与真实回答匹配,而且全面覆盖各个子回答,确保回答的丰富性和完整性。
2 子方面探索器
利用LLM构建子方面探索器E,预测输入查询的子方面。该模块输入提示pse和用户查询q,生成一系列子方面。
3 多方面检索器
根据查询的子方面,使用多方面检索器收集与各种子方面相关的文档,构建多样化的候选文档池。这包括针对每个子方面检索文档的过程和合并检索到的文档以创建候选池。
4 生成式列表智能排序器
为了从候选池中筛选出最有价值的文档,设计了一个基于生成模型的排名模型。该模型输入用户查询、识别的子方面和所有候选项,直接生成顶级文档ID的排名列表。排名器采用两阶段优化:监督式微调和强化学习。
4.1 监督式微调
使用贪婪算法构建银牌目标排名列表,支持排名器的监督式微调。通过覆盖效用函数,测量每个剩余文档的增量方面覆盖增益。
4.2 强化学习
使用强化学习策略探索更好的排名可能性,以最终回答的质量作为排名列表的奖励,采用直接偏好优化(DPO)算法优化排名器,并引入单边重要性采样策略(US3)构建有价值的训练样本。

在两个公开可用的数据集上进行的实验结果证明,RichRAG框架能够有效地为用户提供全面且令人满意的回答。
所有模型的总体结果。最佳和次佳结果分别用粗体和下划线标出

不同子方面数量的子集实验,RichRAG框架在所有子集上都优于所有基线,框架在多样化搜索场景中的鲁棒性

Prompt模板:标注问题方面,并将长答案拆分成相应的子答案
Yourtaskistoadjusttheresultsofquery-facetsmining.Thequery-facetsareextensionsoftheoriginalqueryinvariousgenericperspectives,ratherthansomespecificfacts.Givenaquerythatrequiresinformationfrommultiplequery-facets,youshouldreturnallquery-facetsofthequerytofullyansweritquery.Notethateachqueryhasatleasttwoquery-facets.Iwillgiveyouthelong-formanswertotheoriginalquerytohelpyouexplorequery-facetsbasedontheperspectivesofitsanswer.Butrefrainfromusingtheadditionalinformationfromtheanswertogeneratethequery-facets.Thenyoushouldsegmenttheoriginallong-formanswerintoseveralsub-answersthateacharepairedwithaquery-facet.Pleasereturneachquery-facetoftheoriginalqueryanditscorrespondingsub-answers.Thequery-facetsandsub-answersshouldbeone-to-oneandreturnedinJSONformat.Youneedtofollowthefollowingrules:1.Theanswersareonlyusedtohelpyoudeterminethegenericdirection.Youmustn’tgeneratequery-facetsbasedonthecontentsofanswersandthefacetsmustn’tcontaintheanswers’additionalinformationbeyondtheinputquery.2.Sub-answersareconstructedbysegmentingtheoriginalanswer,youcannotgenerateorreordertheoriginalanswertocreatesub-answers.3.Thesub-answersshouldbecomplete.Youmustensurethatwhenthesub-answersarejoinedtogetherinorder,thecompleteoriginalanswershouldbeformed.4.Thegeneratedquery-facetsshouldbesufficientlygenericandcontainnospecificinformationaboutthesub-answers.5.**Youshouldensurethatgeneratedquery-facetscoverallperspectivesoriginalanswer.**6.**Youshouldensurethatallsub-answerscoverallcontentsoftheoriginalanswer.**7.**Thenumberofquerysurfacesmustrangefrom2to7.**8.**Youshouldensurethateachquery-facetissufficientlygenericandcanbeeasilyderivedfromtheoriginalquery.**9.**Youshouldensureeachquery-facetcontainsnoinformationfromtheanswer.**10.**Youshouldrewriteorcombinethequery-facetstobemoregenericifsomequery-facetsdonotmeettheaboverequirements.**11.ThereturnedresultsshouldbeinJSONformatandcontainthefollowingkey:results,whichisalistofJSONdata.Eachitemofresultsshouldcontainthefollowingkeys:query-facet,andsub-answer.12.Iwillgiveyousomedemonstrations,youshouldlearnthepatternofthemtominequery-facetsandsplitsub-answers.**Demonstration**{demonstrations}Query:{query}Answer:{answer}Results:

对于RAG整个框架的更多技术,PaperAgent团队RAG专栏进行过详细的归纳总结:高级RAG之36技(术)。

高级RAG之36技试看私信获取:RAG专栏RichRAG:CraftingRichResponsesforMulti-facetedQueriesinRetrieval-AugmentedGenerationhttps://arxiv.org/pdf/2406.12566

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

链载AI是专业的生成式人工智能教程平台。提供Stable Diffusion、Midjourney AI绘画教程,Suno AI音乐生成指南,以及Runway、Pika等AI视频制作与动画生成实战案例。从提示词编写到参数调整,手把手助您从入门到精通。
  • 官方手机版

  • 微信公众号

  • 商务合作

  • Powered by Discuz! X3.5 | Copyright © 2025-2025. | 链载Ai
  • 桂ICP备2024021734号 | 营业执照 | |广西笔趣文化传媒有限公司|| QQ