1:1 mentoring with Big Tech AI engineers
LLM & Agentic

Reflexion

Reflexion pattern for self-improving AI agents: verbal reinforcement learning where agents turn failures into written lessons and retry — no gradients required.

Last updated

14

Reflexion: Agents That Learn from Mistakes

Verbal reinforcement learning: the agent fails, writes itself a lesson, and retries with that lesson in context. No gradients, no fine-tuning — learning that happens in plain text, within a session.

THE CENTRAL IDEA

Reinforcement learning improves a policy by turning failures into weight updates. Reflexion (Shinn et al., NeurIPS 2023) does the same thing without touching a single weight: when an attempt fails, a reflection step writes a short natural-language lesson — “I assumed the list was sorted; it isn’t; sort before binary search” — stores it in an episodic memory buffer, and injects it into the context of the next attempt. The feedback signal becomes words instead of gradients. With GPT-4 as the actor, this loop hit 91% pass@1 on HumanEval, beating the same model’s 80% baseline — an 11-point gain purchased entirely with retries and text.

The Reflexion loop — actor, evaluator, self-reflection, memory

Related

More in LLM & Agentic

Get full access to all 87+ sections with code examples, diagrams, and interactive animations.

Unlock Premium