While large language models (LLMs) have demonstrated impressive capabilities across tasks in language understanding and interactive decision making, their abilities for reasoning (e.g. chain-of-thought prompting) and acting (e.g. action plan generation) have primarily been studied as separate topics. In this paper, we explore the use of LLMs to generate both reasoning traces and task-specific actions in an interleaved manner, allowing for greater synergy between the two: reasoning traces help the model induce, track, and update action plans as well as handle exceptions, while actions allow it to interface with external sources, such as knowledge bases or environments, to gather additional information. We apply our approach, named ReAct, to a diverse set of language and decision making tasks and demonstrate its effectiveness over state-of-the-art baselines, as well as improved human interpretability and trustworthiness over methods without reasoning or acting components. Concretely, on question answering (HotpotQA) and fact verification (Fever), ReAct overcomes issues of hallucination and error propagation prevalent in chain-of-thought reasoning by interacting with a simple Wikipedia API, and generates human-like task-solving trajectories that are more interpretable than baselines without reasoning traces. On two interactive decision making benchmarks (ALFWorld and WebShop), ReAct outperforms imitation and reinforcement learning methods by an absolute success rate of 34% and 10% respectively, while being prompted with only one or two in-context examples. Project site with code: https://react-lm.github.io
翻译:尽管大型语言模型(LLMs)在语言理解与交互式决策任务中展现出令人瞩目的能力,但其推理能力(如思维链提示)与行动能力(如行动规划生成)此前主要作为独立课题进行研究。本文探索以交错方式同时生成推理轨迹与任务特定行动,使二者产生更强大的协同效应:推理轨迹帮助模型推导、追踪及更新行动方案并处理异常,而行动则允许模型通过知识库或环境等外部来源获取补充信息。我们将该方法命名为ReAct,并应用于多样化的语言与决策任务,证明其相较于现有最优基准方法的有效性,同时相比不含推理或行动组件的方案提升了人类可解释性与可信度。具体而言,在问答(HotpotQA)与事实验证(Fever)任务中,ReAct通过调用简易Wikipedia API克服了思维链推理中普遍存在的幻觉与误差传播问题,生成了比无推理轨迹基准方法更具可解释性的人类化任务解决路径。在两个交互式决策基准(ALFWorld与WebShop)上,ReAct仅需一至两个上下文示例提示,即分别以34%和10%的绝对成功率超越模仿学习与强化学习方法。项目代码见:https://react-lm.github.io