# ReAct (2022)

> Prompt a language model to alternate thoughts with actions, read what each action returns, and keep going until the task is done.

Page: https://mralbu.github.io/ai-datasets/p/react

## Key facts

- Title: ReAct: Synergizing Reasoning and Acting in Language Models
- Authors: Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, Yuan Cao
- Venue: ICLR 2023
- Category: LLMs
- Paper: https://www.alphaxiv.org/abs/2210.03629

## Why it matters

The loop of thinking, calling a tool and reading the result is how almost every LLM agent still works, from search assistants to coding agents. Tool calling in today's model APIs is the same pattern built into the model.

## The idea

Chain-of-thought reasons only from what the model already knows, so it can invent facts. ReAct lets the model write a thought, then an action, such as searching Wikipedia or looking up a word in a page, then reads the result as an observation and writes the next thought. A few hand-written examples of such thought–action–observation traces are enough to prompt the pattern.

## The result

With PaLM-540B and a three-command Wikipedia tool, ReAct was more grounded than chain-of-thought on HotpotQA: 6% of its correct answers rested on hallucinated facts, against 14% for chain-of-thought, and combining the two gave the best exact match (35.1). In the ALFWorld text game and the WebShop shopping site, one or two examples beat imitation and reinforcement-learning agents trained on thousands of tasks, by 34 and 10 points of success rate.

## The data

- [HotpotQA (2018)](https://mralbu.github.io/ai-datasets/d/hotpotqa.md): 113,000 questions that need facts from two Wikipedia paragraphs, with the supporting sentences marked.

## Builds on

- [Chain of thought (2022)](https://mralbu.github.io/ai-datasets/p/chain-of-thought.md)

## Led to

- [SWE-agent (2024)](https://mralbu.github.io/ai-datasets/p/swe-agent.md)

## Part of

- [Coding agents](https://mralbu.github.io/ai-datasets/t/coding-agents.md) (step 2 of 8)
