VerifiedarXiv:2210.0362935 min
Language models · Agents

ReAct: Synergizing Reasoning and Acting in Language Models

A language model writes a thought, calls a tool, reads the result, and repeats until it can answer.

ReAct prompts a frozen language model with a few hand-written examples in which reasoning steps alternate with actions such as a Wikipedia search. The real search results are pasted back into the prompt, so later reasoning works from retrieved text instead of the model's memory.

Explaining the paperReAct: Synergizing Reasoning and Acting in Language ModelsYao, Zhao, Yu, Du, Shafran, Narasimhan, Cao · ICLR 2023 · arXiv 2022 · arXiv:2210.03629 ↗

Princeton and Google Brain, October 2022. All main results come from PaLM-540B with no training, on four benchmarks: two question-answering tasks backed by a three-command Wikipedia API, a text adventure set in a house, and a shopping website. The Thought, Action, Observation format it introduced is the one many later agent frameworks adopted.

The page follows the paper's order:

  1. the two kinds of failure ReAct was built against, on one question from the paper;
  2. the formal change (thoughts as actions that only edit the context) and the loop that runs it;
  3. results on question answering, and where ReAct and chain-of-thought each fail;
  4. the fallback rules that combine the two, and finetuning smaller models on ReAct episodes;
  5. the decision-making tasks, where thoughts are sparse, and what later work found about why ReAct works.

Reasoning without looking, acting without thinking

By 2022 there were two separate ways to use a large language model on a multi-step task. Chain-of-thought prompting puts a few worked examples with written-out reasoning in the prompt, and the model then writes its own reasoning before the answer. All the facts in that reasoning come from the model's weights. If it misremembers one in step two, steps three and four build on the wrong fact, and nothing in the process checks it. The paper calls these failures fact hallucination and error propagation.

The other line used language models as policies in interactive environments: the model reads the current state as text and outputs the next action, such as a robot command or a browser click. Those systems acted but wrote down no reasoning between actions, so nothing in the text tracked the goal, the progress so far, or why the last action failed. (Inner Monologue, covered below, had the model restate facts about the scene, a limited exception.)

Figure 1 of the paper runs four prompting styles on one HotpotQA question: "Aside from the Apple Remote, what other device can control the program Apple Remote was originally designed to interact with?"

The ReAct trace shows the two directions the title's "synergizing" refers to. Reasoning steers the actions: a thought decides what to search for, and another reformulates the query after a failed search. Actions feed the reasoning: the fact about Front Row comes from the page, not from memory. The paper's names for the two directions are "reason to act" and "act to reason".

How ReAct works

The paper starts from the usual agent setup. At step tt the agent receives an observation oto_t from the environment and picks an action ata_t according to a policy π\pi, conditioned on everything seen so far:

ct=(o1,a1,…,ot−1,at−1,ot)at∼π(at∣ct)c_t = (o_1, a_1, \dots, o_{t-1}, a_{t-1}, o_t) \qquad a_t \sim \pi(a_t \mid c_t)ct=(o1,a1,…,ot−1,at−1,ot)at∼π(at∣ct)\begin{gathered} c_t = (o_1, a_1, \dots, o_{t-1}, a_{t-1}, o_t) \\ a_t \sim \pi(a_t \mid c_t) \end{gathered}
(1)

ctc_t is the context. For a language-model agent it is literally the text in the prompt, and the policy is the model's distribution over continuations of that text. The paper's argument for why this is hard: the mapping from ctc_t to the right action can require a lot of computation that is never written down. In the Act-only run above, the right final action needed the question and three observations combined, and the model produced "yes".

ReAct enlarges the set of allowed actions with free-form language:

A^=A∪L\hat{\mathcal{A}} = \mathcal{A} \cup \mathcal{L}
(2)

A\mathcal{A} holds the task's real actions (search a page, open a drawer) and L\mathcal{L} is the space of language. An action a^t∈L\hat{a}_t \in \mathcal{L} is a thought. The environment never sees it and returns no observation for it; its only effect is to extend the context:

