热门搜索:和平精英 原神 街篮2 

您的位置:首页 > > 教程攻略 > ai资讯 >RAG 2.0谷歌RICHES:边检索、边思考、边生成

RAG 2.0谷歌RICHES:边检索、边思考、边生成

来源:互联网 更新时间:2026-08-20 14:44

先说说RAG技术这几年走过的路。早期的RAG系统,从检索器到生成器,每个模块单看都不错,但拼到一起效果就大打折扣——问题出在系统层面缺乏整体优化。Contextual.ai提出的RAG 2.0正是为了解决这个痛点,它将预训练、微调和对齐作为一个

单一的集成系统

来端到端训练,让大模型和检索器能够协同优化,最终达到1+1>2的效果。

而就在这个方向上,

Google DeepMind

带来了一个更具碘伏性的思路——

RICHES

(Retrieval Interlaced with Sequence Generation)。简单直白地说,它把检索和生成这两个过程揉进了一个单一的LLM和解码流程里。

不需要单独的检索器和生成器

,模型直接在解码过程中生成文档内容或对应的自然语言

检索键

,就能完成检索。而且无需额外训练,通过调整提示就能适应各种新任务。

RAG 2.0谷歌RICHES:边检索、边思考、边生成

上面这张图展示了RICHES在处理

多跳查询

时的输出示例——绿色标注的文本就是模型从语料库中“检索”或逐字生成的内容。可以看到,思考和检索证据在生成过程中是自然地交织在一起的。

把整个工作流程拆解来看,其实并不复杂:

  1. 选择一个合适的预训练LLM作为起点。

  2. 定义好检索键的格式,比如用文档标题、段落、句子或命题。

  3. 用FM-Index等技术为语料库建索引,提升检索效率。

  4. 接收用户输入的问题。

  5. LLM交替进行自由文本生成和受限的检索键生成。

  6. 生成过程中,利用索引对检索键施加约束,确保每个键都能对应到语料库中的有效文档。

  7. 根据生成的检索键,从语料库中拉取相关文档。

  8. 将检索内容与已生成的文本整合,输出最终答案。

  9. 用F1、AutoAIS等指标评估效果。

  10. 根据评估结果继续迭代优化。

再来看看它的核心原理,有几个关键设计值得关注:

检索与生成的深度融合。

RICHES通过直接解码文档内容或相关的自然语言检索键来完成检索,这些检索键指向生成它们的文档。这样一来,检索和生成在同一个解码过程中完成,不再需要两个独立的模块。

检索键的定义也很巧妙。

每个检索键被定义为预定义有限序列集K中的一个标记序列,每个条目与语料库C中的文档关联。输出序列中用特殊标记《和»来标识检索键的起止位置。

概率模型的更新。

通过引入指示函数1K(q),标准自回归语言建模的概率被改写为包含检索键的约束模型。简单说,就是通过零化不符合约束的序列,实现约束解码。

约束束解码是核心引擎。

采用束搜索策略,在每个时间步,LLM评估每个节点的概率,并维护一个固定大小的候选束。下图展示了对查询“马拉松何时更名为士力架?”的约束束搜索过程,最终输出“马拉松在1990年更名为士力架”。加粗框是最终序列的演进路径,灰色划掉的则是模型偏好但被语料库约束阻止的序列。

FM-Index实现高效约束。

这是一套压缩后缀数组结构,能够支持快速的子串搜索,保证输出序列确实存在于语料库中。

自适应束大小。

根据约束序列和非约束序列的不同需求,动态调整束的大小:约束序列需要精确匹配检索键,而非约束序列则更灵活。

多种索引策略。

FM-Index支持高效索引所有子串,但文档表示方式的选择对检索效果影响很大。RICHES支持标题、段落子串、句子子串和命题四种索引策略。

效果怎么样?从公开的实验数据来看,RICHES在开放领域问答(

归因问答、多跳问答和检索思考

)任务上表现相当抢眼。特别是在

多跳问答任务

(Hotpot)上,它通过单一解码过程就能实现比传统RAG方法更准确的答案生成。

性能对比表格

从上图可以看出,RICHES在综合性能上明显优于密集检索方案。在单跳问答任务上也有优势,但它真正的杀手锏还是在于多跳场景——不需要迭代多次检索,一次解码就能完成。

