Reproduce “Reflexion: Language Agents with Verbal Reinforcement Learning” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

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

Reflexion helps language agents learn from failed attempts by storing a written self-reflection in memory and conditioning the next trial on it, without changing model weights. An Actor proposes actions, an Evaluator supplies feedback, and a reflection model diagnoses errors. On HumanEval Python, it reports 91.0% pass@1 versus GPT-4’s 80.1%, while MBPP reports 77.1% versus 80.1%.

Key insights

  • Converting numerical or binary environmental feedback into structured natural language "self-reflections" provides a more interpretable and actionable "semantic gradient signal" for LLMs.
  • Maintaining an explicit, persistent episodic memory of these verbal reflections allows LLM agents to accumulate experience and prevent repetitive errors over multiple trials.
  • LLMs possess an emergent ability for self-reflection that can be effectively harnessed to enable efficient, lightweight learning from failures in complex tasks like coding and sequential decision-making.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.