Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Reflexion: Language Agents with Verbal Reinforcement Learning

  • Problem Gradient-based reinforcement learning needs heavy compute and time, so LLM agents have mostly learned from in-context examples.
  • Method Reflexion keeps the model weights fixed, turns scalar or binary feedback into a verbal reflection, and stores that reflection in a bounded episodic memory for later trials.
  • Results Reached 91.0 pass@1 on HumanEval Python, against 80.1 for GPT-4.

Figure 3: (a) AlfWorld performance across 134 tasks showing cumulative proportions of solved tasks
using self-evaluation techniques of (Heuristic) and (GPT) fo…

Figure 3 : (a) AlfWorld performance across 134 tasks showing cumulative proportions of solved tasks using self-evaluation techniques of (Heuristic) and (GPT) for binary classification. (b) Classification of AlfWorld trajectories by reason of failure.

Original paper · CC BY 4.0 · Noah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan, Shunyu Yao · Reflexion: Language Agents with Verbal Reinforcement Learning · Original paper figure · Extracted the figure area from page 6 of the original PDF.

Why weight updates are a poor fit for agents

LLM-based agents generate text and actions that are passed to API calls or executed in an environment. Such agents have so far mostly been taught with in-context examples, because conventional reinforcement learning with gradient descent needs a lot of compute and time for models with very large parameter counts. Reflexion takes a different route.

It leaves the weights alone and turns the feedback from each attempt into text that the agent reads on later attempts.

Where Reflexion sits among earlier work

Self-Refine improves generations through self-evaluation, but it is limited to single-generation reasoning tasks. Beam search over actions adds self-evaluation to decision-making, yet the authors' comparison table gives it no memory component, which Reflexion adds.

In programming, AlphaCode, Self-Debugging and CodeRL rely on ground truth test cases, which the authors say invalidates pass@1 eligibility. CodeT avoids hidden tests but has no self-learning step that improves code writing.

How feedback becomes reflective memory

Reflexion uses three LLM roles. The Actor M_a generates text and actions, the Evaluator M_e scores what the Actor produces, and the Self-Reflection model M_sr writes verbal cues that help the Actor improve. The Actor's policy is written \(\pi_\theta(a_i|s_i)\) with \(\theta = \{M_a, mem\}\), so the memory is part of what the agent conditions on alongside the model itself.

The trajectory of actions and observations in the current trial serves as short-term memory, while the self-reflection outputs are kept as long-term memory.

The Evaluator turns a trajectory into a reward. For reasoning it uses exact match grading, for decision-making pre-defined heuristics, and an LLM instance can also serve as the Evaluator. On the first trial the reward is computed as \(r_t = M_e(\tau_0)\), a scalar that should rise as task performance improves.

After a trial, the Self-Reflection model reads the trajectory with the sparse success signal and its stored memory, then writes a verbal summary that is appended to the memory. That summary can say which earlier action probably caused later failures and which action should replace it, so the next trial can change its choice without any weight update.

Memory is bounded by \(\Omega\), usually set between 1 and 3 stored experiences, so that prompts stay within context limits.

Algorithm 1 repeats this cycle until the Evaluator accepts the trajectory or a maximum number of trials is reached.

AlfWorld: reflection across repeated trials

The agent runs on 134 AlfWorld environments spanning six task types, such as finding hidden objects, moving objects and manipulating objects with other objects. ReAct generates the actions, and the environment signals only task completion, so self-evaluation comes from either an LLM classifier or a hand-written heuristic. In baseline runs a suggested self-reflection is skipped and the environment is reset.

In Reflexion runs the agent reflects first, then starts a new trial with its memory truncated to the last 3 self-reflections.

ReAct with Reflexion completed 130 of 134 tasks and kept gaining over 12 consecutive trials, while ReAct alone stopped improving between trials 6 and 7. The headline result is an absolute 22% improvement over strong baselines on AlfWorld within 12 iterative learning steps. Figure 3 plots the cumulative proportion of solved environments over trials for ReAct alone and for ReAct with Reflexion under the heuristic and GPT classifiers.

A typical baseline failure is an agent that believes it holds an item it does not have, then runs a long chain of actions without backtracking to the mistake. The authors say reflection removes almost all of these cases by distilling failed trajectories into experiences that act as self-hints later. ReAct alone converged at a hallucination rate of 22%, with no sign of long-term recovery.

HotPotQA: reasoning with a binary signal

HotPotQA is a Wikipedia-based dataset of 113k question-and-answer pairs that require reasoning over several supporting documents. One setup gives the model the ground truth context and uses Chain-of-Thought with 6-shot prompting, while the other uses ReAct with 2-shot prompting and a Wikipedia API to retrieve context. Self-reflection uses 2-shot prompting, and between trials exact match grading gives the agent a binary success signal.

The baselines were ReAct-only, CoT-only and CoT (GT)-only. None of them improved on any task that failed in the first trial, at a temperature of 0.7. Reflexion runs retried a failed question until it produced 3 consecutive failed attempts. The CoT (GT) agent still fails 39% of questions, and Reflexion raised its accuracy by 14% without access to the ground truth answer.

