Papers · arXiv 2210.03629
ReAct: Synergizing Reasoning and Acting in Language Models
Published cs.CLcs.AIcs.LG arXivPDF
Summary in three lines
- 🎯 LLMs performing pure chain-of-thought reason in isolation and hallucinate, while act-only agents lack working memory and strategic planning.
- 🔧 Augment agent action spaces with free-form language thoughts interleaved with physical/API actions to dynamically plan, track, and act.
- 📈 ReAct achieves 71% success on ALFWorld and 40.0% on WebShop, outperforming imitation/RL baselines while drastically cutting hallucinations on QA.
Abstract
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
Reading guide
Problem and motivation
Large language models (LLMs) excel at reasoning via Chain-of-Thought (CoT) and at decision-making by outputting actionable commands. However, these two capabilities have typically been studied in isolation:
- CoT reasoning is ungrounded: the model relies exclusively on frozen internal representations, making it prone to factual hallucination, lack of up-to-date knowledge, and compounding error propagation.
- Action-only systems map contexts straight to environment actions: they lack an explicit working memory to formulate abstract goals, maintain intermediate subgoals, or handle unexpected state changes.
Inspired by human inner speech, this paper investigates whether interleaving reasoning steps with environmental interactions creates a mutually reinforcing loop: reasoning guides actions, while action feedback grounds reasoning.
Key ideas
- Action Space Augmentation: The agent's action space is extended to include language thoughts that produce no external observation but update internal context.
- Dense vs. Sparse Thought Regimes: Depending on the task, thoughts can be tightly coupled (alternating step-by-step for multi-hop QA) or asynchronous and sparse (used only when planning or handling surprises in long-horizon games).
- Hybrid Reasoning: Combining internal parametric knowledge (via CoT self-consistency) with retrieved external feedback (via ReAct) balances factual precision with reasoning agility.
Method (with the key equations)
Consider an interactive environment where at time , an agent receives observation , maintains trajectory context , and acts according to policy .
ReAct expands the action space to: where is the space of free-form language expressions.
- If an agent generates an environmental action , the environment returns an observation , forming the next context .
- If an agent generates a thought , no external observation is generated; the thought directly appends to the agent context: .
For knowledge tasks (HotpotQA, FEVER), the API action set is . For hybrid setups:
- : If ReAct does not finish within fixed steps (e.g., 7 for HotpotQA, 5 for FEVER), fall back to majority voting from CoT self-consistency.
- : If majority agreement among samples drops below , fall back to ReAct.
Results (with the most important numbers)
- Knowledge Reasoning (PaLM-540B):
- On HotpotQA, combining both regimes () achieves 35.1% Exact Match (EM) compared to Standard (28.7%), CoT (29.4%), and Act (25.7%).
- On FEVER, reaches 64.6% Accuracy vs. Standard (57.1%) and CoT (56.3%).
- Error analysis shows ReAct hallucinates in 0% of its failure cases on HotpotQA, whereas hallucination accounts for 56% of CoT failures.
- Decision Making (ALFWorld & WebShop):
- On ALFWorld, best-of-6 ReAct achieves an average success rate of 71% (and average across prompts of 57%), outperforming Act-only (best 45%), Inner Monologue-style prompting (best 53%), and an imitation learning agent BUTLER (best 37%) trained on trajectories.
- On WebShop, 1-shot ReAct achieves a 40.0% success rate and 66.6 average score, beating imitation + reinforcement learning baselines (28.7% success, 62.4 score) trained on over 10,000 instructions.
- Finetuning: Bootstrapping PaLM-8B and PaLM-62B with 3,000 self-generated correct trajectories makes ReAct the top performer, with PaLM-8B finetuned ReAct outperforming all 62B prompting methods.
Limitations and open questions
- In-Context Prompting Limits: Due to context window constraints, LLMs can only observe a handful of demonstrations (1–6 exemplars), making it challenging to master massive action spaces purely from prompts.
- Search Derailment & Loops: Under greedy decoding, non-informative search returns cause ReAct to fail in 23% of error cases, occasionally trapping the model in repetitive loops.
- Safety & Tool Execution: Granting LLMs external actions in open environments introduces risks of unintended actions (e.g., executing unwanted web transactions or retrieving sensitive data).
Key terms
- ReAct
- A prompt-based paradigm that prompts large language models to generate interleaved reasoning traces and domain-specific actions for general task solving.
- Chain-of-Thought (CoT)
- A prompting approach where models output internal reasoning steps before generating a final answer, without taking actions in external environments.
- Action Space Augmentation
- The formal expansion of an agent's discrete action set to include arbitrary natural language utterances, designated as non-environment-altering thoughts.
- Inner Monologue (IM)
- A baseline and prior approach where language model thought is restricted primarily to external environment feedback rather than flexible internal strategic planning.
- CoT-SC
- Chain-of-thought prompting coupled with self-consistency, where answers are sampled multiple times with a non-zero temperature and selected by majority voting.
- ALFWorld
- A text-based interactive environment based on the ALFRED benchmark that tests multi-step household goal decomposition, navigation, and object manipulation.
- WebShop
- A realistic web navigation benchmark featuring 1.18 million real-world Amazon-crawled products evaluated by an agent's ability to browse and purchase items satisfying text instructions.
- Self-Reflection / Thought Editing
- Human-in-the-loop intervention where an operator corrects or guides the model's trajectory by manually adjusting a generated language thought rather than modifying weights or action histories.
Questions
Why is ReAct less prone to hallucinations than standard Chain-of-Thought?
CoT relies purely on internal parametric memory, which frequently fabricates non-existent facts. ReAct checks external sources (like Wikipedia APIs) through concrete actions, grounding subsequent thoughts directly in retrieved observations.
How does ReAct differ from WebGPT or SayCan?
WebGPT and SayCan focus on predicting actions or plans using human feedback or affordance models, without explicitly prompting the model to maintain, decompose, and adjust its own verbal reasoning traces in an interleaved loop.
What happens when search yields no useful results in ReAct?
Search failures accounted for roughly 23% of ReAct's failure cases on HotpotQA; models sometimes struggle to reformulate queries and get stuck in repetitive action loops under greedy decoding.
How does human-in-the-loop thought editing work in ReAct?
Because reasoning traces are plain English, a human can inspect a failing trajectory and edit one or two intermediate thoughts on the fly, immediately steering the agent out of loops or false beliefs without parameter fine-tuning.
The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.