freshcrate
Home > Frameworks > gepa

gepa

A framework for optimizing textual system components (AI prompts, code snippets, etc.) using LLM-based reflection and Pareto-efficient evolutionary search.

Description

<p align="center"> <img src="https://raw.githubusercontent.com/gepa-ai/gepa/refs/heads/main/assets/gepa_logo_with_text.svg" alt="GEPA Logo" width="450"> </p> <p align="center"> <strong>Optimize any text parameter — prompts, code, agent architectures, configurations — using LLM-based reflection and Pareto-efficient evolutionary search.</strong> </p> <p align="center"> <a href="https://gepa-ai.github.io/gepa/"><strong>Website</strong></a> &ensp;|&ensp; <a href="https://gepa-ai.github.io/gepa/guides/quickstart/"><strong>Quick Start</strong></a> &ensp;|&ensp; <a href="https://arxiv.org/abs/2507.19457"><strong>Paper</strong></a> &ensp;|&ensp; <a href="https://gepa-ai.github.io/gepa/blog/"><strong>Blog</strong></a> &ensp;|&ensp; <a href="https://discord.gg/WXFSeVGdbW"><strong>Discord</strong></a> </p> <p align="center"> <a href="https://pypi.org/project/gepa/"><img src="https://img.shields.io/pypi/v/gepa?logo=python&logoColor=white&color=3776ab" alt="PyPI"></a> <a href="https://pepy.tech/projects/gepa"><img src="https://static.pepy.tech/badge/gepa" alt="Downloads"></a> <a href="https://github.com/gepa-ai/gepa"><img src="https://img.shields.io/github/stars/gepa-ai/gepa?style=flat&logo=github&color=181717" alt="GitHub stars"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green?style=flat" alt="License"></a> </p> <p align="center"> <a href="https://join.slack.com/t/gepa-ai/shared_invite/zt-3o352xhyf-QZDfwmMpiQjsvoSYo7M1_w"><img src="https://badgen.net/badge/icon/Slack?icon=slack&label&color=4A154B" alt="Slack"></a> <a href="https://discord.gg/WXFSeVGdbW"><img src="https://dcbadge.limes.pink/api/server/https://discord.gg/WXFSeVGdbW?style=flat" alt="Discord"></a> </p> --- ## What is GEPA? **GEPA** (Genetic-Pareto) is a framework for optimizing any system with textual parameters against any evaluation metric. Unlike RL or gradient-based methods that collapse execution traces into a single scalar reward, GEPA uses LLMs to *read* full execution traces — error messages, profiling data, reasoning logs — to diagnose *why* a candidate failed and propose targeted fixes. Through iterative reflection, mutation, and Pareto-aware selection, GEPA evolves high-performing variants with minimal evaluations. **If you can measure it, you can optimize it**: prompts, code, agent architectures, scheduling policies, vector graphics, and more. ### Key Results | | | |---|---| | **90x cheaper** | Open-source models + GEPA beat Claude Opus 4.1 at [Databricks](https://www.databricks.com/blog/building-state-art-enterprise-agents-90x-cheaper-automated-prompt-optimization) | | **35x faster than RL** | 100–500 evaluations vs. 5,000–25,000+ for GRPO ([paper](https://arxiv.org/abs/2507.19457)) | | **32% → 89%** | ARC-AGI agent accuracy via [architecture discovery](https://gepa-ai.github.io/gepa/blog/introducing-optimize-anything/#5-agent-architecture-discovery) | | **40.2% cost savings** | Cloud scheduling policy [discovered by GEPA](https://gepa-ai.github.io/gepa/blog/introducing-optimize-anything/#3-systems-research), beating expert heuristics | | **55% → 82%** | Coding agent resolve rate on Jinja via [auto-learned skills](https://gepa-ai.github.io/gepa/blog/automatically-learning-skills-for-coding-agents/) | | **50+ production uses** | Across Shopify, Databricks, Dropbox, OpenAI, Pydantic, MLflow, Comet ML, and [more](https://gepa-ai.github.io/gepa/guides/use-cases/) | > *"Both DSPy and (especially) **GEPA are currently severely under hyped** in the AI context engineering world"* — **Tobi Lutke**, CEO, Shopify --- ## Installation ```bash pip install gepa ``` To install the latest from `main`: ```bash pip install git+https://github.com/gepa-ai/gepa.git ``` --- ## Quick Start ### Simple Prompt Optimization Optimize a system prompt for math problems from the AIME benchmark in a few lines of code ([full tutorial](https://dspy.ai/tutorials/gepa_aime/)): ```python import gepa trainset, valset, _ = gepa.examples.aime.init_dataset() seed_prompt = { "system_prompt": "You are a helpful assistant. Answer the question. " "Put your final answer in the format '### <answer>'" } result = gepa.optimize( seed_candidate=seed_prompt, trainset=trainset, valset=valset, task_lm="openai/gpt-4.1-mini", max_metric_calls=150, reflection_lm="openai/gpt-5", ) print("Optimized prompt:", result.best_candidate['system_prompt']) ``` **Result:** GPT-4.1 Mini goes from 46.6% → 56.6% on AIME 2025 (+10 percentage points). ### With DSPy (Recommended for AI Pipelines) The most powerful way to use GEPA for prompt optimization is within [DSPy](https://dspy.ai/), where it's available as `dspy.GEPA`. See [dspy.GEPA tutorials](https://dspy.ai/tutorials/gepa_ai_program/) for executable notebooks. ```python import dspy optimizer = dspy.GEPA( metric=your_metric, max_metric_calls=150, reflection_lm="openai/gpt-5", ) optimized

