Why This Matters
Human intelligence seamlessly combines task-oriented action with internal verbal reasoning. When cooking, we don't just execute physical commands; we reason internally ($“\text{now that the water is boiling, I should add the pasta}”$), track our progress, and adapt to exceptions ($“\text{I don't have salt, let me use soy sauce instead}”$).
In artificial intelligence, these two capabilities have historically been split:
- Reasoning-only models (like Chain-of-Thought) operate as closed-loop, static black boxes. They rely entirely on internal weights, leading to factual hallucinations and error propagation.
- Acting-only models (like web navigation or robotic controllers) generate direct action plans but lack abstract, high-level goal tracking, making them brittle when environments change unexpectedly.
ReAct bridges this gap, establishing a unified paradigm where language models generate both reasoning traces and actions in an interleaved sequence.
The Big Idea
The core formulation of ReAct is beautifully simple. Consider an agent interacting with an environment. At step $t$, the agent receives an observation $o_t$ and takes an action $a_t$ based on its policy $\pi(a_t | c_t)$, where $c_t = (o_1, a_1, \dots, o_t)$ is the interaction history.
ReAct augments this action space to $\hat{\mathcal{A}} = \mathcal{A} \cup \mathcal{L}$, where $\mathcal{L}$ is the space of free-form natural language. An action $\hat{a}_t \in \mathcal{L}$ is a thought (or reasoning trace). Because thoughts do not affect the external environment, they yield no immediate observation feedback. Instead, they update the agent's internal context:
This allows the model to perform dynamic planning, track subgoals, inject commonsense knowledge, and gracefully handle errors.
Interactive System Architecture
Generates interleaved Thoughts & Actions using in-context exemplars.
Executes actions (e.g., Wikipedia Search, API calls) and returns raw observations.
How It Works
Depending on the task, ReAct utilizes different execution patterns:
-
Knowledge-Intensive Tasks (e.g., HotpotQA, FEVER): The model alternates strictly between generating a thought, executing an action (like
searchorlookup), and receiving an observation. This prevents hallucination by anchoring every reasoning step to verified facts. - Interactive Decision Making (e.g., ALFWorld, WebShop): The model generates thoughts sparsely. It decides autonomously when to pause and reason about high-level planning, subgoals, or error recovery before continuing with environmental actions.
Interactive Prompting Simulator
Step through different prompt strategies for a multi-hop HotpotQA question.
Synergy in Action: The Closed-Loop Flow
Hover over the components below to see how ReAct creates a closed-loop system where reasoning guides action and action anchors reasoning.
1. Reason to Act
The model generates internal thoughts to break down complex goals, track subgoals, and synthesize information.
2. Act to Reason
The model interacts with external environments (Wikipedia, Web APIs) to fetch real, grounded facts.
3. Dynamic Adjustment
When observations don't match expectations, thoughts allow the model to rewrite plans on-the-fly.
Empirical Results
ReAct was evaluated across four diverse benchmarks. The results demonstrate that while standalone reasoning (CoT) and acting (Act) have severe limitations, their synergy yields state-of-the-art performance.
Performance Comparison
Select a benchmark to view success rates across prompting strategies.
Limitations & Open Questions
While powerful, ReAct is not without its failure modes:
- Rigid Structural Constraints: The strict interleaving of thought, action, and observation reduces the model's flexibility compared to pure free-form reasoning, occasionally leading to higher reasoning error rates.
- Search & Retrieval Vulnerability: If the external knowledge source returns uninformative or empty results, the model can get trapped in repetitive loops, struggling to reformulate its search queries.
- Context Window Limits: Few-shot prompting with detailed trajectories consumes significant context space, limiting the number of in-context exemplars.
Glossary
Chain-of-Thought (CoT)
A prompt engineering technique that encourages Large Language Models to generate intermediate logical reasoning steps before producing the final answer, improving performance on multi-step reasoning tasks.
Multi-hop Question Answering
A question answering setup (like HotpotQA) where answering the query requires finding and synthesizing facts across multiple distinct documents or passages.
ALFWorld
A synthetic text-based game environment where agents must solve complex, multi-step household tasks (e.g., finding and cleaning an object) using natural language actions.
Citation
@inproceedings{yao2023react,
title={{ReAct}: Synergizing Reasoning and Acting in Language Models},
author={Yao, Shunyu and Zhao, Jeffrey and Yu, Dian and Du, Nan and Shafran, Izhak and Narasimhan, Karthik and Cao, Yuan},
booktitle={International Conference on Learning Representations (ICLR)},
year={2023}
}