# Self-RAG

Self-RAG 是一种面向大语言模型的微调方法，于 2023 年提出。在该方法中，单一模型学会自行决定何时从外部语料库中检索段落，并利用加入其词表的特殊“反思标记”对这些段落及自身生成的文本进行评判。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> 标准的检索增强生成（RAG）为每个查询运行固定流程来检索文档，Self-RAG 模型则不同：它可以在一次生成过程中多次检索、完全跳过检索，并对收到的证据进行评分，而这一切都只是普通的下一词元预测。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | 一种经微调的大语言模型，按需检索并通过反思标记进行自我评判<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> |
| 起源 | 发表于 ICLR 2024<sup>[2](https://research.ibm.com/publications/self-rag-learning-to-retrieve-generate-and-critique-through-self-reflection)</sup> |
| 模型规模 | 7B 和 13B<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup>；已发布官方代码及 selfrag_llama2_* 权重<sup>[6](https://ragexplainedbetter.com/architectures/self-rag/)</sup> |
| 主要结果（作者基准测试） | PopQA 55.8% 对 ChatGPT 的 29.3%；PubHealth 74.5% 对 70.1%<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> |
| 检索消融实验 | 削减检索使 PopQA 相对准确率下降约 40%，而 PubHealth 仅下降约 2%<sup>[4](https://selfrag.github.io/)</sup> |
| 推理成本 | 段级束搜索使成本最高乘以 k；实践者报告 k=3–5 较为实用<sup>[5](https://ashwanijha.dev/blog/self-rag-adaptive-retrieval-what-the-paper-actually-says)</sup> |
| 开箱即用 | 无法通过 GPT-4 或 Claude 等闭源 API 使用；需要已发布的权重或提示词近似方案<sup>[5](https://ashwanijha.dev/blog/self-rag-adaptive-retrieval-what-the-paper-actually-says)</sup> |

## 起源与发表

该方法出自论文《Self-RAG: Learning to Retrieve, Generate, and Critique Through Self-Reflection》，发表于 ICLR 2024。<sup>[2](https://research.ibm.com/publications/self-rag-learning-to-retrieve-generate-and-critique-through-self-reflection)</sup> 作者发布了实现四步训练流程的官方代码：用 GPT-4 生成评判器训练数据，用新的特殊标记训练评判器，利用评判器和检索器生成生成器训练数据，再用这些标记训练生成器。<sup>[3](https://github.com/AkariAsai/self-rag)</sup> 发布的模型为 7B 和 13B 参数版本。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup>

## 机制如何运作

**反思标记**是模型在输出正常文本的同时所生成的特殊词表项。训练流程使用三个模型：检索器、评判器和生成器，其中评判器和生成器在标准的下一词元预测目标下训练。<sup>[4](https://selfrag.github.io/)</sup> 两者都用反思标记扩充了各自的词表。<sup>[3](https://github.com/AkariAsai/self-rag)</sup> 评判器模型在 GPT-4 生成的标签上训练，离线标注训练数据；推理时无需单独托管评判器模型，因为生成器已学会自行生成这些标记。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup>

标记类别如下：

- Retrieve：一种决策标记，结果包括 yes、no 和 continue，其中 continue 表示模型可以利用已有证据继续推进。<sup>[4](https://selfrag.github.io/)</sup>
- ISUSE（IsUseful）：对回答的 5 分制效用评分。<sup>[5](https://ashwanijha.dev/blog/self-rag-adaptive-retrieval-what-the-paper-actually-says)</sup>

由于这些标记是作为下一词元预测习得的，检索决策是训练出来的行为，而非提示词规则。推理时，当模型生成 Retrieve 标记，它会并行处理 K 个检索到的段落，并运行段级束搜索，用期望的评判标记概率的加权线性和为每个候选续写打分。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> 检索频率也可在推理时通过对检索标记概率施加软约束来调节，让用户在检索成本与事实依据之间权衡。<sup>[4](https://selfrag.github.io/)</sup>

## 实测效果

以下所有定量结果均为作者报告；在所审查的来源中未发现对这些数字的独立复现或第三方评估。

在论文的基准测试中，Self-RAG 13B 在 PopQA（开放域问答）上的准确率为 55.8%，而 ChatGPT 为 29.3%；在 PubHealth（事实核查）上为 74.5%，而 ChatGPT 为 70.1%。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> 在长文本生成方面，其传记 FactScore 达到 80.2，而检索增强的 ChatGPT 为 79.9；在 ASQA 上的引用精确率为 70.3，而 ChatGPT 为 65.1。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> 提升并非普遍适用：在 ARC-Challenge 上，Self-RAG 13B 得分为 73.1%，而 ChatGPT 为 75.3%。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> 作者还报告称，7B 和 13B 模型在传记生成上优于同期的 CoVE 方法，后者迭代提示 Llama2-65B。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup>

检索频率消融实验揭示了提升的来源：减少检索使 PopQA 的相对性能下降约 40%，而 PubHealth 仅下降约 2%。<sup>[4](https://selfrag.github.io/)</sup> 开放域问答严重依赖实际检索；事实核查对跳过检索则更为稳健。

## 推理成本与提示词替代方案

Self-RAG 在推理时比“总是检索一次”的 RAG 在多个方面更昂贵。段级束搜索每段有 k 个候选续写，使推理成本最高乘以 k；论文的设置使用 k=10，而实践者报告 k=3–5 对生产工作负载更为实用。<sup>[5](https://ashwanijha.dev/blog/self-rag-adaptive-retrieval-what-the-paper-actually-says)</sup> 为相关性过滤并行评分 K 个检索段落会带来额外成本，而过度加权支持信号可能牺牲流畅度。<sup>[6](https://ragexplainedbetter.com/architectures/self-rag/)</sup>

作者本人测试了反思行为能否通过提示而非训练获得，发现这并非易事：将全部评估指令与少样本演示结合用于 GPT-3 davinci-003/002 和 Llama2-13B-chat，显著增加了输入序列长度、成本和延迟，且模型难以精确遵循评估指令。<sup>[1](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)</sup> 实践中，该方法需要微调，无法用 GPT-4 或 Claude 开箱即用；提示式自我反思无需训练即可提供一定的审计优势，代价是一致性。<sup>[5](https://ashwanijha.dev/blog/self-rag-adaptive-retrieval-what-the-paper-actually-says)</sup>

## 与其他方法的比较

Self-RAG 将检索与评判决策内化到经微调的生成器内部。纠正性 RAG（CRAG；Yan 等，2024，arXiv:2401.15884）是一种相关但不同的方法：它使用外部的轻量级检索评估器，可在生成前触发网络搜索回退及知识条带精炼，而非将评判训练进生成器本身。<sup>[6](https://ragexplainedbetter.com/architectures/self-rag/)</sup> 两种设计适应不同的约束条件：Self-RAG 需要控制模型权重，而 CRAG 可在冻结的生成器上运作。

LangChain 的 [LangGraph](https://www.edgepedia.org/zh/langgraph) 实用指南用结构化二元评分器和状态机边实现了受 Self-RAG 和 CRAG 启发的思路。其作者明确说明了简化之处：从所有相关文档一次性生成，而非论文中的逐块生成，以牺牲 Self-RAG 的部分段级控制换取更少的 LLM 调用。<sup>[6](https://ragexplainedbetter.com/architectures/self-rag/)</sup>

## 采用与实践

采用主要集中于模式而非微调模型。IBM 的教程讲授如何用 LangGraph 和 Granite 模型端到端构建 Self-RAG 智能体，利用由反思标记得出的评判分数指导后续步骤：当分数较低时，智能体请求更强的上下文并检索更相关的文档。<sup>[7](https://www.ibm.com/think/tutorials/build-self-rag-agent-langgraph-granite)</sup> 对于想要原始行为的团队，选项是运行已发布的 selfrag_llama2_* 权重，或在自有的评判器增强数据上重新训练；无法微调的闭源聊天 API 不在该方案范围内，因此实践者用单独的评分器调用来近似控制回路。<sup>[6](https://ragexplainedbetter.com/architectures/self-rag/)</sup>

## References

1. [Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection (ICLR 2024)](https://proceedings.iclr.cc/paper_files/paper/2024/file/25f7be9694d7b32d5cc670927b8091e1-Paper-Conference.pdf)
2. [Self-RAG: Learning to Retrieve, Generate, and Critique Through Self-Reflection for ICLR 2024 - IBM Research](https://research.ibm.com/publications/self-rag-learning-to-retrieve-generate-and-critique-through-self-reflection)
3. [AkariAsai/self-rag (official code repository)](https://github.com/AkariAsai/self-rag)
4. [Self-RAG project page](https://selfrag.github.io/)
5. [Self-RAG: What Adaptive Retrieval Actually Means in Production](https://ashwanijha.dev/blog/self-rag-adaptive-retrieval-what-the-paper-actually-says)
6. [Self-RAG: Letting the Model Critique Its Own Retrieval](https://ragexplainedbetter.com/architectures/self-rag/)
7. [Self-RAG Tutorial | IBM](https://www.ibm.com/think/tutorials/build-self-rag-agent-langgraph-granite)

---
*Initially written Sep 17, 2026 · Edited: Oct 11, 2026; Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 现代人工智能：基础模型、生成式人工智能与人工智能产业 › Foundation-model methods and training › Prompting, reasoning, and agents

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/self-rag

English original: https://www.edgepedia.org/self-rag