ct+1=(ct,a^t)for a^t∈Lc_{t+1} = (c_t, \hat{a}_t) \qquad \text{for } \hat{a}_t \in \mathcal{L}
(3)

A thought therefore works like scratch space the model writes for itself. The paper lists the kinds it observed: decomposing the goal into a plan, injecting commonsense ("a pepper shaker is more likely to appear in cabinets or on countertops"), pulling the relevant part out of an observation, tracking progress, and handling an exception such as a failed search.

The obvious alternative would be to train a policy that outputs thoughts and actions. The paper notes that L\mathcal{L} is unbounded, so learning a policy over it from scratch needs strong language priors, and takes those priors from a frozen pretrained model shown a handful of examples. Each example is a complete episode that a person wrote by typing thoughts next to the actions they took. Nothing is learned in the weights. Written out at the level of tokens, the policy is the model's next-token distribution under a fixed prompt prefix PP (instruction plus examples), with the action string at=(w1,…,wK)a_t = (w_1, \dots, w_K) decoded greedily:

wk=arg⁡max⁡w  pθ(w∣P,ct,w<k)θ frozenw_k = \arg\max_{w}\; p_\theta(w \mid P, c_t, w_{<k}) \qquad \theta \text{ frozen}wk=arg⁡max⁡w  pθ(w∣P,ct,w<k)θ frozen\begin{gathered} w_k = \arg\max_{w}\; p_\theta(w \mid P, c_t, w_{<k}) \\ \theta \text{ frozen} \end{gathered}
(4)

The decoder does not distinguish thoughts from actions; the harness does. On the two question-answering tasks the examples alternate strictly (thought, action, observation, thought, ...), so every model call writes one thought and one action. On the decision-making tasks, which can run for dozens of actions, the examples include thoughts only at a few points and the model decides for itself when to write one.

The whole HotpotQA agent fits in a dozen lines. Condensed from the authors' released code, which runs GPT-3 because PaLM was not public:

# Condensed from hotpotqa.ipynb in github.com/ysymyth/ReAct (GPT-3 release)
prompt = INSTRUCTION + SIX_EXAMPLES + question + "\n"   # 1,016-word prefix
for i in range(1, 8):                                   # at most 7 steps
    out = llm(prompt + f"Thought {i}:",
              stop=[f"\nObservation {i}:"])             # greedy decoding
    thought, action = out.strip().split(f"\nAction {i}: ")
    obs, done = env.step(action)        # search[...], lookup[...], finish[...]
    prompt += (f"Thought {i}: {thought}\nAction {i}: {action}\n"
               f"Observation {i}: {obs}\n")
    if done:
        break
if not done:
    env.step("finish[]")                # out of steps: an empty answer
# The language model's weights never change. No step computes a gradient.

The stop string "\nObservation i:" ends each model call right where an observation would start. Without it the model would keep following its examples, which put an observation after every action, and write one of its own, the kind of invented fact ReAct is meant to remove. The prompt is also the only state: there is no memory object, planner, or tool registry beyond string parsing of search[...], lookup[...] and finish[...].

Figure 1 replays one episode phase by phase. The text is the first of the paper's six HotpotQA example episodes, written by the authors; in a real run the teal lines come from the model and the amber lines from the API. Watch three things: the model is idle while the API runs, every model call ends at the dashed stop marker, and the context grows by the episode on top of the fixed 1,016-word prefix.

Figure 1 · one HotpotQA episode, phase by phase
2.llm
LLM call 2. The prompt ends in "Thought 2:". The model writes a thought and an action line, and decoding halts at the stop string "\nObservation 2:" so the model never writes the observation itself.
Press Play or drag the slider through 16 phases. Teal: thoughts and actions written by the model. Amber: observations returned by the Wikipedia API. The text is the paper's first HotpotQA example episode, verbatim from the released prompt file.

