Skip to content
ReAct: Synergizing Reasoning and Acting in Language Models 3 min

Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, Yuan Cao · ICLR 2023

ReAct: Synergizing Reasoning and Acting in Language Models

The paper behind tool-using agents: think, act, observe, repeat. Compare an answer from memory with one grounded in a tiny encyclopedia.

Read the original paper

AI & ML · Yellow Belt · Pro · 3 min read

ReAct: Synergizing Reasoning and Acting in Language Models

A large language model can write fluent answers, but it only knows what it saw in training. Ask it about something recent or obscure and it may make up an answer that sounds right. Two ideas had grown up to help. One is chain-of-thought prompting, where the model reasons step by step. The other is letting the model act, by calling tools such as a search engine.

Until this 2022 paper, the paper says, those abilities had been studied mostly as separate topics. The authors ask: what if the model does both, in turns? ReAct, short for reason plus act, has the model write a short thought, take an action, read the result, and think again. It is the pattern behind many of today's tool-using AI agents.

ReAct prompts a language model to alternate between thoughts and actions. Thoughts help it plan, track progress and handle surprises. Actions, such as searching Wikipedia, bring in real facts. Together they reduce made-up answers and make the model's steps easy for a person to read and check.

Thinking and doing, in turns

The paper describes an agent in a loop. At each step it sees an observation from its environment and takes an action. ReAct adds one idea: the set of things the model can do now includes writing a thought, a bit of language that does not change the world, but updates the model's own context. A thought can break a goal into steps, note what has been found so far, or decide what to do about a surprise.

Comparison in the spirit of the paper's Figure 1. Reasoning alone can drift into guesses. Acting alone has no plan. ReAct interleaves the two.

In the question answering tests, the authors gave the model a tiny set of actions through a Wikipedia API. search[entity] returns the first five sentences of a page. lookup[string] returns the next sentence on the page that contains the string, like pressing Ctrl+F. finish[answer] ends the task.

Keep reading with Pro

This paper is part of Pro. Pro and Architect open the full breakdown, with animated diagrams, interactive elements you can play with and a quiz. A few papers stay free to read in full.

Still to read

2 more sections, 1 more diagram and 2 interactive elements to play with

  • Why it helps
  • What the paper found

Found this breakdown useful?

Share it with someone else wrestling with this paper.

Discussion0

Join the Discussion

Sign in to leave comments, reply to others, or like insights.

Sign In to ScaleDojo

No comments yet. Be the first to start the thread!

Enjoyed this? Get more like it.

New paper breakdowns, levels, and one concept worth knowing, straight to your inbox.

No spam, ever. Unsubscribe in one click.

Enjoyed this content?

Your support keeps us creating free resources

We put a lot of hours into researching and writing these guides. If it helped you, consider buying us a coffee. Every bit goes toward keeping ScaleDojo's content free and growing.

$

One-time payment via Stripe. ScaleDojo account required.