Release History

VersionChangesUrgencyDate
0.1.1Imported from PyPI (0.1.1)Low4/21/2026
v0.1.1### Highlights **Candidate Tree Visualization** — GEPA now generates an interactive HTML lineage tree of all candidates explored during optimization. Nodes are color-coded by role (best, Pareto front, seed) with hover previews and click-to-pin tooltips for reading full prompt text. The tree is automatically logged to WandB and MLflow at each step — no configuration needed. ([#256](https://github.com/gepa-ai/gepa/pull/256)) **gskill: Automated Skill Learning for Coding Agents** — A new `gepLow3/16/2026
v0.1.0Introducing optimize_anything, GEPA's new API for optimizing any text parameter. Checkout the blogpost at https://gepa-ai.github.io/gepa/blog/2026/02/18/introducing-optimize-anything/ ## What's Changed * Automated docs and website by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/176 * Make ARC_AGI example readable in docs by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/177 * Add GA by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/179 * Add more external rLow2/19/2026
v0.0.27## What's Changed * Update README by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/174 * Add callback system for optimization instrumentation by @dbreunig in https://github.com/gepa-ai/gepa/pull/155 ## New Contributors * @dbreunig made their first contribution in https://github.com/gepa-ai/gepa/pull/155 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.26...v0.0.27Low1/28/2026
v0.0.26## What's Changed * Add cache by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/166 * Fix a 1-line bug where cloudpickle wasn't used sometimes when it should by @4gatepylon in https://github.com/gepa-ai/gepa/pull/167 * Validate seed_candidate at optimize() entry point by @Copilot in https://github.com/gepa-ai/gepa/pull/169 * Fix MLflow logging, and add tracking for how many metric calls have been issued by @chenmoneygithub in https://github.com/gepa-ai/gepa/pull/171 ## New ContrLow1/24/2026
v0.0.25## What's Changed * Add Python 3.14 support by @Copilot in https://github.com/gepa-ai/gepa/pull/165 ## New Contributors * @Copilot made their first contribution in https://github.com/gepa-ai/gepa/pull/165 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.24...v0.0.25Low1/20/2026
v0.0.24## What's Changed * Allow for objective and hybrid pareto frontier tracking by @MatsErdkamp in https://github.com/gepa-ai/gepa/pull/92 ## New Contributors * @MatsErdkamp made their first contribution in https://github.com/gepa-ai/gepa/pull/92 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.23...v0.0.24Low1/5/2026
v0.0.23## What's Changed * Update README.md by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/135 * Add HuggingFace Cookbook link for prompt optimization by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/136 * Fix/145 write outputs not scores by @05satyam in https://github.com/gepa-ai/gepa/pull/151 * feat(default_adapter): configurable eval returns score + feedback (#62) by @villurignanesh in https://github.com/gepa-ai/gepa/pull/147 * Add MCP (Model Context Protocol) Adapter SuLow12/28/2025
v0.0.22## What's Changed * Skip components that are not present in reflective dataset instead of raising KeyError failure by @heyalexchoi in https://github.com/gepa-ai/gepa/pull/76 ## New Contributors * @heyalexchoi made their first contribution in https://github.com/gepa-ai/gepa/pull/76 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.21...v0.0.22Low11/10/2025
v0.0.21## What's Changed * Add logging option for individual valset scores by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/131 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.20...v0.0.21Low11/8/2025
v0.0.20## What's Changed * Enhance types by @mwildehahn in https://github.com/gepa-ai/gepa/pull/93 * Update README with new GEPA projects and articles by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/129 * Remove 'stubPath' from pyrightconfig.json by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/130 ## New Contributors * @mwildehahn made their first contribution in https://github.com/gepa-ai/gepa/pull/93 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.19Low11/7/2025
v0.0.19## What's Changed * Dynamic Validation in GEPAState by @aria42 in https://github.com/gepa-ai/gepa/pull/100 * Allowing custom batch_sampler by @CrisRodriguez in https://github.com/gepa-ai/gepa/pull/119 * epsilon greedy candidate selector by @vacmar01 in https://github.com/gepa-ai/gepa/pull/109 * Add batch_completion_kwargs by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/127 ## New Contributors * @aria42 made their first contribution in https://github.com/gepa-ai/gepa/pull/100 Low11/4/2025
v0.0.18## What's Changed * Mock wandb and mlflow instead of testing storage by @TomeHirata in https://github.com/gepa-ai/gepa/pull/89 * Update README.md by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/90 * Fix parsing for ``` blocks with language in InstructionProposalSignature by @CDBiddulph in https://github.com/gepa-ai/gepa/pull/99 * Fix reflective proposer stalling by consuming metric budget on trace failures by @fgn in https://github.com/gepa-ai/gepa/pull/98 * Highlight GEPA UsecaLow10/25/2025
v0.0.17## What's Changed * Add reference to ATLAS+GEPA for incident diagnosis by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/84 * Add new GEPA-related resources to README by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/88 * fix: gepa state initialization from run_dir by @enitrat in https://github.com/gepa-ai/gepa/pull/86 ## New Contributors * @enitrat made their first contribution in https://github.com/gepa-ai/gepa/pull/86 **Full Changelog**: https://github.com/gepa-aLow9/25/2025
v0.0.16**Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.15...v0.0.16Low9/24/2025
v0.0.15-alpha.1## What's Changed * Add link for 100% accuracy using GEPA on clock-hands problem by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/78 * Update README.md by @LakshyAAAgrawalP in https://github.com/gepa-ai/gepa/pull/82 * Bug Fix: copy base valset eval output as pareto front by @aobo-y in https://github.com/gepa-ai/gepa/pull/81 * Improve logging for subsample scores in GEPA engine by @CDBiddulph in https://github.com/gepa-ai/gepa/pull/83 ## New Contributors * @LakshyAAAgrawalP madLow9/24/2025
v0.0.15## What's Changed * Add link for 100% accuracy using GEPA on clock-hands problem by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/78 * Update README.md by @LakshyAAAgrawalP in https://github.com/gepa-ai/gepa/pull/82 * Bug Fix: copy base valset eval output as pareto front by @aobo-y in https://github.com/gepa-ai/gepa/pull/81 * Improve logging for subsample scores in GEPA engine by @CDBiddulph in https://github.com/gepa-ai/gepa/pull/83 ## New Contributors * @LakshyAAAgrawalP madLow9/24/2025
v0.0.14## What's Changed * Add max candidates stopper by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/77 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.13...v0.0.14Low9/22/2025
v0.0.13## What's Changed * Add link for multi-agent system in healthcare using DSPy by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/68 * RAG Optimization: Add Generic RAG Adapter with support for major vector databases by @Shashikant86 in https://github.com/gepa-ai/gepa/pull/60 * Add GEPA Talk Slides link to README by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/73 * Safely stop run by @ShriyaaNarayanan in https://github.com/gepa-ai/gepa/pull/64 ## New Contributors * @ShLow9/22/2025
v0.0.12**Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.11...v0.0.12Low9/9/2025
v0.0.11## What's Changed * Add video link to README by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/63 * Add 'all' component selector for selecting all components by @andressrg in https://github.com/gepa-ai/gepa/pull/67 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.10...v0.0.11Low9/9/2025
v0.0.10## What's Changed * Introduce mlflow by @TomeHirata in https://github.com/gepa-ai/gepa/pull/51 ## New Contributors * @TomeHirata made their first contribution in https://github.com/gepa-ai/gepa/pull/51 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.9...v0.0.10Low9/5/2025
v0.0.9## What's Changed * Added `google-auth` as dependency to make LiteLLM Google Vertex-friendly ... by @egmaminta in https://github.com/gepa-ai/gepa/pull/41 * Revise README with additional GEPA resources and clarity by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/55 * Add ARC-AGI example by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/57 * Add custom component selector support to optimize() by @andressrg in https://github.com/gepa-ai/gepa/pull/52 ## New Contributors Low9/5/2025
v0.0.8## What's Changed * feat: improved the README.md for AnyMaths; fixed AnyMathsAdapter code; provided example training and dataset preparation; added eval results and sample eval code by @egmaminta in https://github.com/gepa-ai/gepa/pull/15 * Enhance README with Discord badge and video tutorial by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/37 * GEPA to evolve the full DSPy program, including structure by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/38 * Fix long outpuLow9/3/2025
v0.0.7## What's Changed * Fix TQDM by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/32 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.6...v0.0.7Low8/25/2025
v0.0.6**Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5...v0.0.6Low8/25/2025
v0.0.6-alpha.3**Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.6-alpha.2...v0.0.6-alpha.3Low8/25/2025
v0.0.6-alpha.2**Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.6-alpha.1...v0.0.6-alpha.2Low8/25/2025
v0.0.6-alpha.1**Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5...v0.0.6-alpha.1Low8/25/2025
v0.0.5## What's Changed * feat: GEPAAdapter for any maths, reasoning dataset in HuggingFace; Ollama-friendly by @egmaminta in https://github.com/gepa-ai/gepa/pull/7 * feat: add terminal bench example by @Shangyint in https://github.com/gepa-ai/gepa/pull/6 * misc: split tb adapter into adapter folder by @Shangyint in https://github.com/gepa-ai/gepa/pull/8 * fix: add more experiments and fix path issues by @Shangyint in https://github.com/gepa-ai/gepa/pull/11 * Add Replayable AIME Prompt OptimizatiLow8/24/2025
v0.0.5-alpha.13**Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.12...v0.0.5-alpha.13Low8/24/2025
v0.0.5-alpha.12## What's Changed * Fix wait-on-check by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/23 * Fix names by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/24 * Remove status checks by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/25 * Remove check status by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/26 * Fix uv venv by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/27 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5Low8/24/2025
v0.0.5-alpha.11## What's Changed * Fix uv venv by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/27 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.10...v0.0.5-alpha.11Low8/24/2025
v0.0.5-alpha.10## What's Changed * Remove check status by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/26 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.9...v0.0.5-alpha.10Low8/24/2025
v0.0.5-alpha.9## What's Changed * Remove status checks by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/25 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.8...v0.0.5-alpha.9Low8/24/2025
v0.0.5-alpha.8## What's Changed * Fix names by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/24 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.7...v0.0.5-alpha.8Low8/24/2025
v0.0.5-alpha.7## What's Changed * Fix wait-on-check by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/23 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.6...v0.0.5-alpha.7Low8/24/2025
v0.0.5-alpha.6## What's Changed * Try running tests on tag pushes by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/22 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.5...v0.0.5-alpha.6Low8/24/2025
v0.0.5-alpha.5## What's Changed * Fix workflow by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/21 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.4...v0.0.5-alpha.5Low8/24/2025
v0.0.5-alpha.4## What's Changed * Fix status checks by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/20 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.3...v0.0.5-alpha.4Low8/24/2025
v0.0.5-alpha.3## What's Changed * Fix circular checks by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/19 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.2...v0.0.5-alpha.3Low8/24/2025
v0.0.5-alpha.2## What's Changed * Fix token by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/18 **Full Changelog**: https://github.com/gepa-ai/gepa/compare/v0.0.5-alpha.1...v0.0.5-alpha.2Low8/24/2025
v0.0.5-alpha.1## What's Changed * Make v0.0.1 of GEPA by @LakshyAAAgrawal in https://github.com/gepa-ai/gepa/pull/1 * feat: GEPAAdapter for any maths, reasoning dataset in HuggingFace; Ollama-friendly by @egmaminta in https://github.com/gepa-ai/gepa/pull/7 * feat: add terminal bench example by @Shangyint in https://github.com/gepa-ai/gepa/pull/6 * misc: split tb adapter into adapter folder by @Shangyint in https://github.com/gepa-ai/gepa/pull/8 * fix: add more experiments and fix path issues by @ShangyinLow8/23/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

pre-commitA framework for managing and maintaining multi-language pre-commit hooks.v4.6.0
azure-core-tracing-opentelemetryMicrosoft Azure Azure Core OpenTelemetry plugin Library for Pythonazure-template_0.1.0b6187637
spdx-toolsSPDX parser and tools.0.8.5
lacesDjango components that know how to render themselves.0.1.2
django-tasksA backport of Django's built in Tasks framework0.12.0