单跳对比

再来看一个迭代检索的具体输出示例,备注部分已经用(# 评论)做了注释,能更直观地看到模型是如何一步步完成推理的。

迭代检索示例

另外,不同索引策略和束大小的影响也值得关注:

命题(Proposition)检索键

在实验中效果最好。

附录

以下是RICHES在少样本提示中使用的模板示例,供参考。

多跳问答的Few-shot Prompt模板

For given input query, write 1-3 passages to answer the query. Write a hint keyword and a passage
contained within « and ». A passage must be a complete sentence and not a phrase. It must contain
complete context for answering the query and should not begin with it, he, they etc. Do not repeat any
passages. Aim for new keywords.

question: The football manager who recruited Cristiano Ronaldo managed Manchester United during
what timeframe?
passage: keyword: Cristiano Ronaldo’s recruiting manager « Alex Ferguson recruited Cristiano Ronaldo »
keyword: Sir Alex Ferguson’s tenure at Manchester United « Sir Alex Ferguson managed Manchester
United from 1986 to 2013. »
answer: 1986 to 2013

question: Were Eatza Pizza and Your Pie founded in the same state?
passage: keyword: Eatza Pizza founded in state « Eatza Pizza was founded in Arizona » keyword: Your
Pie founded in state « Your Pie was founded in Athens, Georgia »
answer: no

question: In which stadium do the teams owned by Myra Kraft’s husband play?
passage: keyword: Myra Kraft’s husband « Robert Kraft’s wife is Myra Kraft. » keyword: Robert Kraft’s
team « Robert Kraft is the owner of the New England Patriots. » keyword: New England Patriots stadium
« Gillette Stadium is the home of the New England Patriots. »
answer: Gillette Stadium

question: 
passage:

单跳问答的Few-shot Prompt模板

For given input query, write 1-3 passages to answer the query. Write a hint keyword and a passage
contained within « and ». A passage must be a complete sentence and not a phrase. It must contain
complete context for answering the query and should not begin with it, he, they etc. Do not repeat any
passages. Aim for new keywords.

question: who is the owner of phoenix mall pune?
passage: keyword: Phoenix Market City owner « Phoenix Market City is developed by Phoenix Mills
Limited. »
answer: Phoenix Mills Limited

question: what brings in more money nba or nfl?
passage: keyword: NFL revenues « NFL revenues are well over $10 billion per season. » keyword: NBA
revenue « NBA amasses about $6 billion annually. »
answer: NFL

question: when was the french national anthem adopted?
passage: keyword: French national anthem « La Marseillaise became the national anthem of France. »
keyword: La Marseillaise adoption « La Marseillaise was adopted by France in 1795. »
answer: 1795

question: question
passage:

从命题中提取答案的Few-shot Prompt模板

Answer the ’question’ only based on the given ’passage’. If the ’passage’ lacks context or is not relevant,
say ’Cannot answer’ else say generate a short answer. Do not answer the query from outside the scope of
the passage.

question: what brings in more money nba or nfl?
passage: NFL revenues are well over $10 billion per season. NBA amasses about $6 billion annually.
answer: NFL

question: when did they put warnings on cigarette packs
passage: Tobacco packaging 1978’s warning was not removed, so now every cigarette pack contains both
warnings (one on each lateral).
answer: Cannot Answer

question: when was the french national anthem adopted?
passage: La Marseillaise became the national anthem of France. La Marseillaise was adopted by France
in 1795.
answer: 1795

question: question
passage: passage
answer:

最后补充一点关于约束解码过程的细节。给定前缀“Joker is played by”,续接词“Nolan”在语料库中未被找到,因此会被模型屏蔽掉。这种对束搜索的精细控制,正是RICHES能准确检索并生成的关键。

https://arxiv.org/pdf/2407.00361
From RAG to RICHES: Retrieval Interlaced with Sequence Generation
Google Deepmind
关于宇宙的好的网名有哪些
关于宇宙的好的网名有哪些

类型:角色扮演

大小:1

语言:简体中文

平台:互联网

游戏下载

热门手游

手机号码测吉凶
本站所有软件,都由网友上传,如有侵犯你的版权,请发邮件haolingcc@hotmail.com 联系删除。 版权所有 Copyright@2012-2013 haoling.cc