In step 3 the search lands on a disambiguation page for "High Plains" ("refers to one of two distinct land regions"), and Thought 4 reformulates the query to "High Plains (United States)". The Act version of this example makes the same reformulation with no line saying why, so an Act prompt shows the model the pattern without the reason. At the end the episode has added about 230 words to the prefix, and each of the five model calls re-read everything above it.

The Wikipedia actions and the baselines

HotpotQA asks multi-hop questions whose answers need facts from two or more Wikipedia pages. FEVER gives a claim to label SUPPORTS, REFUTES or NOT ENOUGH INFO. The paper runs both in a question-only setup: the model sees the question or claim and none of the supporting paragraphs the datasets provide, so it must use its own knowledge or look things up. The authors gave it three actions:

Anything else the model writes comes back as the observation "Invalid action: ...", which it sees on its next call.

The paper calls this API "significantly weaker than state-of-the-art lexical or neural retrievers", on purpose. Retrieval-augmented generation embeds the question and fetches the nearest passages; here the model has to name the exact page it wants and say in writing why, which is what the experiment is about.

The baselines are built by deleting lines from the same hand-written episodes (six for HotpotQA, three for FEVER; the paper found more examples did not help):

In the released prompt file the six HotpotQA examples are 938 words in ReAct format, 515 as Act, 308 as CoT and 114 as Standard. A ReAct prompt is about eight times longer than a Standard prompt before the model writes anything.

Results on HotpotQA and FEVER

Table 1 of the paper, PaLM-540B with prompting only:

Prompt methodHotpotQA (EM)FEVER (acc)
Standard28.757.1
CoT29.456.3
CoT-SC (21 samples)33.460.4
Act25.758.9
ReAct27.460.9
CoT-SC → ReAct34.264.6
ReAct → CoT-SC35.162.0
Supervised state of the art67.589.5

ReAct beats Act on both tasks (27.4 against 25.7, and 60.9 against 58.9), the comparison that isolates the thoughts. Against chain-of-thought the picture splits. On FEVER ReAct wins, 60.9 to 56.3; the paper points out that a SUPPORTS claim and a REFUTES claim can differ by one detail, such as a year, so looking it up matters. On HotpotQA ReAct loses to CoT (27.4 to 29.4) and to plain Standard prompting (28.7). Every prompting number is far below the supervised systems trained on each dataset, 67.5 and 89.5.

To see why, the authors sampled 50 correct and 50 incorrect HotpotQA trajectories from each of ReAct and CoT (200 in total) and labeled what happened in each by hand. Figure 2 shows their Table 2.

Figure 2 · how ReAct and CoT succeed and fail on HotpotQA
hallucination
hallucination (share of wrong answers): ReAct 0%, CoT 56%. A hallucinated reasoning trace or hallucinated facts led to the wrong answer.
Table 2 of the paper. Each bar is 50 hand-labeled trajectories; the top pair are correct answers, the bottom pair wrong ones. Click a segment or use the arrows. CoT has no search step, so it has no search-result category.

Hallucination is 56% of chain-of-thought's failures and 0% of ReAct's. It also shows up among the correct answers: 14% of CoT's right answers were reached through a hallucinated fact or trace, against 6% for ReAct.

ReAct pays for that grounding in two ways. Reasoning errors make up 47% of its failures against 16% for CoT. Forcing every step into the thought, action, observation pattern makes it harder to write a reasoning step that does not fit it, and one error pattern is specific to ReAct: the model repeats its previous thought and action and never gets out of the loop. The paper suspects greedy decoding and suggests beam search might help, without testing it. The second cost is search: 23% of ReAct's failures came from searches that returned nothing or nothing useful, after which the model had a hard time reformulating.

The remaining failures, 29% for ReAct and 28% for CoT, are label ambiguity: the prediction was right but did not match the label string, so exact match scored it wrong.

Falling back between ReAct and CoT-SC

Table 2 suggests that CoT gets the structure of the reasoning right more often and ReAct gets the facts right more often. The paper combines them with two fallback rules, one for each direction.

