GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning

Lakshya A Agrawal, Shangyin Tan, Dilara Soylu, Noah Ziems, Rishi Khare +12 more
7/25/2025
cs.CLcs.AIcs.LG

Official code: gepa-ai/gepa (5,392 stars, MIT, last commit 2026-04-30). 3 more implementations below.

Abstract

Large language models (LLMs) are increasingly adapted to downstream tasks via reinforcement learning (RL) methods like Group Relative Policy Optimization (GRPO), which often require thousands of rollouts to learn new tasks. We argue that the interpretable nature of language can often provide a much richer learning medium for LLMs, compared with policy gradients derived from sparse, scalar rewards. To test this, we introduce GEPA (Genetic-Pareto), a prompt optimizer that thoroughly incorporates natural language reflection to learn high-level rules from trial and error. Given any AI system containing one or more LLM prompts, GEPA samples system-level trajectories (e.g., reasoning, tool calls, and tool outputs) and reflects on them in natural language to diagnose problems, propose and test prompt updates, and combine complementary lessons from the Pareto frontier of its own attempts. As a result of GEPA's design, it can often turn even just a few rollouts into a large quality gain. Across four tasks, GEPA outperforms GRPO by 10% on average and by up to 20%, while using up to 35x fewer rollouts. GEPA also outperforms the leading prompt optimizer, MIPROv2, by over 10% across two LLMs, and demonstrates promising results as an inference-time search strategy for code optimization.

View on arXivView PDF

Code Implementations(4)

gepa-ai/gepaOfficial100%
MIT

Optimize prompts, code, and more with AI-powered Reflective Text Evolution

5,392440HTML, PythonAug 5, 20255 months agoMIT
fwaris/FsGEPACommunity67%
MIT

A F# implementation of GEPA (Genetic Evolutionary Prompt Augmentation) for optimizing compound AI systems. Based on the paper "GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning."

60F#Aug 17, 20256 months agoMIT

Benchmarking and proposing an alternative sampling strategy for GEPA (https://arxiv.org/abs/2507.19457)

00PythonNov 18, 202511 months ago

Experiments on the GEPA paper: https://arxiv.org/pdf/2507.19457

40Python, Jupyter NotebookAug 2, 20251 years ago

Similar Papers

Cite this paper

@article{agrawal2025gepa,
  title  = {GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning},
  author = {Lakshya A Agrawal and Shangyin Tan and Dilara Soylu and Noah Ziems and Rishi Khare and Krista Opsahl-Ong and Arnav Singhvi and Herumb Shandilya and Michael J Ryan and Meng Jiang and Christopher Potts and Koushik Sen and Alexandros G. Dimakis and Ion Stoica and Dan Klein and Matei Zaharia and Omar Khattab},
  year   = {2025},
  eprint = {2507.19457},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.19457v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.19457.svg)](https://codeofpaper.com/paper/2507.19457)

Discussion