---
title: "ReAct Prompting — ReAct 提示法"
source: "https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95"
wiki: "systems-analysis.info/int"
article: "ReAct_Prompting_—_ReAct_提示法"
language: "zh"
categories:
  - "Category:Chinese"
  - "Category:Large language models"
  - "Category:Machine learning"
  - "Category:Prompt engineering"
revision_id: 6203
wiki_created_at: 2026-09-06T23:59:45Z
wiki_modified_at: 2026-09-06T23:59:45Z
downloaded_at: 2026-09-07T23:12:36Z
---

# ReAct Prompting — ReAct 提示法

**ReAct**（**Reason + Act** 的缩写，意为“推理与行动”）是一种为大型语言模型（LLM）设计的提示（prompting）范式，它使模型能够通过交替进行言语推理（思考）和与外部环境互动的行动来解决复杂任务<sup>[\[1\]](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_note-yao2022react-1)</sup>。该方法由**谷歌研究院**（Google Research）和**普林斯顿大学**的研究人员于 2022 年提出，并已成为开发智能体（intelligent agents）的基础方法。

ReAct 的核心创新在于，将思维链（Chain-of-Thought, CoT）等技术中常见的逻辑推理与执行外部行动（如信息搜索或与应用程序接口 API 交互）相结合。这使得模型能够动态调整其计划、核查事实，并克服自身知识（通常是过时或不完整的）的局限性<sup>[\[2\]](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_note-googleblog-react-2)</sup>。

## 背景与创建历史

在 ReAct 出现之前，利用 LLM 解决复杂任务主要存在两种独立的方法：

- **思维链（Chain-of-Thought, CoT）**：模型生成逐步的逻辑推理来解决问题，但这一过程在“信息真空”中进行，完全依赖其内部知识。这常常导致事实错误和“幻觉”<sup>[\[1\]](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_note-yao2022react-1)</sup>。
- **仅行动规划（Act-Only）**：模型生成一系列行动与外部环境互动（例如，在文本游戏中），但缺乏明确的高层规划。这类系统在处理错误时表现不佳，也无法在遇到意外情况时调整策略。

ReAct 的创建旨在协同结合这两种方法的优点。它不仅让模型能够推理，还能将其推理“植根于”（ground）外部世界的事实，并根据收到的反馈调整其行动。

## 工作机制：“思考—行动—观察”循环

ReAct 在一个包含三个关键组件的迭代循环中运行。模型会 последовательно生成一个由**思考（Thought）**、**行动（Action）**和**观察（Observation）**步骤组成的轨迹。

**提示结构示例：**

***问题：以交流电闻名的发明家出生于哪个首都城市？***

***思考 1：** 我需要查明交流电的发明者。然后，找到他的出生地，并核实该城市是否为首都。*

***行动 1：** Search\[交流电发明者\]*

***观察 1：** 交流电（AC）由尼古拉·特斯拉（Nikola Tesla）开发和推广。*

***思考 2：** 现在我需要找出尼古拉·特斯拉的出生地。*

***行动 2：** Search\[尼古拉·特斯拉出生地\]*

***观察 2：** 尼古拉·特斯拉出生于奥地利帝国的斯米连村（现属克罗地亚）。*

***思考 3：** 斯米连不是首都。因此，按此提问方式，问题没有明确答案。然而，特斯拉曾在美国长期生活和工作。也许问题指的是他取得重大发现的国家的首都。这是一个更复杂的问题。我应该陈述基于其出生地的事实。他的出生地不是首都。*

***最终答案：** 与交流电相关的发明家尼古拉·特斯拉出生于斯米连（克罗地亚），该地不是首都。*

### 思考 (Thought)

模型生成内部推理，在其中分析任务、将其分解为子任务、制定或调整行动计划，并评估当前状态。此步骤不影响外部环境，但用于内部规划。

### 行动 (Action)

基于其推理，模型执行一个外部行动，调用一个可用的工具。行动示例：

- Search \[查询\] — 在知识库（如维基百科）中搜索信息。
- Click \[元素\] — 在网页上进行导航。
- API_call \[参数\] — 调用外部 API。

### 观察 (Observation)

系统或外部工具执行该行动并返回结果（观察）。这可能是一段文本、一个 API 响应或一条错误消息。模型利用此观察来形成下一个思考，从而完成反馈循环<sup>[\[2\]](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_note-googleblog-react-2)</sup>。

## 实验结果与有效性

ReAct 的作者们在广泛的任务上测试了该方法，证明了其相对于 CoT 和仅行动（Act-Only）方法的优越性。

| 基准测试     | 任务             | ReAct (成功率/准确率) | 思维链 (成功率/准确率) | 仅行动 (成功率/准确率) |
|--------------|------------------|-----------------------|------------------------|------------------------|
| **FEVER**    | 事实核查         | **87.6%**             | 82.8%                  | 70.1%                  |
| **HotpotQA** | 多跳问答         | 31.8%                 | **36.3%**              | 17.0%                  |
| **ALFWorld** | 文本游戏（规划） | **71%**               | 10%                    | 13%                    |
| **WebShop**  | 网页导航         | **40%**               | \-                     | 30.1%                  |

ReAct 与基线方法在关键基准测试中的结果对比<sup>[\[1\]](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_note-yao2022react-1)</sup>

- 在需要**事实核查**的任务（FEVER）中，ReAct 明显优于 CoT，因为它能够验证信息。
- 在**交互式规划**任务（ALFWorld、WebShop）中，ReAct 显示出巨大优势，因为它能适应变化的环境。
- 在**纯推理**任务（HotpotQA）中，CoT 可能表现出相当甚至更好的结果。然而，一种混合方法**ReAct+CoT**表现最佳，在 HotpotQA 上达到了 35% 的成绩<sup>[\[1\]](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_note-yao2022react-1)</sup>。