ReAct → CoT-SC. Run ReAct. If it has not called finish within 7 steps on HotpotQA or 5 on FEVER, answer with CoT-SC instead. The limits come from the data: among ReAct trajectories with correct answers, only 0.84% on HotpotQA used 7 steps and 1.33% on FEVER used 5.

CoT-SC → ReAct. Sample nn chain-of-thought answers y1,…,yny_1, \dots, y_n. If the most common answer has fewer than n/2n/2 votes, treat the model's internal knowledge as unsure and run ReAct instead:

max⁡y  ∣{ j:yj=y }∣<n2  ⟹  answer with ReAct\max_{y}\; \bigl|\{\, j : y_j = y \,\}\bigr| < \tfrac{n}{2} \;\Longrightarrow\; \text{answer with ReAct}max⁡y  ∣{ j:yj=y }∣<n2⟹  answer with ReAct\begin{gathered} \max_{y}\; \bigl|\{\, j : y_j = y \,\}\bigr| < \tfrac{n}{2} \\ \Longrightarrow\; \text{answer with ReAct} \end{gathered}
(5)

With n=21n = 21, an answer that gets 11 or more votes is returned as is; if the top answer gets 10 or fewer, say 8 votes for one answer, 6 for another and 7 spread over others, the question goes to ReAct. Self-consistency agreement acts as a confidence signal, and only the low-confidence questions pay for a ReAct run.

Figure 3 is the paper's Figure 2, digitized: accuracy against the number of chain-of-thought samples. Drag nn and compare each combination with the dotted amber line, CoT-SC's accuracy at all 21 samples.

Figure 3 · accuracy against the number of CoT-SC samples
n = 5
At n = 5: CoT-SC 30.2, ReAct → CoT-SC 33.5, CoT-SC → ReAct 33.4 (CoT-SC with all 21 samples: 33.4). CoT-SC -> ReAct hands a question to ReAct when its most common answer gets 2 or fewer of the 5 votes.
Values read off Figure 2 of the paper (PaLM-540B). The dotted amber line marks CoT-SC at n = 21. On FEVER the dashed CoT line is drawn where the paper's plot puts it, near 59.3; Table 1 reports 56.3 for the same method.

The paper reports that both combinations reach 21-sample CoT-SC accuracy with 3 to 5 samples; on the FEVER plot CoT-SC → ReAct gets there at about 7. On HotpotQA at n=1n = 1, ReAct → CoT-SC already scores 32.2 against ReAct's 27.4: the episodes that ran out of steps get one chain-of-thought sample, and that alone is worth almost 5 points. The best rule differs by task. On HotpotQA it is ReAct → CoT-SC (35.1 at 21 samples); on FEVER, where ReAct alone already matches 21-sample CoT-SC, handing the uncertain questions to ReAct gives the best result, 64.6.

Finetuning smaller models on ReAct trajectories

Prompting only works when the model is large enough to pick up the format from a few examples. To test smaller models the authors used a bootstrapping scheme in the style of STaR: run ReAct prompting with PaLM-540B on training questions, keep 3,000 trajectories that reached the correct answer, and finetune PaLM-8B and PaLM-62B to produce a whole trajectory (thoughts, actions and observations) given the question. Each baseline got the same treatment with 3,000 correct trajectories in its own format. Training used batch size 64; ReAct and Act ran for 4,000 steps, Standard and CoT for 2,000 steps on 8B and 1,000 on 62B, because those two got worse soon after finetuning started. The paper does not say whether the observation tokens were masked out of the loss; at test time they come from the API, as in the prompted version.

Figure 4 · HotpotQA exact match by model size, prompted vs finetuned
PaLM-62B, prompted: Standard 20.9 · CoT 23.4 · Act 23.1 · ReAct 16.7
Bars read off Figure 3 of the paper; the 540B values are Table 1's. Switch between prompted and finetuned, and click a group for its four values. The paper did not finetune 540B.

