Reflexion
In plain wordsA technique in which an AI agent that fails at a task writes itself a short note on what went wrong, then reads that note before trying again — learning from mistakes without retraining.
A method by which a language agentAI agent, n.: An AI system that does not just answer but acts: given a goal, it decides on steps, uses tools such as a browser or code editor, checks the results and keeps going until the job is done. gets better across repeated attempts at a task through written self-critique instead of weight updates. When a trial ends, the agent receives some signal of how it went — success or failure, a score, failing unit tests or free-form comments, from the environment or from its own evaluation — and writes a short note diagnosing what went wrong and what to try instead; the notes accumulate in a memory that is placed in the prompt of later attempts, standing in for the parameter change a policy gradientpolicy gradient, n.: A family of methods that improve an AI's strategy directly: make actions that led to good results a bit more likely, and actions that led to bad results a bit less likely. method would make. Noah Shinn and colleagues (2023) reported improvements in a household-task simulator (ALFWorld), multi-hop question answering (HotpotQA) and programming, including 91% pass@1 on HumanEvalHumanEval, prop. n.: A set of 164 small programming exercises, each described in plain English and checked by hidden tests, used to see whether an AI can write working Python code., above the 80% they cite for GPT-4. Reflexion depends on informative feedback; without a reliable external signal, self-generated critique can entrench errors (see self-correctionself-correction, n.: An AI model noticing and fixing its own mistakes — by rereading its answer, running a test or checking a source — before it gives a final result.).
On its third attempt the Reflexion agent began by rereading its own note: check the file exists before editing.
Origin
Introduced by Noah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan and Shunyu Yao in a paper first posted on 20 March 2023 and published at NeurIPS 2023. Andrew Ng's 2024 'reflection' design pattern generalized the idea of agents critiquing their own output.
Related
- self-correctionself-correction, n.: An AI model noticing and fixing its own mistakes — by rereading its answer, running a test or checking a source — before it gives a final result.
- evaluator–optimizerevaluator–optimizer, n.: A pairing in which one AI produces a draft and another AI grades it and suggests fixes, repeating the cycle until the work is good enough.
- ReActReAct, prop. n.: A method in which an AI alternates between thinking out loud about what to do next and taking an action, such as a web search, then uses what it observed to plan its next step.
- agent memoryagent memory, n.: The ways an AI assistant or agent keeps information — your preferences, past conversations, lessons from earlier tasks — and brings it back later, beyond what fits in a single conversation.
- in-context learningin-context learning, n.: A language model's ability to pick up a new task from instructions or examples placed in its input, on the spot, without any retraining — like a quick study learning a game's rules from one round.
- verifierverifier, n.: A program or AI model that checks whether a proposed answer is correct — by running tests, comparing with a known result or judging the reasoning — so that good answers can be picked or rewarded.
- fine-tuningfine-tuning, n.: Taking an AI model that has already learned a lot and training it a little more on a smaller, focused set of examples so it gets better at one job or behaves a certain way.
Sources
- Shinn, N., Cassano, F., Berman, E., Gopinath, A., Narasimhan, K. & Yao, S. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. arXiv:2303.11366 (NeurIPS 2023). arxiv.org/abs/2303.11366
Mentioned in
ReActReAct, prop. n.: A method in which an AI alternates between thinking out loud about what to do next and taking an action, such as a web search, then uses what it observed to plan its next step., self-correctionself-correction, n.: An AI model noticing and fixing its own mistakes — by rereading its answer, running a test or checking a source — before it gives a final result., episodic memoryepisodic memory, n.: Memory of particular past events — what happened, when and in what order. AI agents keep records of earlier conversations or attempts so they can recall them and learn from them., evaluator–optimizerevaluator–optimizer, n.: A pairing in which one AI produces a draft and another AI grades it and suggests fixes, repeating the cycle until the work is good enough.