Recipes

GEPA

A harness evolution method that reproduces GEPA, reflective prompt evolution, after upstream GEPA v0.1.2. It does not depend on the gepa package.

What it trains#

The text files of the harness tree: the rules, the skills and the commands. GEPA on Reef does not change tool code, config or any other file of the tree. GEPA's merge of two candidates is not implemented: each child comes from one parent.

One GEPA iteration starts in each job. The method samples a parent from the archive's Pareto front and reads the parent's runs on a minibatch with their feedback. A reflection model rewrites one file. A child that beats its parent on the minibatch goes to the job's evaluation, GEPA's validation pass, and Reef keeps it when its mean validation score is above the served tree's. The next job adds the validation scores to the archive. recipe.py names the class that runs each of these parts. algorithm.py describes the iteration and the metric-call budget, and archive.py the Pareto fronts and parent sampling.

When to use it#

To improve harness text on fixed evaluation tasks with a scorer. To change the whole tree, code included, use Meta-Harness. To learn from live sessions without fixed tasks, use ACE or ReasoningBank.

Requirements#

  • A Reef checkout and a model endpoint; no GPU. The example uses OpenAI models and needs OPENAI_API_KEY.
  • The example needs Pi 0.84.2 (REEF_PI_BINARY).
  • The reflection prompt is upstream's, word for word, so it holds trace text without a fence. Use traffic that you trust, or an activation rule that lets a person activate each tree.

Run the example#

Shell
cd recipes/gepa/examples/aime
uv pip install -e .
REEF_PI_BINARY=/path/to/pi ./run.sh --dry-run
export OPENAI_API_KEY=...
REEF_PI_BINARY=/path/to/pi REEF_GEPA_WORKERS=4 ./run.sh

The dry run checks the Pi version and the pinned AIME splits, and makes no model calls. A live run searches with a budget of 150 metric calls, then scores the first and the final tree on the held-out split. --seed and --budget change the search; REEF_GEPA_WORKERS defaults to 128. The AIME example describes the run and its output.

Configuration#

The settings reference describes the recipe.config.evolution keys. Start from the example's gepa.yaml. A deployment sets:

  • recipe.implementation: recipes.gepa.recipe:GEPARecipe. The class names the method, the size of a job and the publication policy, so a deployment sets none of them.
  • evolution.method.config: the fields of GEPASettings in algorithm.py, such as minibatch_size (3), max_metric_calls and components ([rules, skill]). A job starts when minibatch_size reported runs wait; the recipe refuses a recipe.jobs.job-samples of another size.
  • evolution.models.reflection: the reflection model. Without it, the served model reflects.
  • evolution.evaluation: the validation tasks and a scorer. The policy is compare on the mean; the recipe refuses another policy or statistic.

A deployment of reef.recipe.harness:HarnessEvolutionRecipe with evolution.method: recipes.gepa:GEPA still runs the method. It must set statistic: mean and recipe.jobs.job-samples itself.

Results#

GEPA on AIME 2025, two seeds against upstream GEPA: a mean held-out gain of 16.00 points against 12.67 for upstream; the order changes between seeds. The records are in examples/aime/results/.

Files#

Text
gepa/
  __init__.py           exports GEPARecipe, GEPA, GEPASettings, Feedback and ScoreFeedback
  recipe.py             GEPARecipe: the class of each part of an iteration, by the service that runs it
  jobs.py               samples, the data of a job: MinibatchJobData, one job is one minibatch
  algorithm.py          training: GEPA, its settings, one proposal per job, and the archive update of the next job
  evaluation.py         evaluation: ValidationMeanPolicy, the validation pass that keeps a child by its mean score
  feedback.py           the minibatch examples and the Feedback hook that reflection reads
  archive.py            the candidates, Pareto fronts, parent sampling and budget, in state/archive.json
  components.py         the tree's evolvable files as named texts
  reflection.py         the upstream reflection prompt's rendering and its reply extractor
  reflection_prompt.md  the upstream reflection prompt, verbatim
  examples/aime/        the AIME 2025 validation run: harness, seed tree, gepa.yaml and results

The tests are in tests/recipes/gepa/.