Figure 4 shows the success curves for these settings across 100 HotPotQA questions.

To isolate the reflective step, the authors add episodic memory of the most recent trajectory to CoT (GT), then add the standard self-reflection pass on top. In this comparison self-reflection gives an 8% absolute boost beyond the benefit of episodic memory. The authors read this as evidence that refinement without self-reflection is less effective than self-reflection-guided refinement.

Code generation with self-written tests

HumanEval and MBPP are used in Python and, through the MultiPL-E compiler, in Rust, which the authors use to show the approach is language-agnostic. LeetcodeHardGym contains 40 hard-rated Leetcode questions released after October 8, 2022, the pre-training cutoff of GPT-4. Test suites are produced by Chain-of-Thought prompting, filtered by building a valid abstract syntax tree for each test, and then sampled to at most 6 unit tests.

Because the tests are self-generated, pass@1 remains eligible for reporting, and the learning loop uses a memory limit of 1 experience.

Reflexion reached 91.0 pass@1 on HumanEval Python against 80.1 for GPT-4, and 68.0 on HumanEval Rust against 60.0 for GPT-4. On LeetcodeHardGym Python it reached 15.0 against 7.5 for GPT-4, and on MBPP Rust 75.4 against 70.9. MBPP Python is the exception, with Reflexion at 77.1 against 80.1 for GPT-4, a result the authors investigate further.

Table 1 lists these pass@1 values for each benchmark and language.

Table 2 breaks test-generation and solution outcomes down for HumanEval and MBPP in both languages. A false positive is a case where all tests pass but the solution is wrong, and the authors say a false negative is the safer error because reflection can then find the incorrect test and keep a correct solution. The baseline pass@1 is 82% for HumanEval Python and 80% for MBPP Python, yet the false positive test-execution rate is 16.3% for MBPP Python against 1.4% for HumanEval Python.

The authors link the weaker MBPP Python result to this gap.

Table 3 studies Reflexion on the 50 hardest HumanEval Rust problems, comparing the full method with variants that omit parts of it. Removing test generation lowers pass@1 to 0.52 from a 0.60 baseline, while the full Reflexion reaches 0.68. Removing the natural language self-reflection step leaves pass@1 at the baseline's 0.60. The authors say that without unit tests the agent cannot tell whether its implementation is correct, so it makes harmful edits.

Figure 3 is not this table, but Table 3 is the ablation the paragraph describes, and the authors argue that blind trial-and-error debugging without self-reflection is ineffective on harder tasks such as complex Rust programs.

Limitations

Long-term memory is a sliding window with a maximum capacity, and the authors suggest vector embedding databases or SQL databases as future extensions. Because Reflexion is a form of policy optimization in natural language, the authors note that it may settle in non-optimal local minima. Reflexion also depends on the LLM's self-evaluation or on heuristics, and it has no formal guarantee of success.

For code, test-driven development is hard to specify for non-deterministic generator functions, impure functions that call APIs, outputs that depend on hardware, and concurrent behaviour.

Paper info

Authors
Noah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan, Shunyu Yao
Venue
arXiv · Preprint
First published
2023-3-20
Added
2026-10-20
Updated
2023-10-10
Version
v4
arXiv
2303.11366
Category
cs.AI · cs.CL · cs.LG
Original paper terms
CC BY 4.0
What we show
Paper info, commentary and permitted figures from the original paper

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Abstract

Large language models (LLMs) have been increasingly used to interact with external environments (e.g., games, compilers, APIs) as goal-driven agents. However, it remains challenging for these language agents to quickly and efficiently learn from trial-and-error as traditional reinforcement learning methods require extensive training samples and expensive model fine-tuning. We propose Reflexion, a novel framework to reinforce language agents not by updating weights, but instead through linguistic feedback. Concretely, Reflexion agents verbally reflect on task feedback signals, then maintain their own reflective text in an episodic memory buffer to induce better decision-making in subsequent trials. Reflexion is flexible enough to incorporate various types (scalar values or free-form language) and sources (external or internally simulated) of feedback signals, and obtains significant improvements over a baseline agent across diverse tasks (sequential decision-making, coding, language reasoning). For example, Reflexion achieves a 91% pass@1 accuracy on the HumanEval coding benchmark, surpassing the previous state-of-the-art GPT-4 that achieves 80%. We also conduct ablation and analysis studies using different feedback signals, feedback incorporation methods, and agent types, and provide insights into how they affect performance.

Quote from the paper

Noah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan, Shunyu Yao (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. arXiv:2303.11366v4. https://arxiv.org/abs/2303.11366v4

BibTeX
@misc{shinn2023reflexion,
  title = {{Reflexion: Language Agents with Verbal Reinforcement Learning}},
  author = {Noah Shinn and Federico Cassano and Edward Berman and Ashwin Gopinath and Karthik Narasimhan and Shunyu Yao},
  year = {2023},
  eprint = {2303.11366},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.11366v4}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up