ReAct: Synergizing Reasoning and Acting in Language Models
arXiv ↗PDF ↗Paper ↗Website ↗Code ↗
Read first: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
TL;DR. ReAct prompts a frozen LM to alternate between thoughts (free text) and actions (tool calls such as search[entity]). Each observation goes back into the context before the next step. On knowledge-heavy QA this grounding removes most hallucinated facts. On long interactive tasks such as ALFWorld and WebShop it beats action-only prompting by a wide margin. ReAct is a prompting pattern. It is not a reinforcement-learning algorithm: no weights change.
Why it matters now. Every search agent you will read about, from Search-o1 to Search-R1 and BrowseComp-Plus baselines, runs some version of this loop. In the RL-trained agents the ReAct trajectory becomes the rollout, and a reward replaces the few-shot exemplars. For an IR researcher, the important point is that the query is now written by the policy at every step. Retrieval quality then shapes the next action, not just one answer.
Key idea
Section titled “Key idea”A standard agent picks an action given the context . ReAct enlarges the action space with language:
If (a thought), nothing happens in the world and no observation comes back: . If , the environment returns . The policy is a frozen PaLM-540B. The only “training” is a handful of human-written trajectories in the prompt: 6 for HotpotQA and 3 for FEVER.
For QA the tool is a deliberately simple Wikipedia API:
search[entity]returns the first 5 sentences of the page, or the 5 most similar titles if the page does not exist.lookup[string]returns the next sentence on the page that contains the string.finish[answer]ends the episode.
A worked trace (illustrative, not from the paper). Question: Which river flows through the capital of the country where the Eiffel Tower stands?
Thought 1: I need the country of the Eiffel Tower, then its capital, then the river.Action 1: search[Eiffel Tower]Obs 1: The Eiffel Tower is a wrought-iron lattice tower ... in Paris, France. ...Thought 2: The tower is in Paris, which is the capital of France. Now find the river.Action 2: search[Paris]Obs 2: Paris is the capital and largest city of France ... on the river Seine ...Thought 3: The river through Paris is the Seine.Action 3: finish[Seine]The thoughts do three jobs here: they plan the hops, they pick the useful fact out of a long observation, and they decide when to stop.
What changed vs. prior prompting, and what didn’t.
| Chain of thought | Act-only | ReAct | |
|---|---|---|---|
| Reasoning in context | yes | no | yes |
| External observations | no | yes | yes |
| Who decides when to search | — | the LM | the LM, after a thought |
| Weights updated | no | no | no |
| Typical failure | hallucinated facts | loses track of the plan | loops, bad search results |
Try it
Section titled “Try it”Step through the trajectory with Prev and Next, or the arrow keys. The right panel shows the same rollout in Search-R1-style tags and which tokens an RL trainer would mask.
Step through a multi-hop ReAct trajectory
An original toy example. Left: the current step. Right: the rollout so far as one token sequence in Search-R1-style tags, coloured by whether each token enters the RL loss. Retrieved text was written by the search engine, not the policy, so its tokens are masked. Words stand in for tokens.
Question: Into which sea does the river that flows through Vienna empty?
Rollout as the RL trainer sees it
prompt not generated, no loss ·policy in loss ·retrieved masked
Key results
Section titled “Key results”Knowledge tasks, PaLM-540B (Table 1). HotpotQA EM / FEVER accuracy:
| Method | HotpotQA | FEVER |
|---|---|---|
| Standard prompting | 28.7 | 57.1 |
| CoT | 29.4 | 56.3 |
| CoT-SC (21 samples) | 33.4 | 60.4 |
| Act-only | 25.7 | 58.9 |
| ReAct | 27.4 | 60.9 |
| CoT-SC → ReAct | 34.2 | 64.6 |
| ReAct → CoT-SC | 35.1 | 62.0 |
| Supervised SoTA | 67.5 | 89.5 |
- ReAct → CoT-SC falls back to CoT-SC when ReAct gives no answer within 7 steps (HotpotQA) or 5 steps (FEVER).
- CoT-SC → ReAct switches to ReAct when the majority answer gets fewer than n/2 votes.
- The combined methods match 21-sample CoT-SC using only 3–5 samples.
- Prompted methods remain far below the supervised state of the art.
Error analysis (Table 2, 50 correct + 50 incorrect trajectories per method):
- Hallucination: 56% of CoT failures vs 0% for ReAct.
- Reasoning error: 47% of ReAct failures vs 16% for CoT. This category includes repetitive loops.
- Search-result error: 23% of ReAct failures.
- False positives: among correct answers, 6% for ReAct (right answer, wrong reasoning or facts) vs 14% for CoT.
Fine-tuning (§3.3). Train on 3,000 ReAct trajectories with correct answers. Fine-tuned PaLM-8B ReAct beats every PaLM-62B prompting method, and fine-tuned 62B beats every 540B prompting method.
Decision making (Tables 3–4).
- ALFWorld (134 unseen games): ReAct reaches best-of-6-prompts 71% success (average 57%), against Act-only 45% and BUTLER 37%. BUTLER is an imitation learner trained on 10⁵ expert trajectories per task type.
- WebShop: ReAct scores 66.6 with 40.0% success rate, against 62.4 / 28.7% for the IL+RL baseline. Human experts reach 82.1 / 59.6%.
Limitations & open questions
Section titled “Limitations & open questions”- The tool is weak by design. Exact-title Wikipedia lookup is not a retriever, so HotpotQA results mix the effect of the loop with the effect of a poor search interface. IRCoT and later agents use BM25 or dense passage retrieval.
- Brittleness of the format. Loops and wasted steps are a ReAct-specific failure. Nothing in the method teaches the model to recover; Reflexion later adds cross-attempt memory, and RL-trained agents learn recovery from reward.
- Long contexts. The paper notes that complex tasks with large action spaces need more demonstrations than fit in the prompt. Every step also appends an observation, so long trajectories compete with the exemplars for context.
- Prompt dependence. Results vary by exemplar set; ALFWorld reports the best and average over 6 prompts.
- Open question: when is a fixed workflow (retrieve → read → answer, or IRCoT’s fixed loop) better than letting the LM choose actions? The paper does not compare against strong predetermined pipelines.
Connections
Section titled “Connections”- Before: Chain-of-thought prompting, self-consistency (the CoT-SC baseline), WebGPT (browsing actions learned from human demonstrations).
- Contemporaries, not a lineage: IRCoT (2022-12-20) and DSP (2022-12-28) appeared within weeks; both interleave LM reasoning with retrieval but use a fixed program, not a free action space.
- After: Toolformer (tool use learned from self-labelled data), Reflexion (memory across attempts), Search-o1 (the same loop inside a reasoning model), and RL-trained searchers such as Search-R1, which keep the trajectory format and add a reward and PPO or GRPO.
- Talk: Shunyu Yao’s job talk puts ReAct in the arc of his language-agent work.
- Evaluation today: BrowseComp-Plus fixes the corpus, so you can study a ReAct-style agent’s retrieval separately from its reasoning.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
ReAct's CoT-SC→ReAct backoff samples n = 21 chain-of-thought answers and hands the question to ReAct when the majority answer gets fewer than n/2 votes. For vote splits (a) 12/5/4, (b) 9/7/5 and (c) 10/10/1, say whether ReAct runs. If a fraction f of questions fall back and each ReAct run takes at most 7 steps, write the worst-case LM-call budget per question, and explain how the paper can match 21-sample CoT-SC with only 3–5 samples.
What a strong answer covers
- Threshold is 10.5 votes. (a) 12 ≥ 10.5, keep the CoT-SC answer. (b) 9 < 10.5, fall back to ReAct. (c) 10 < 10.5, fall back; a tie is low confidence by construction.
- Worst-case cost per question ≈ n CoT samples + f × 7 ReAct steps (each step one LM call, plus the search calls). With n = 21 and small f, the CoT samples dominate.
- With 3–5 samples the vote is noisier, so more questions fall back; the fallback is what recovers accuracy. The paper reports that both combined methods reach the 21-sample CoT-SC level with 3–5 samples.
- The rule is a confidence gate: majority share is used as a cheap proxy for whether internal knowledge suffices, which is the same idea as adaptive retrieval in Self-RAG.
- Mechanism
In ReAct a thought is an action in the language space L that does not change the environment and returns no observation. Why can adding such a no-op action improve a frozen policy? Use the context definition and the ALFWorld result against Act and ReAct-IM to explain what the thought actually does.
What a strong answer covers
- The policy is π(a | c_t). A thought rewrites c_t, so it changes the distribution over the next real action without any weight update. It is computation stored in the context.
- Useful thought types the paper lists: decompose the goal, track progress and subgoals, pull the key fact out of a long observation, handle exceptions, and inject commonsense.
- ALFWorld episodes are long (many steps). Act-only (best 45) must infer its place in the plan from raw observation history, whereas ReAct (best 71) writes the plan down.
- ReAct-IM restricts thoughts to Inner-Monologue-style feedback about the environment; it reaches avg 48 / best 53 vs ReAct avg 57 / best 71, so the content of the thoughts (high-level planning, commonsense) matters, not just their presence.
- Because thoughts are free-form and sparse, the policy decides when to think. That is a learned-by-prompt control decision, not an RL signal.
- What if…
Table 2 of the paper hand-labels 200 HotpotQA trajectories. Among failures, CoT's dominant mode is hallucination (56%, vs 0% for ReAct) while ReAct's is reasoning error (47%, vs 16%), and 23% of ReAct failures are search-result errors. Explain what each number says about the cost of grounding, and why this pattern predicts that the backoff combinations beat either method alone.
What a strong answer covers
- Grounding through observations removes hallucinated facts in failures, and ReAct's successes have fewer false positives (6% vs 14%), so its reasoning is more trustworthy when right.
- The interleaved format constrains reasoning: the model must issue a valid action each step, and it falls into repetitive loops (repeating thoughts or actions), which are counted as reasoning errors.
- Search-result errors (23%) are failures of the retrieval tool, not the LM: an empty or unhelpful search derails the trajectory.
- The errors are complementary: CoT is fluent but ungrounded, ReAct is grounded but brittle. A confidence gate picks the right one per question: 35.1 EM (ReAct→CoT-SC) vs 27.4 (ReAct) and 33.4 (CoT-SC).
- Caveat: 50 trajectories per cell give wide intervals (several points each way), and the labels are the authors' own.
- Critique
ReAct alone scores 27.4 EM on HotpotQA, below CoT-SC at 33.4, and its search action returns the first 5 sentences of an exact-match Wikipedia page or 5 similar titles. Argue whether ReAct's HotpotQA result understates or overstates the value of interleaving reasoning with retrieval, and design the experiment that would separate the loop from the tool.
What a strong answer covers
- The API is deliberately weak: entity-title lookup, not passage ranking. Many failures (23% search-result errors) are tool failures, so the result likely understates the loop.
- But the comparison is also against a frozen 540B model with strong parametric knowledge of Wikipedia-derived trivia, which favours CoT on HotpotQA.
- Experiment: fix PaLM-size model and prompts; swap the tool among the original API, BM25 top-k passages, and a dense retriever over the same Wikipedia dump. Report EM, retrieval recall of gold supporting paragraphs, and the error-category distribution.
- Control for prompt length and number of LM calls so the loop is not credited with extra compute alone.
- IRCoT (BM25 passages, CoT sentence as query) is partial evidence that a better retrieval interface makes interleaving clearly beat one-shot retrieval.
- Design
You are building a ReAct-style baseline for BrowseComp-Plus, where the corpus is fixed and you control the retriever. Specify the action space, what each observation returns, the step and token budget, the termination rule and the logs you would keep, and say how you would use the paper's fine-tuning result (3,000 trajectories) to get a small open model competitive.
What a strong answer covers
- Actions: search(query) returning top-k doc ids plus short snippets; open(doc_id, offset) returning a bounded window; finish(answer, cited_doc_ids). Keep observations short to protect the context.
- Budgets: max search calls and max steps, plus a context cap; on hitting the budget, force a finish or back off to a no-retrieval answer, as ReAct→CoT-SC does.
- Log every query, the returned doc ids and ranks, and whether gold evidence docs were ever retrieved or opened. This separates retrieval failure from reading or reasoning failure.
- Fine-tuning: sample many trajectories from a strong model, keep those with correct final answers (rejection sampling), and SFT a small model on them. The paper's PaLM-8B fine-tuned on 3,000 such HotpotQA trajectories beat every 62B prompting method.
- Watch for loops (repeated identical queries) and for the agent answering from parametric memory without retrieving; both show up in logs, not in final accuracy.
- Connect
ReAct is prompting with a frozen model, yet its Thought / Action / Observation format became the rollout format for RL-trained search agents such as Search-R1. List what an RL method must add to a ReAct trajectory to train on it, and which parts of ReAct carry over unchanged.
What a strong answer covers
- Carries over: the interleaved trajectory, the tool call syntax, observations appended to context, and a finish action that ends the episode.
- Must add: a reward (for example exact match of the final answer) and a policy-gradient update such as PPO or GRPO. A reference-policy KL penalty is optional; some agent-training recipes (RAGEN's StarPO-S, InfoSeek's GRPO) omit it.
- Must add: loss masking of observation tokens, because retrieved text is not generated by the policy and should not receive gradient.
- Credit assignment changes: a single end reward must be spread over thoughts, queries and the answer, unlike ReAct where nothing is learned at all.
- The SFT-on-successful-trajectories result in ReAct is a precursor: it is rejection-sampling fine-tuning, the same move WebGPT and STaR-style methods use.