Prompted, ReAct is the worst of the four methods at 8B (about 5) and at 62B (about 17), because a small model cannot learn both reasoning and acting from six examples. Finetuned, it is the best at both sizes: about 25 at 8B, higher than every 62B prompting method, and about 33 at 62B, higher than every 540B prompting method in this figure (though below the 35.1 of the 540B fallback combination). The authors' explanation is that finetuning on Standard or CoT trajectories teaches the model to memorize facts, some of them hallucinated, while finetuning on Act or ReAct trajectories teaches it how to find facts on Wikipedia, which transfers to new questions.

Sparse thoughts in ALFWorld and WebShop

The second half of the paper moves to tasks with long action sequences and a reward only at the end. ALFWorld is a text game aligned with the ALFRED household-robot benchmark. The agent gets a goal such as "put some spraybottle on toilet" and issues commands like go to cabinet 2, open cabinet 2 and take spraybottle 2 from cabinet 2. There are six task types; a game can have more than 50 locations and take an expert more than 50 steps. Evaluation uses 134 unseen games.

Here thoughts are sparse. The model writes one as a command starting with think:, and the harness answers "OK." without changing the game state. An example episode from the authors' ALFWorld prompt:

Your task is to: put some spraybottle on toilet.
> think: To solve the task, I need to find and take a sparybottle, then put
  it on toilet.
OK.
> think: First I need to find a spraybottle. A spraybottle is more likely to
  appear in cabinet (1-4), countertop (1), toilet (1), sinkbasin (1-2),
  garbagecan (1). I can check one by one, starting with cabinet 1.
OK.
> go to cabinet 1
On the cabinet 1, you see a cloth 1, a soapbar 1, a soapbottle 1.
> go to cabinet 2
The cabinet 2 is closed.
> open cabinet 2
You open the cabinet 2. The cabinet 2 is open. In it, you see a candle 1,
and a spraybottle 2.
> think: Now I find a spraybottle (2). Next, I need to take it.
> take spraybottle 2 from cabinet 2
You pick up the spraybottle 2 from the cabinet 2.
> think: Now I take a spraybottle (2). Next, I need to put it in/on toilet 1.
OK.
> go to toilet 1
On the toilet 1, you see a soapbottle 2.
> put spraybottle 2 in/on toilet 1
You put the spraybottle 2 in/on the toilet 1.

The second thought uses commonsense the game never provides: where a spray bottle is likely to be. The later thoughts track which subgoal is done and which comes next. (The typo "sparybottle" is in the original prompt.) For each task type the authors annotated three such episodes; a prompt contains two of them, and the six ordered pairs give six prompt sets. Act prompts are the same episodes with the thoughts deleted. The baseline, BUTLER, is an imitation-learning agent trained on 105 expert trajectories per task type. In the released code an episode is capped at 49 model actions, and thoughts count against that cap.

Figure 5 is Table 3 of the paper, success rates per task type. Toggle between the best of the six prompt sets and their average.

Figure 5 · ALFWorld success rate by task type
All, best of 6: Act 45 · ReAct 71 · ReAct-IM 53 · BUTLER 37 (best of 8)
Table 3 of the paper. Act is reported only as the best of 6 prompt sets; BUTLER is always its best of 8 runs, with beam search. Click a task group for its values.

ReAct's best prompt set solves 71% of games, against 45% for Act's best and 37% for BUTLER's best. Its worst prompt set scores 48%, still above both. Across the six controlled pairs (the same examples with and without thoughts) ReAct's gain over Act ranges from 33% to 90% relative and averages 62%. The paper reports that without thoughts, Act fails to break goals into subgoals or loses track of where it is; Figure 1 of the paper shows Act trying "take peppershaker 1 from sinkbasin 1" twice and getting "Nothing happens." both times, on a sink basin that holds no pepper shaker.

The ReAct-IM rows test which kind of thought matters. Inner Monologue (Huang et al., 2022) fed a robot's language model with descriptions of the scene and of whether the last action succeeded. ReAct-IM re-annotates the same episodes with thoughts of that kind, which only restate what the agent already knows: the goal broken into subgoals and the current subgoal. They never say when a subgoal is finished, what comes next, or where an object is likely to be. Its best prompt set scores 53% against ReAct's 71%, and it trails on five of the six task types (Clean is the exception, 68 against 58).

