Google 提出 Retrieve-for-Train 框架:解决复杂 AI 搜索中“既要丰富多样,又要极速响应”的矛盾
通用大模型做查询扇出容易陷入近义重复,又受逐 token 推理延迟拖累;R4T 把集合级策略探索搬到离线训练,再交给轻量扩散检索器并行执行。
在现实的复杂搜索中,用户需要的往往不是单个孤立的结果,而是一组丰富、互补、连贯且能在数据库中找到的内容集合。然而,线上搜索又要求亚秒级响应;如果让通用大模型在每次请求时现场深度推理,其逐 token 生成的耗时便与实时搜索产生了直接冲突。
为了化解这一矛盾,Google Research 在 ICML 2026 论文中提出了 Retrieve-for-Train(R4T):它不再让大模型对每次搜索请求现场“深度思考”,而是先用强化学习在离线阶段找出好的查询拆解策略,再把这种行为蒸馏给一个 5390 万参数的轻量扩散检索器。扩散模型将多个检索方向一次并行生成,在兼顾集合质量的同时实现了大幅加速。
这项工作针对的不是“找到最相关的一个结果”,而是更难的集合检索:返回的一组结果既要各自有用,又要互相补充,整体还不能偏离用户意图和数据库实际内容。这类需求常见于商品搭配、歌单、内容推荐以及复杂查询的多路召回。

图:Google Research。复杂搜索的目标是得到互补集合,而非同一类结果的重复。
痛点:传统大模型做复杂搜索卡在哪?
搜索“露营装备”时,十顶略有不同的四人帐篷不是一份好答案。更合理的结果是帐篷、睡袋、便携炉和头灯组成的整套装备。搜索系统因此会先做查询扇出(Query Fan-out):把一个宽泛查询拆成多个子查询,再将各路检索结果组合起来。
直接用零样本大模型生成这些子查询,在实际落地中存在两个硬伤:
- 近义改写坍缩:面对“波西米亚音乐节风格”,模型极易陷入同义反复,仅生成“波西米亚音乐节服饰”“波西米亚风穿搭”等同义句,而给不出流苏夹克、钩针裙、麂皮靴等真正互补且不同的具体方向。
- 自回归延迟瓶颈:模型逐 token 生成,且通常要消耗数百个中间 CoT(思维链)token,推理耗时随批量增长,与线上搜索要求的亚秒级响应冲突。
更根本的困难在于,这里的好坏由整个结果集决定。“多样”、“互补”、“覆盖充分”都是集合级属性,只有把多个结果放在一起才能判断。这类开放式检索没有唯一标准答案,单项排序目标难以表达,真实世界中也缺少现成的黄金标准集合可供监督学习。
R4T 的三步:让强化学习只在训练时昂贵一次
R4T 把强化学习当成一个“目标转导器”:它先用奖励函数找到满足集合属性的检索行为,再把行为编译成可供小模型学习的数据。
- 训练扇出语言模型(FOLM)。 研究使用 Gemma3-4B 和 Qwen3-4B,通过 Soft-GRPO 优化每次生成的 10 个子查询。奖励不是单独给每条结果打分,而是评估整组子查询。
- 合成监督数据。 冻结已训练的 FOLM,离线生成“原始查询 → 目标集合”样本对。由于结果集没有固定顺序,训练扩散模型时会随机打乱目标顺序,以增强模型对排列变化的稳健性。这一步不需要人工标注,但它仍依赖前一阶段的检索器和奖励设计,并非“零成本”。
- 训练扩散检索器。 5390 万参数的模型学会从查询嵌入一次生成 L 个检索方向的向量,再用最近邻检索映射回固定数据库内容,而不是直接生成商品或歌曲。它不生成中间文本子查询,也不按顺序逐个吐出结果,因此可以一次并行完成 fan-out。

