HackerPapers

arXiv:2303.11366cs.AI

Reflexion: Language Agents with Verbal Reinforcement Learning

Noah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan, Shunyu Yao

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.

arXiv comments
v4 contains a few additional experiments
Journal reference
DOI
Subjects
cs.AIArtificial Intelligence cs.CLComputation and Language cs.LGMachine Learning

On Hacker News

Linked by 14 identifiable commenters in 19 comments across 19 threads, from Mar 2023 to Oct 2024. Found in 5 HN submissions from Mar 2023 to Mar 2026. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments19 threads

  1. Update on Reflection-70B 1 comment
    • No. CoT has been around for several years (Jan 2022) https://arxiv.org/abs/2201.11903. And so has Reflection (March 2023) https://arxiv.org/abs/2303.11366. This approach that was taken by Reflection is nothing new.

      ipsum2View on HNParent context

    • I think you're 100% on the right track here. The key is memory, loops, and maybe a few other things like external interfaces which are just plain code and not deep learning voodoo. Many things do indeed run LLM's in a loop and attach external sources. See for example AutoGPT…

      unotiView on HNParent context

    • Reflexion can serve as good reference here: https://arxiv.org/abs/2303.11366 Essentially, AI’s output is fed into a checker, whose output is fed back into the AI for “reflexion”. Then the AI often corrects (leading to noticeable improvement in GPT-4 perf).

      avindrothView on HNParent context

    • I don't know how we'd go about comparing reflection to human baselines but GPT-4 can reflect just fine https://arxiv.org/abs/2303.11366 GPT-4's emotional intelligence seems to be very high by the looks of things https://arxiv.org/abs/2304.11490 Empathy =/ Intelligence

      famouswafflesView on HNParent context

  2. Claude 2 1 comment
    • Since I've been on a AI code-helper kick recently. According to the post, Claude 2 now 71.2%, a significant upgrade from 1.3 (56.0%). (Found in model card: pass@1) For comparison: * GPT-4 claims 85.4 on HumanEval, in a recent paper https://arxiv.org/pdf/2303.11366.pdf GPT-4 was…

      lhlView on HNParent context

  3. Langchain Is Pointless 1 comment
    • Chain of thought: https://arxiv.org/abs/2201.11903 ReAct: https://arxiv.org/abs/2210.03629 Reflexion: https://arxiv.org/abs/2303.11366 Tree of thoughts: https://arxiv.org/abs/2305.10601 Good video on "Tree of thoughts" which also reviews / puts it in the context of other…

      krychuView on HNParent context

    • >GPT cannot function in any environment on its own. Except in response to a direct instruction it cannot plan, it cannot take action, it cannot learn, it cannot adjust to changing circumstance. Sure it can. It's not default behavior sure but it's fairly trivial to set up, just…

      famouswafflesView on HNParent context

    • If performance is a concern, just re-prompt GPT if there are any performance concerns, and to propose fixes for them if there are. This is called reflexion and has been found to be an effective way to improve response accuracy and usefulness (also reduces hallucinations).…

      stevenhuangView on HNParent context

    • >Idk about “above average baseline” That's the minimum. It's far above average for most things. >Maybe, because quite a lot of people aren’t very smart. Lol okay..and ? >But even GPT4 struggles with complex logic problems So does everyone else >and when it makes logic errors it…

      famouswafflesView on HNParent context

    • >the systems operation are well understood That's like saying human behavior is well understood because we know how neurons communicate signals. It's too low level to be useful, hence psychology. >They don't have the ability to reason or reflect. Yes they do…

      famouswafflesView on HNParent context

    • You've been told it doesn't need that much handholding. https://arxiv.org/abs/2303.11366 https://arxiv.org/abs/2303.17651 Why insist otherwise ?

      famouswafflesView on HNParent context

  4. Defamed by ChatGPT 1 comment
    • That part on providing the opportunity to check its answers is called reflexion and has been shown to significantly improve accuracy and reliability of LLM responses. Very cool. https://arxiv.org/abs/2303.11366 https://evjang.com/2023/03/26/self-reflection.html

      stevenhuangView on HNParent context

    • There's a lot of work happening at the moment around self-reflection and getting LLMs to identify and correct their own hallucinations and mistakes. https://arxiv.org/pdf/2303.11366.pdf

      VeenView on HNParent context

    • Check out https://arxiv.org/abs/2303.11366?s=09 ;) We aren't introspecting previous runs or human examples to optimize workflows right now, but it's a powerful tool and one that I expect we'll employ in the future to make Taxy more efficient and reliable.

      kcorbittView on HNParent context

    • The Reflexion paper (https://arxiv.org/abs/2303.11366) that came out recently shows how this kind of mistake might be overcome. Asking the model to think about the answer after it's generated a first draft greatly improves accuracy. Also, prompt engineering such as copying the…

      sacred_numbersView on HNParent context

    • Reflexion: an autonomous agent with dynamic memory and self-reflection, https://arxiv.org/abs/2303.11366 Add an interpreter as per this article, and we're basically there.

      naaskingView on HNParent context

    • It was already trained like this, RLHF [0] is a loop that has ways to feed it the information to "move forward" - update its weights. It was fine-tuned like this. It certainly did ignite something - maybe sparks of AGI, maybe just sparks of pretending to be more liked by humans…

      DzugaruView on HNParent context

    • the paper: https://arxiv.org/pdf/2303.11366.pdf it reminds me of the thinking-fast vs. thinking-slow dichotomy. Current llms are the thinking fast type. Funnily people’s complains about its errors are reminiscent of this. It answers just to quick and only with its instant…

      isaacfrondView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.