Because the policy is driven by its own written plan, a person can correct it by editing that plan. In the paper's Figure 5, a ReAct episode on "put two keychain in safe" fails after a hallucinated thought sends the agent back to the drawer where it found the first keychain. A human deletes the hallucinated sentence from that thought and adds hints to a later one, two edits in total, and the episode succeeds. With Act or an RL policy there is no equivalent text to edit.

WebShop is a simulated shopping site with 1.18 million real Amazon products and 12,000 human-written instructions such as "I am looking for a nightstand with drawers. It should have a nickel finish, and priced lower than $140". The agent searches, clicks products and options, and buys. Score is the fraction of the requested attributes the purchased product has, averaged over 500 test instructions; success rate is the fraction of episodes where it has all of them. ReAct uses a single example episode.

MethodScoreSuccess rate
Act (1-shot prompt)62.330.1
ReAct (1-shot prompt)66.640.0
IL (1,012 human demonstrations)59.929.1
IL + RL (plus 10,587 instructions)62.428.7
Human expert82.159.6

One-shot Act already matches the trained IL and IL+RL agents. Adding thoughts lifts the success rate to 40.0, 10.9 points over the best trained agent; the abstract rounds this to 10%. Like the abstract's ALFWorld gain (34 points: 71% against BUTLER's 37%), it is in percentage points, not relative. The paper's example of a useful thought: "For 'space-saving ottoman bench for living room', the item has options '39x18x18inch' and 'blue' and seems good to buy." Human experts still lead by 19.6 points of success rate; the paper notes they explore more products and rewrite their queries more often.

What the paper does not show

Prompt-set selection. The 71% ALFWorld result and the 34-point gain in the abstract use the best of six prompt sets, picked by their score on the same 134 test games. The average over the six is 57%. BUTLER's 37% is likewise its best of eight.

Prompting alone does not beat chain-of-thought on HotpotQA. The prompting gains on question answering come from the fallback combinations, which need up to 21 chain-of-thought samples per question as well as ReAct runs.

Why interleaving helps is not established. The comparisons with Act and ReAct-IM show that the right kind of thought helps on ALFWorld. In 2024, Verma, Bhambri and Kambhampati re-ran ALFWorld with GPT-3.5, GPT-4 and Claude-Opus and found that putting all the reasoning in a single thought at the start did as well or better for the GPT models, that placeholder text in place of task-specific thoughts gave comparable results, and that using example episodes from a different task type dropped GPT-3.5-Instruct from 52% to 9% success. Their reading is that success depends mostly on how closely the examples match the test task. The original paper does not run those ablations.

Context length. The conclusion notes that harder tasks with larger action spaces need more demonstrations than fit in the input length of in-context learning. Every model call re-reads the prefix and the whole episode so far.

Reproducibility. PaLM was not publicly available. The authors released prompts and GPT-3 code, and Table 5 reports text-davinci-002 with ReAct at 30.8 HotpotQA exact match (500 validation questions) and 78.4% ALFWorld success, both above PaLM-540B. The paper suggests the gap comes from GPT-3's instruction tuning, without testing it.

Safety. The ethics statement notes that connecting a language model to real actions can mean looking up private information or taking harmful actions. The experiments limit actions to reading Wikipedia and to the WebShop simulator, where nothing is actually bought.