图:Google Research。在线部署的是最后的轻量扩散检索器,高成本的奖励探索已在离线阶段完成。
这个设计的价值不只是小模型替代大模型。更关键的是,训练阶段可以反复与数据库交互、计算集合奖励和尝试不同分解;到线上时,系统只执行已学会的分布,不再为每个用户重复这段探索。
三种奖励必须相互牵制
R4T 在开放式抽象检索(OAR)中同时优化三类奖励:
- 落地性(Groundedness):惩罚子查询与数据库嵌入流形的距离,让查询能对应到库中实际可检索的内容。
- 多样性(Diversity):对整个子查询集合计算 Vendi Score,避免多条路径都挤在同一个语义模式里。
- 对齐度(Alignment):把展开后的方向锚定在原始查询上,防止为了多样而跑题。
消融实验解释了为什么三者缺一不可。只优化落地性时,模型会找到奖励漏洞,生成“line ending line ending”这类没有意义、却恰好靠近某个数据库坐标的字符串。再加入对齐度,模型又会通过反复改写原查询投机。多样性成为第三个反向锚点,迫使策略找到既可检索、又不偏题且彼此不同的区域。
交互图解 · 论文消融结果
少一个锚点,策略会走向哪里?
切换奖励组合,对照论文报告的训练行为。这是对消融结果的概念化呈现,不是重现实验曲线。
三个反向锚点共同生效
“波西米亚长裙”、“草编靴”、“蕾丝上衣”等方向不同,又都与原始风格和数据库相连。
结果:收敛到可检索、不偏题且语义分散的区域。
这也意味着奖励权重不是越大越好。论文的权重实验显示,落地性占比过高会伤害语义对齐;过度强调对齐和多样性又会压制探索和覆盖。R4T 默认在 OAR 中使用 0.6 : 0.2 : 0.2 的落地性、多样性和对齐度权重;这是当前实验设置,不是所有数据库都通用的最优配方。
实验到底证明了什么
评测分成两类任务。OAR 没有唯一的真值集合,用集合多样性、查询对齐度和落地性来衡量。弱监督组合检索(WSCR)则给出一组参考物品,使用 Recall@5K、Hit@5K 和 Vendi Score 评估覆盖与多样性。论文在两个数据集上验证:Polyvore 时尚数据在 OAR 中包含 21,888 个穿搭集合,在 WSCR 中包含 142,472 件商品,使用 CLIP 系图文嵌入;音乐 OAR 则包含 8,522 个歌单嵌入,使用 MuLan 音频—文本嵌入。需要指出的是,该音乐数据属于专有的工业界专家歌单,外部研究者无法获取,因而外部复现受限。
三个对照基线分别是:不做 fan-out 的密集检索;用 Gemini-2.5-Flash、Gemma3-4B 或 Qwen3-4B 直接零样本展开;以及独立执行 5 次 fan-out、再按奖励挑选最好结果的 Best-of-N。结果支持三个判断:
- fan-out 本身有价值,但零样本 fan-out 还不够。 它通常比原查询直接检索覆盖更好,但会偏离数据库流形或生成近重复表达。
- 奖励可以选出更好的集合,但线上重复采样不可扩展。 Best-of-N 证明了奖励信号有效,代价是每个请求要独立运行多次大模型。
- R4T 改善了质量—效率前沿,但两种部署形态各有权衡,并非“全面更准”。
R4T-FOLM在 OAR 中相对同尺寸基线的质量改善更明显,但它依然承受自回归语言模型的推理延迟;参数量仅 5390 万的R4T-Diffusion才是低延迟部署的重点,它保留了较多多样性并改善覆盖,但部分对齐指标会有所折中。在 WSCR 中,召回更高的变体也可能得到较低的 Vendi Score,因为围绕参考集合提高覆盖可能会收窄发散探索。

