Search-R1:通过强化学习训练大语言模型进行推理并利用搜索引擎

Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning

金博文 Bowen Jin · UIUC · 2025-03-12 · arXiv:2503.09516 ↗ · 被引 1177

打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→

摘要 · Abstract

高效获取外部知识和最新信息对于大语言模型(LLM)的有效推理和文本生成至关重要。在推理过程中提示具有推理能力的高级 LLM 使用搜索引擎往往不是最优的,因为 LLM 可能不完全具备如何与搜索引擎最佳交互的能力。本文介绍了 Search-R1,这是强化学习(RL)在推理框架中的一种扩展,其中 LLM 学会在逐步推理过程中自主生成(多个)搜索查询并进行实时检索。Search-R1 通过多轮搜索交互优化 LLM 推理轨迹,利用检索到的令牌掩码进行稳定的 RL 训练,并采用简单的基于结果的奖励函数。在七个问答数据集上的实验表明,在相同设置下,Search-R1 相比各种 RAG 基线,在 Qwen2.5-7B 上性能提升 41%,在 Qwen2.5-3B 上提升 20%。本文还进一步提供了关于 RL 优化方法、LLM 选择以及检索增强推理中响应长度动态的实证见解。代码和模型检查点可在 https://github.com/PeterGriffinJin/Search-R1 获取。

Efficiently acquiring external knowledge and up-to-date information is essential for effective reasoning and text generation in large language models (LLMs). Prompting advanced LLMs with reasoning capabilities to use search engines during inference is often suboptimal, as the LLM might not fully possess the capability on how to interact optimally with the search engine. This paper introduces Search-R1, an extension of reinforcement learning (RL) for reasoning frameworks where the LLM learns to autonomously generate (multiple) search queries during step-by-step reasoning with real-time retrieval. Search-R1 optimizes LLM reasoning trajectories with multi-turn search interactions, leveraging retrieved token masking for stable RL training and a simple outcome-based reward function. Experiments on seven question-answering datasets show that Search-R1 improves performance by 41% (Qwen2.5-7B) and 20% (Qwen2.5-3B) over various RAG baselines under the same setting. This paper further provides empirical insights into RL optimization methods, LLM choices, and response length dynamics in retrieval-augmented reasoning. The code and model checkpoints are available at https://github.com/PeterGriffinJin/Search-R1.

核心贡献 · Key contributions

局限 · Limitations

论文章节 · Sections(共 20)

阅读逐段中英对照全文 →