Provenance Verified against primary literatureHow we verify
Yao et al. (2022), arXiv 2210.03629 (v3, ICLR 2023)Primary source. The paper has no numbered equations; equations (1) to (3) on this page are the definitions in its Section 2, numbered here for reference, and (4) and (5) are this page's restatements of the decoding and of the CoT-SC to ReAct rule from Section 3.2. Every score on the page is from Tables 1 to 5 unless marked as read off a plot. Main results use PaLM-540B with greedy decoding; CoT-SC samples 21 chains at temperature 0.7.
github.com/ysymyth/ReAct, hotpotqa.ipynb and wikienv.pyThe released code runs GPT-3 (text-davinci-002), not PaLM. webthink() loops i = 1..7, calls the model on prompt + "Thought i:" with stop ["\nObservation i:"], temperature 0 and max_tokens 100, splits the completion at "\nAction i: ", and calls finish[] with an empty answer if no Finish came. If the split fails, it re-prompts with "Action i:" appended. The evaluation loop shuffles 7,405 dev questions with seed 233 and takes the first 500. WikiEnv.search_step returns the first 5 sentences of the page or "Could not find X. Similar: [...]" with up to 5 titles; lookup returns "(Result k / n)" plus the next matching sentence. The prompt's instruction tells the model search returns "the first paragraph"; the code returns 5 sentences, as the paper says.
github.com/ysymyth/ReAct, alfworld.ipynb and prompts/ALFWorld episodes run for at most 49 model actions (range(1, 50)). An action starting with "think:" is sent to the game but its observation is replaced by "OK.", so thoughts count against the 49. Each prompt holds two exemplars of the same task type (react_<task>_1 then react_<task>_0). Word counts of the HotpotQA exemplars in prompts_naive.json: ReAct 938, Act 515, CoT 308, Standard 114; with the instruction the ReAct prefix is 1,016 words.
Figures 2 and 3 of the paper, digitizedThe sample-count curves and the finetuning bars on this page were read off the published vector plots rendered at 300 dpi and calibrated on the gridlines (about 0.15 points of reading error for the curves, 0.2 for the bars). The 540B bars and the n = 21 endpoints match Table 1 with two exceptions in FEVER: the plotted CoT-SC curve ends near 60.9 where Table 1 says 60.4, and the plotted flat CoT line sits near 59.3 where Table 1 says 56.3. The figure on this page draws the plot as published. At n = 1 the plotted FEVER CoT-SC to ReAct curve starts near 60.7, close to ReAct alone, although the rule as written (majority below n/2) cannot fire with one sample; the paper does not explain this.
Table 5 vs Table 1 of the paperTable 5 lists PaLM-540B ReAct at 29.4 HotpotQA exact match next to GPT-3's 30.8, on a random 500-question validation subset. Table 1 lists PaLM-540B ReAct at 27.4 and CoT at 29.4. The paper does not say whether the 29.4 in Table 5 is a different subset or a copied CoT number.
Wang et al. (2022a), arXiv 2203.11171Self-consistency samples several reasoning chains and "selects the most consistent answer by marginalizing out the sampled reasoning paths", which for unweighted samples is a majority vote over final answers. ReAct uses n = 21 and temperature 0.7.
Verma, Bhambri & Kambhampati (2024), arXiv 2405.13966A follow-up study on ALFWorld with GPT-3.5-Turbo, GPT-3.5-Instruct, GPT-4 and Claude-Opus. Moving all reasoning into one think step at the start did as well or better for the GPT models; placeholder guidance in place of task-specific thoughts gave comparable results; exemplars from a different task type dropped GPT-3.5-Instruct from 52% to 9% success. The authors conclude performance tracks exemplar-query similarity more than interleaved reasoning.
correctionReAct is often summarized as beating chain-of-thought prompting. On HotpotQA, Table 1 of the paper puts ReAct alone at 27.4 exact match, below chain-of-thought (29.4) and below plain question-answer prompting (28.7). ReAct wins on FEVER (60.9 against 56.3), and the best HotpotQA score, 35.1, comes from ReAct falling back to self-consistent chain-of-thought. The abstract's 34-point ALFWorld gain compares ReAct's best of six prompt sets (71%) with BUTLER's best of eight runs (37%); averaged over the six prompt sets ReAct scores 57%, 20 points above BUTLER's best.

Questions you might still have

?

Is ReAct a model, a training method, or a prompt?
A prompt format plus a loop. The main experiments never update any weights: PaLM-540B is prompted with one to six hand-written example episodes, and a short Python loop runs the actions the model writes and pastes the results back. The paper also finetunes PaLM-8B and PaLM-62B on 3,000 ReAct trajectories, but that is a separate experiment.

