ReAct: Synergizing Reasoning and Acting in Language Models

Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R Narasimhan, Yuan Cao

TL;DR

ReAct is a prompting paradigm that enables Large Language Models (LLMs) to interleave reasoning traces ("thoughts") with task-specific actions (like searching Wikipedia). By combining the internal logic of Chain-of-Thought with the external grounding of tool use, ReAct significantly reduces hallucinations in reasoning tasks and outperforms reinforcement learning baselines in interactive decision-making.

The Problem: The Split Between Reasoning and Acting

Historically, the capabilities of LLMs have been explored along two separate tracks:

  1. Reasoning-only: Techniques like Chain-of-Thought (CoT) allow models to "think" through a problem step-by-step. However, they operate as a closed loop. This isolation leads to "hallucinations"—the model confidently states facts that aren't true because it lacks access to the real world to verify its internal knowledge.
  2. Acting-only: Models can be trained to generate action plans (e.g., "Search for X," "Go to the kitchen"). Yet, without reasoning, they often lack the high-level cognitive ability needed to track subgoals, handle exceptions, or update plans based on new observations.

The missing piece is synergy. Humans don't just act blindly; we use "inner speech" to strategize, evaluate feedback, and adjust our actions. ReAct (Reason + Act) aims to bring this human-like interleaving of thought and action to LLMs.

The ReAct Paradigm

ReAct is a general paradigm that augments the model's action space. Instead of just outputting a final answer or a direct command, the model is prompted to generate a trajectory consisting of:

  • Thoughts: Free-form text where the model decomposes goals, tracks progress, or handles exceptions.
  • Actions: Specific commands to interface with an external environment (e.g., querying a Wikipedia API or navigating a text-based game engine).
  • Observations: The feedback received from the environment after an action is executed.
Comparison of ReAct with other prompting methods

Technically, this is implemented via few-shot in-context learning. The authors provide the model (PaLM-540B) with a few human-written examples of these interleaved trajectories. They also explore finetuning smaller models (PaLM-8B/62B) on ReAct traces to see if the "skill" of reasoning-and-acting can be distilled into more compact architectures.

Experimental Setup

The paper evaluates ReAct across four diverse benchmarks spanning knowledge retrieval and interactive decision-making:

  • HotpotQA: A multi-hop question-answering dataset requiring reasoning over multiple Wikipedia passages.
  • FEVER: A fact-verification task where claims are labeled as SUPPORTS, REFUTES, or NOT ENOUGH INFO.
  • ALFWorld: A synthetic text-based game where an agent must achieve household goals (e.g., "put a clean lettuce in the dining table").
  • WebShop: A simulated online shopping environment with 1.18M real-world products where agents must navigate and find items matching specific user instructions.

Key Insights

  • The "Act-to-Reason" Loop: Actions allow the model to gather external information, which then grounds the next "thought." This prevents the model from getting stuck in a hallucination loop common in CoT prompting.
  • The "Reason-to-Act" Loop: Thoughts allow the model to maintain a "working memory." In complex environments like ALFWorld, a model that just "acts" often forgets what it has already done; ReAct thoughts help it track subgoals and adjust to failed actions.
  • Synergy over Isolation: ReAct proves more robust than CoT on HotpotQA because it can look things up, and it's more efficient than "Act-only" models because it can plan and strategize.
  • Human-in-the-Loop Controllability: Because the reasoning is exposed in natural language, a human can "edit" a model's thought mid-trajectory to correct a mistake, making the system highly steerable and interpretable.

Key Results

  • Knowledge Tasks: On HotpotQA and FEVER, ReAct outperformed "Act-only" models by reducing error propagation. While it slightly lagged behind CoT on HotpotQA (due to occasional reasoning errors when search results were unhelpful), a hybrid approach (ReAct + CoT-SC) achieved the state-of-the-art for prompting-based methods (35.1% EM on HotpotQA).
  • Decision Making: On ALFWorld and WebShop, ReAct significantly outperformed imitation and reinforcement learning (IL/RL) methods. Remarkably, ReAct achieved a 71% success rate on ALFWorld with just 3 in-context examples, beating a BUTLER agent trained on $10^5$ trajectories (37% success).
  • Finetuning: Smaller models (PaLM-8B) benefited significantly from ReAct finetuning, outperforming much larger models that were only prompted, suggesting that the ReAct format is highly learnable.

Limitations and Future Work

  • Context Window Constraints: Long trajectories of thoughts, actions, and observations can quickly fill up the model's context window, limiting the complexity of tasks it can handle.
  • Reasoning Loops: The authors noted a "repetitive error" pattern where ReAct models sometimes get stuck generating the same thought/action repeatedly if they can't find a way forward.
  • Human Effort: Creating high-quality few-shot exemplars for new tasks requires manual effort and domain expertise.
  • Future Directions: The authors suggest scaling ReAct to more tasks and combining it with Reinforcement Learning to further refine the "thought" process and reduce reliance on human annotations.

Summary updated

BibTeX
@inproceedings{yao2023react,
  author = {Shunyu Yao and Jeffrey Zhao and Dian Yu and Nan Du and Izhak Shafran and Karthik R Narasimhan and Yuan Cao},
  title = {{ReAct: Synergizing Reasoning and Acting in Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=WE_vluYUL-X},
}
Figure