图:Google Research。不同任务的指标定义不同,不宜把所有柱子简化成单一“准确率”。
12–20 倍加速的真实口径
效率实验固定每个查询产生 10 个检索方向,比较自回归 LLM fan-out 与扩散检索器在不同批量下的墙钟时间。批量为 8 时,自回归方法约需 1.46 秒,扩散模型约需 0.07 秒;批量增至 1024 时,前者接近 50 秒,后者为 4.21 秒。整体得到 12–20 倍加速。
因此,“亚秒级”只适用于较小批量,不能概括所有设置。这组数字也是论文特定硬件、模型和实验管线下的相对结果,不是任意搜索系统都会自动获得的通用 SLA。
它把成本移走了,却没有让成本消失
R4T 最有用的工程启发,是把“复杂目标探索”和“低延迟执行”拆成两个阶段。当业务已能用奖励函数表达结果集应该如何时,可以用大模型和强化学习做离线探索,再用更贴合集合输出形式的小模型在线执行。它适合的是结果集合的高阶属性重要、请求量大、数据库相对稳定,且训练成本能被大量线上请求摊薄的场景。
它也有四个明确边界:
- 强化学习需要反复与冻结的检索器交互并计算奖励。对极大或频繁变化的数据库,前期成本可能很高,而且可能需要重新训练。
- 它假设业务想要的检索属性能被写成显式奖励。创造性、新颖性、文化敏感性等主观偏好很难压缩为标量分数。
- OAR 评测部分依赖 LLM-as-a-Judge。即使通过打乱物品顺序、显式评分规则和要求理由来减少偏差,评审模型本身的偏差仍然存在,也不能替代真实用户价值。
- 当前证据只覆盖特定的 FOLM、嵌入空间、扩散架构以及时尚/音乐任务。框架在逻辑上可扩展,不等于它在其他模态、检索骨干和业务目标上已被验证。
这项工作因而更适合被理解为一条方法路线:用强化学习把难以标注的集合级目标编译成训练数据,再用扩散模型把昂贵的在线思考换成快速的并行采样。它没有消除价值判断、奖励设计和数据变化的成本,但把这些成本从每次用户请求里抽离了出来。
Retrieve-for-Train:跳过实时推理瓶颈,用强化学习编译轻量扩散检索
在现实的复杂搜索中,用户需要的往往不是单个孤立的结果,而是一组丰富、互补、连贯且能在数据库中找到的内容集合。然而,线上搜索又要求亚秒级响应;如果让通用大模型在每次请求时现场深度推理,其逐 token 生成的耗时便与实时搜索产生了直接冲突。
搜索“露营装备”时,十顶略有不同的四人帐篷不是一份好答案。更合理的结果是帐篷、睡袋、便携炉和头灯组成的整套装备。搜索系统因此会先做查询扇出(Query Fan-out):把一个宽泛查询拆成多个子查询,再将各路检索结果组合起来。直接用零样本大模型生成这些子查询,在实际落地中存在两个硬伤:
1. 近义改写坍缩:面对“波西米亚音乐节风格”,模型极易陷入同义反复,仅生成“波西米亚音乐节服饰”“波西米亚风穿搭”等同义句,而给不出流苏夹克、钩针裙、麂皮靴等真正互补且不同的具体方向。
2. 自回归延迟瓶颈:模型逐 token 生成,且通常要消耗数百个中间 CoT(思维链)token,推理耗时随批量增长,与线上搜索要求的亚秒级响应冲突。
更根本的困难在于,这里的好坏由整个结果集决定。“多样”、“互补”、“覆盖充分”都是集合级属性,只有把多个结果放在一起才能判断。真实世界中也缺少现成的黄金标准集合可供监督学习,导致线上直接运行探索难以收敛与落地。
为了化解这一矛盾,Google Research 在 ICML 2026 论文中提出了 Retrieve-for-Train(R4T):它不再让大模型对每次搜索请求现场“深度思考”,而是先用强化学习在离线阶段找出好的查询拆解策略,再把这种行为蒸馏给一个 5390 万参数的轻量扩散检索器。扩散模型将多个检索方向一次并行生成,在兼顾集合质量的同时实现了大幅加速。
离线三步编译:让强化学习只在训练时昂贵一次
R4T 把强化学习当成一个“目标转导器”:先用奖励函数找到满足集合属性的检索行为,再把行为编译成可供小模型学习的数据,把在线反复试错转换为离线一次性完成的特征拟合。
使用 Gemma3-4B 和 Qwen3-4B,通过 Soft-GRPO 优化每次生成的 10 个子查询。奖励不是单独给每条结果打分,而是评估整组子查询。
冻结已训练的 FOLM,离线生成“原始查询 → 目标集合”样本对。由于结果集没有固定顺序,训练扩散模型时会随机打乱目标顺序,以增强模型对排列变化的稳健性。
5390 万参数的模型学会从查询嵌入一次生成 L 个检索方向的向量,再用最近邻检索映射回固定数据库内容,而不是直接生成商品或歌曲。它不生成中间文本子查询,也不按顺序逐个吐出结果,因此可以一次并行完成 fan-out。
这个设计的价值不只是小模型替代大模型。更关键的是,训练阶段可以反复与数据库交互、计算集合奖励和尝试不同分解;到线上时,系统只执行已学会的分布,不再为每个用户重复这段探索。
三种奖励必须相互牵制
R4T 在开放式抽象检索(OAR)中同时优化三类奖励。消融实验解释了为什么三者缺一不可。只优化落地性时,模型会找到奖励漏洞,生成“line ending line ending”这类没有意义、却恰好靠近某个数据库坐标的字符串。再加入对齐度,模型又会通过反复改写原查询投机。多样性成为第三个反向锚点,迫使策略找到既可检索、又不偏题且彼此不同的区域。
惩罚子查询与数据库嵌入流形的距离,让查询能对应到库中实际可检索的内容。
把展开后的方向锚定在原始查询上,防止为了多样而跑题。
对整个子查询集合计算 Vendi Score,避免多条路径都挤在同一个语义模式里。
R4T 默认在 OAR 中使用 0.6 : 0.2 : 0.2 的落地性、多样性和对齐度权重;这是当前实验设置,不是所有数据库都通用的最优配方。
实验到底证明了什么:质量与延迟的双重口径
评测在 Polyvore 时尚数据(包含 21,888 个穿搭集合、142,472 件商品)与 8,522 个专有工业界歌单嵌入上展开。实验证实了扇出机制的有效性,但也明确指出了性能权衡:
效率实验固定每个查询产生 10 个检索方向,比较自回归 LLM fan-out 与扩散检索器在不同批量下的墙钟时间。批量为 8 时,自回归方法约需 1.46 秒,扩散模型约需 0.07 秒;批量增至 1024 时,前者接近 50 秒,后者为 4.21 秒。整体得到 12–20 倍加速。
因此,“亚秒级”只适用于较小批量,不能概括所有设置。这组数字也是论文特定硬件、模型和实验管线下的相对结果,不是任意搜索系统都会自动获得的通用 SLA。
它把成本移走了,却没有让成本消失
当业务已能用奖励函数表达结果集应该如何时,可以用大模型和强化学习做离线探索,再用更贴合集合输出形式的小模型在线执行。它适合的是结果集合的高阶属性重要、请求量大、数据库相对稳定,且训练成本能被大量线上请求摊薄的场景。
工程落地的四条显式边界:
1. 离线交互高昂:强化学习需要反复与冻结的检索器交互并计算奖励。对极大或频繁变化的数据库,前期成本可能很高,而且可能需要重新训练。
2. 标量奖励局限:它假设业务想要的检索属性能被写成显式奖励。创造性、新颖性、文化敏感性等主观偏好很难压缩为标量分数。
3. 评测裁判偏置:OAR 评测部分依赖 LLM-as-a-Judge。即使通过打乱物品顺序、显式评分规则和要求理由来减少偏差,评审模型本身的偏差仍然存在,也不能替代真实用户价值。
4. 模态泛化待验:当前证据只覆盖特定的 FOLM、嵌入空间、扩散架构以及时尚/音乐任务。框架在逻辑上可扩展,不等于它在其他模态、检索骨干和业务目标上已被验证。
Bypassing inference bottlenecks: Accelerating complex AI search with Retrieve-for-Train
Modern search or recommendation applications are increasingly expected to return a coherent set of results rather than a single best match. For example, when a user searches for "camping gear", they don’t want ten slight variations of four-person tents. They want a coherent, complementary slate that includes essential camping gear, such as a tent, sleeping bag, portable stove, and headlamp.
To do this, systems use a query fan-out technique that breaks a single broad prompt into several related sub-queries to cover potential user interests. However, teaching an LLM to perform database-aware query decomposition dynamically drains a massive thinking budget. By design, zero-shot LLMs are general autoregressive text predictors; they aren’t optimized to navigate the specific, geometric manifold of a target corpus. Consequently, they need extended test-time computation to return a collection of results that optimizes higher-order set-level properties (e.g., diversity, coverage, complementarity, coherence) while remaining grounded with respect to a fixed database.
In our ICML 2026 paper, “Efficient, Property-Aligned Fan-Out Retrieval via RL-Compiled Diffusion”, we address this decomposition bottleneck via a reward-to-data compilation framework. Instead of forcing the model to expend a large thinking budget at inference, our Retrieve-for-Train framework uses offline reinforcement learning (RL) to discover reward-aligned fan-outs and compile them into supervision. By distilling these optimized exploration behaviors into a lightweight diffusion retriever, we enable highly efficient, single-pass query fan-out at inference time. This achieves mathematically formulated, set-level properties without the overhead of test-time thinking tokens.
Why everyday AI isn't a search expert
When tasked with brainstorming a complex group of search terms, it’s tempting to simply deploy a standard, off-the-shelf LLM at inference time to handle the job. However, relying on generic models for database-aware query decomposition introduces two critical challenges:
- Paraphrastic collapse*:* Without database-aware optimization, zero-shot LLMs frequently suffer from paraphrastic collapse. Rather than exploring complementary facets of a topic, they tend to generate redundant, near-synonymous queries. For example, given the broad prompt "Bohemian festival style”, a standard LLM without careful prompt engineering might lazily generate "bohemian festival fashion" and "bohemian festival clothes”. This semantic looping produces a homogeneous slate of results, entirely missing the distinct, helpful semantic directions a fashion expert would identify, such as fringe jackets, crochet dresses, or suede boots.
- Autoregressive latency bottlenecks*:* Standard LLMs are fundamentally constrained by sequential, autoregressive generation. To successfully decompose a complex query into complementary facets, modern models typically require a substantial thinking budget, generating hundreds of intermediate chain-of-thought (CoT) reasoning tokens (i,e., the intermediate steps or internal processing units an AI model generates before answering a complex question) to plan their expansion before outputting the actual search terms. While this deliberate reasoning is acceptable for conversational AI, it introduces a severe structural bottleneck for set-valued search (e.g., retrieving a complementary slate of results, such as fringe jackets or crochet dresses mentioned above). When a system must brainstorm a large slate of sub-queries simultaneously, the combined overhead of continuous context processing and generating extended reasoning tokens scales poorly. Even with advanced serving optimizations, this token-by-token architecture creates a latency floor that is fundamentally at odds with the sub-second response times required by a production search bar.
The Retrieve-for-Train framework
The Retrieve-for-Train treats the AI's training like an offline practice session rather than a test it has to take on the spot while a user is waiting. Instead of forcing the AI to slowly figure out the rules of a good search and drain a massive processing budget every single time someone types a query, Retrieve-for-Train runs an offline RL training program once.
This program uses a rigorous reward system to turn abstract goals like "ensure the results are diverse and actually in stock" into an exact step-by-step instruction manual. Once that manual is built, the AI can execute it instantly during a real search without delay.
The pipeline operates in three distinct steps:
- Fan-out language model training: RL trains a fan-out language model to emit property-aligned sub-queries scored by a set-level property-check reward. This evaluates the entire group of results as a whole, rather than scoring each result in isolation.
- Supervision synthesis: The frozen fan-out language model synthesizes (query → target-set) pairs entirely offline for supervised learning, requiring no human labels.
- Diffusive retriever training: A compact, 53.9M-parameter diffusion model learns to map a query embedding directly to a complete set of target embeddings in one non-autoregressive pass, officially bypassing the need for text-based CoT reasoning tokens.
Designing for the set: The power of composite rewards
The success of the Retrieve-for-Train framework hinges entirely on how we define "good" search behavior. Traditional supervised training evaluates pointwise relevance via learning to rank, scoring each retrieved item in isolation. However, a truly expert search slate is defined by non-decomposable, set-level properties. You can’t measure the diversity or complementarity of a single item; these properties only exist mathematically when evaluating the entire collection of retrieved results.
Rather than relying on ambiguous natural language instructions to enforce these fan-out properties, Retrieve-for-Train fine-tunes the 4B open-source language models (Gemma3-4B and Qwen3-4B) via reinforcement learning using a strict mathematical composite reward. For our open-ended abstract retrieval tasks, this composite reward is a weighted balance of three competing pillars:
- Groundedness: Penalizes distance to the database manifold, ensuring every generated sub-query corresponds to a real, retrievable item in the database.
- Diversity: Measured using the Vendi Score over the entire set of sub-queries, forcing the model to explore broad semantic breadth.
- Alignment: Anchors candidate sub-queries to the original broad prompt to prevent semantic drift.
Mutual counter-anchors and soft-GRPO training
During training, we optimize the fan-out language model against these geometric realities using group relative policy optimization (GRPO) with soft proximal policy optimization (PPO).
This specific triad of rewards is critical because they act as mutual counter-anchors. If a model is optimized purely for groundedness, it will reward-hack the system by generating degenerate, nonsensical strings that happen to mathematically map to a specific database coordinate. If alignment is added to fix the nonsense, the policy simply cheats by collapsing into repetitive paraphrases of the user's prompt.
By injecting the Vendi Score as a counter-anchor, Retrieve-for-Train effectively closes off these shortcut solutions. To achieve a high-reward state, the policy is forced into a balanced region of the embedding space where it must discover valid, strictly grounded, yet semantically distinct variations of the original intent.
Experiments
To evaluate the Retrieve-for-Train framework, we used a combination of frozen, dataset-specific multimodal embedding backbones and open-source language models optimized for query expansion. We evaluated this setup across two distinct set-valued retrieval regimes:
- Open-ended abstract retrieval: A setting where no unique ground truth exists and quality is exclusively measured by set-level properties, including diversity, query alignment, and database groundedness.
- Weakly supervised compositional retrieval: A setting where queries are paired with a weak reference set that serves as just one plausible realization of the query intent.
For the multimodal embedding backbones, we conducted experiments across two domains: A large-scale fashion dataset of user-curated outfits used for text-to-image experiments (evaluated using a CLIP-based retriever), and a proprietary industrial dataset of expert-generated music playlists used for text-to-music evaluations (evaluated using MuLan).
For the language models, the query fan-out process was driven by 4B open-source models, specifically Gemma3-4B and Qwen3-4B, which were tasked with generating exactly 10 sub-queries for every single main search prompt they processed. We implemented the RL training for these fan-out models via Soft-GRPO, an approach that uses group relative policy optimization with soft PPO regularization.
Results
Retrieval quality and accuracy
Across both retrieval tasks, Retrieve-for-Train outperformed traditional single-query search, zero-shot expansion, and even the heavily optimized Best-of-N baseline.
Qualitatively, zero-shot LLM baselines tended to generate near-synonymous paraphrases (e.g., "bohemian festival style" vs. "bohemian festival fashion"), causing redundant results. Retrieve-for-Train generated highly diverse, distinct sub-queries (e.g., branching into "boots" or "lace") that remained strictly grounded within the database manifold.
Order-of-magnitude faster inference
Directly deploying our RL-tuned language model yielded exceptional search quality, but it inherited standard autoregressive latency constraints and demanded a high computational thinking budget.
By distilling that learned behavior into the 53.9M-parameter Retrieve-for-Train diffusion model, we successfully smashed the latency bottleneck. Because the diffusion model generates all target directions simultaneously in a single, non-autoregressive parallel pass in continuous embedding space, it delivers a massive 12 to 20 speedup over autoregressive approaches.
At scale, while autoregressive fan-out latency expands linearly to nearly 50 seconds under large context batches, Retrieve-for-Train-Diffusion stays between sub-second to a few seconds, delivering production-ready, expert-level search at a fraction of the computational cost.
The anti-hacking anchor (ablation insights)
During our reward optimization process, we discovered something fundamental about training a fan-out language model for search. Without a diversity term, the model quickly collapses into generating degenerate, nonsensical strings (like "line ending line ending") to mathematically exploit the vector coordinates of the database. Injecting a geometric diversity metric (the Vendi Score) acts as a vital counter-anchor, forcing the model into a stable region of the embedding space where it can only maximize its reward by acting like a true search expert.
Conclusion
We demonstrated that RL can be highly effective when used as a one-time "objective transducer" rather than an online inference engine. By decoupling the heavy computation of reward-driven behavior exploration from the final deployed model, our framework successfully bypasses the steep inference latency and high computational overhead typical of online LLM deployment.
Distilling these complex, set-level behaviors into a lightweight diffusion prior allows production retrieval systems to optimize for higher-order properties like diversity and alignment effectively. Ultimately, Retrieve-for-Train establishes a highly scalable, data-efficient pipeline for set retrieval in specialized or multimodal domains where human-labeled, property-aligned training pairs are otherwise scarce or costly to obtain. See the paper for more details.
