AI engineering paper · 2023
ReAct
How ReAct lets a language model alternate between thinking and acting, so it can look things up, check its work and recover from dead ends.
You’ll learn to
- Explain how ReAct interleaves thoughts, actions and observations, and what the program around the model has to do.
- Trace a ReAct run step by step, including a dead end, and say what each thought contributed.
- Compare ReAct with thinking-only and acting-only prompts on the paper’s four benchmarks, and say where it won and where it lost.
- Name what changed after the paper: built-in tool calling, thinking between tool calls and fine-tuning on trajectories.
The idea in short
A language model that only thinks out loud can state wrong facts with full confidence, and nothing stops it. A model that only acts, by calling a search or clicking a button, has no plan and loses its place. ReAct lets one model do both in a single loop: write a thought, take an action, read what came back, and repeat.
The thoughts keep the plan and notice when something went wrong. The actions bring in real information from outside the model. The paper showed this with no training at all, just a few written examples in the prompt, and it became the basic shape of the agents engineers build today.
The problem
This guide covers “ReAct: Synergizing Reasoning and Acting in Language Models” (Yao and six co-authors, 2022). By then, large could do two separate things well, and each had a flaw.
The first was reasoning in words. With , you show the model a few examples where the answer comes with the steps that lead to it, and the model then writes out its own steps before answering. This raised accuracy on maths and logic questions. But the model only has what is stored in its weights, the numbers it learned in training. If it half-remembers a fact, it writes the wrong fact as part of step one, builds on it, and ends in a confident, wrong answer. The paper calls this and : a mistake early in the chain carries through every later step.
The second was acting. Other work used language models to choose actions in a game, a website or a robot simulator, one step at a time. These models got real information back from the world, but they did not say why they chose an action. They had no plan to check progress against, no way to say “that did not work, try something else”, and no way to keep track of sub-goals over a long task.
Yao and co-authors saw that these were two halves of how people solve problems. Thinking guides the doing, and the doing changes the thinking.
So the question the paper asks is: can one language model be prompted to reason and act together, in one loop, without any training?