?

How is ReAct different from chain-of-thought prompting?
Chain-of-thought has the model write its reasoning in one pass, from memory. ReAct interleaves that reasoning with actions whose results come from outside the model, so a later thought can use a fact the model did not know or misremembered. On HotpotQA, 56% of chain-of-thought's wrong answers in the paper's sample came from hallucinated facts, against 0% for ReAct. The chain-of-thought explainer on this site covers the reasoning half on its own.

?

Why does the model not invent the observation itself?
It would if allowed: every example episode in the prompt has an Observation line after each Action line. The harness passes the string "\nObservation i:" as a stop sequence, so decoding halts right before that line, and the real API result is appended in its place.

?

How is this different from retrieval-augmented generation (RAG)?
RAG retrieves passages with a learned retriever from the question, then generates the answer conditioned on them. In ReAct the model writes each query itself as an action, can run several in a row, and decides from what came back what to search next or when to stop. ReAct's Wikipedia tool is also much weaker than a learned retriever: it needs an exact page title. The RAG explainer on this site covers the retriever-based approach.

?

Is this how tool calling in today's chat models works?
The loop has the same shape: the model emits a call, a harness executes it, and the result is appended to the context for the next model call. The paper predates structured function-calling APIs; in ReAct the call is plain text such as Search[Front Row] that the harness parses with string matching, and the format is taught entirely by the examples in the prompt.

?

Do the thoughts show what the model is really computing?
The paper reports that the thoughts make trajectories easier for humans to inspect and lets a human fix a failing ALFWorld run by editing two thoughts. It does not test whether the thoughts are faithful to the computation behind the next action. A 2024 follow-up found that, on ALFWorld, replacing task-specific thoughts with placeholder text gave comparable success rates, which suggests the content of the thoughts matters less than the paper assumes.

?

How many model calls does one question cost?
On HotpotQA, at most 7 thought-and-action calls, each re-reading a 1,016-word prompt prefix plus the growing episode (the released code adds a retry call when the model forgets the Action line). CoT-SC with 21 samples costs 21 calls. The back-off combinations reach CoT-SC's 21-sample accuracy with 3 to 5 samples plus a ReAct run on the questions that need one.

?

Which should I use, ReAct or chain-of-thought?
The paper's answer depends on the task. ReAct alone was better on FEVER, where a claim turns on a detail that has to be looked up, and worse on HotpotQA, where its structure led to more reasoning errors. The best prompting results on both came from combining them with a fallback rule.

Footnotes & further reading

  1. The paper: Yao, Zhao, Yu, Du, Shafran, Narasimhan & Cao, ReAct: Synergizing Reasoning and Acting in Language Models (ICLR 2023). Prompts and GPT-3 code: the ysymyth/ReAct repository and the project page.
  2. Chain-of-thought: Wei et al., Chain-of-Thought Prompting Elicits Reasoning in Large Language Models (2022), covered in the chain-of-thought explainer. Self-consistency: Wang et al., Self-Consistency Improves Chain of Thought Reasoning in Language Models (2022).
  3. Few-shot prompting itself: Brown et al., Language Models are Few-Shot Learners (2020), in the GPT-3 explainer. Retrieval with a learned retriever: Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (2020), in the RAG explainer.
  4. Closest prior agents: Huang et al., Inner Monologue: Embodied Reasoning through Planning with Language Models (2022); Nakano et al., WebGPT (2021); Ahn et al., SayCan (2022). The finetuning bootstrap follows Zelikman et al., STaR (2022).
  5. Benchmarks: Yang et al., HotpotQA (2018); Thorne et al., FEVER (2018); Shridhar et al., ALFWorld (2020); Yao et al., WebShop (2022).
  6. The follow-up ablation study: Verma, Bhambri & Kambhampati, On the Brittle Foundations of ReAct Prompting for Agentic Large Language Models (2024).