## 批评与局限性

尽管 ReAct 效果显著，但它也存在一些局限和弱点。

- **脆弱性（Brittleness）**：后续研究表明，ReAct 的成功可能并非源于推理与行动的真正协同，而更多是由于提示中的示例与当前任务之间的**语法相似性**。模型可能只是在遵循 \`Thought-Action-Observation\` 的模板，而未完全理解推理的语义<sup>[\[3\]](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_note-verma2024brittle-3)</sup>。
- **计算成本**：每个 ReAct 循环至少需要一次 LLM 调用和一次外部工具访问，这使其与标准提示相比速度更慢且成本更高。
- **对工具的依赖性**：智能体的效率直接取决于可用工具的质量和可靠性。来自 API 的不正确或充满噪声的响应可能会将模型的推理引向错误的方向。

## 意义与未来发展

ReAct 成为人工智能发展的一个重要里程碑，标志着从**生成式系统**向**智能体系统**的转变。它为大多数现代智能体创建框架奠定了概念和实践基础，例如：

- **LangChain**
- **LlamaIndex**
- **AutoGen**

ReAct 的思想为更复杂的推理架构提供了起点，例如**Reflexion**（在失败后增加自我反思循环）和**思维树（Tree of Thoughts, ToT）**（并行探索多条推理路径）。

## 外部链接

- <a href="https://react-lm.github.io/" class="external text" rel="nofollow">ReAct 项目官方页面</a>
- <a href="https://learnprompting.org/docs/agents/react" class="external text" rel="nofollow">Learn Prompting 指南中对 ReAct 的描述</a>
- Google Research (2022). *ReAct: Synergizing Reasoning and Acting in Language Models* (博客文章). <a href="https://research.google/blog/react-synergizing-reasoning-and-acting-in-language-models/" class="external text" rel="nofollow">Google Research Blog</a>.

## 参考文献

- Yao, S. et al. (2022). *ReAct: Synergizing Reasoning and Acting in Language Models*. <a href="https://arxiv.org/abs/2210.03629" class="external text" rel="nofollow">arXiv:2210.03629</a>.
- Yao, S. et al. (2023). *Tree of Thoughts: Deliberate Problem Solving with Large Language Models*. <a href="https://arxiv.org/abs/2305.10601" class="external text" rel="nofollow">arXiv:2305.10601</a>.
- Shinn, N. et al. (2023). *Reflexion: Language Agents with Verbal Reinforcement Learning*. <a href="https://arxiv.org/abs/2303.11366" class="external text" rel="nofollow">arXiv:2303.11366</a>.
- Verma, V. et al. (2024). *On the Brittle Foundations of ReAct Prompting for Agentic Large Language Models*. <a href="https://arxiv.org/abs/2405.13966" class="external text" rel="nofollow">arXiv:2405.13966</a>.
- Yao, S. et al. (2022). *WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents*. <a href="https://arxiv.org/abs/2207.01206" class="external text" rel="nofollow">arXiv:2207.01206</a>.
- Shridhar, M. et al. (2020). *ALFWorld: Aligning Text and Embodied Environments for Interactive Learning*. <a href="https://arxiv.org/abs/2010.03768" class="external text" rel="nofollow">arXiv:2010.03768</a>.
- Qin, L. et al. (2023). *AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Collaboration*. <a href="https://arxiv.org/abs/2308.08155" class="external text" rel="nofollow">arXiv:2308.08155</a>.
- Thorne, J. et al. (2018). *FEVER: A Large-Scale Dataset for Fact Extraction and Verification*. <a href="https://arxiv.org/abs/1803.05355" class="external text" rel="nofollow">arXiv:1803.05355</a>.
- Yang, Z. et al. (2018). *HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering*. <a href="https://arxiv.org/abs/1809.09600" class="external text" rel="nofollow">arXiv:1809.09600</a>.

## 注释

1.  <span id="cite_note-yao2022react-1">↑ <sup>[1.0](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_ref-yao2022react_1-0)</sup> <sup>[1.1](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_ref-yao2022react_1-1)</sup> <sup>[1.2](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_ref-yao2022react_1-2)</sup> <sup>[1.3](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_ref-yao2022react_1-3)</sup> Yao, S., Zhao, J., Yu, D., et al. (2022). «ReAct: Synergizing Reasoning and Acting in Language Models». *arXiv preprint arXiv:2210.03629*. <a href="https://arxiv.org/abs/2210.03629" class="external autonumber" rel="nofollow">[1]</a></span>
2.  <span id="cite_note-googleblog-react-2">↑ <sup>[2.0](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_ref-googleblog-react_2-0)</sup> <sup>[2.1](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_ref-googleblog-react_2-1)</sup> «ReAct: Synergizing Reasoning and Acting in Language Models». *Google Research Blog*. <a href="https://research.google/blog/react-synergizing-reasoning-and-acting-in-language-models/" class="external autonumber" rel="nofollow">[2]</a></span>
3.  <span id="cite_note-verma2024brittle-3">[↑](https://systems-analysis.info/int/ReAct_Prompting_%E2%80%94_ReAct_%E6%8F%90%E7%A4%BA%E6%B3%95#cite_ref-verma2024brittle_3-0) Verma, V., et al. (2024). «On the Brittle Foundations of ReAct Prompting for Agentic Large Language Models». *arXiv preprint arXiv:2405.13966*. <a href="https://arxiv.org/abs/2405.13966" class="external autonumber" rel="nofollow">[3]</a></span>
