GEPAOptimizer
GEPA (Genetic-Pareto Optimizer for Reflective Prompt Evolution).
An instruction-only optimizer that evolves module instructions via reflective LLM feedback on failure cases, with Pareto-based candidate selection for diversity.
Early implementation. This is a non-official re-implementation that deviates from the original GEPA algorithm (https://arxiv.org/abs/2507.19457) and may underperform the paper. Validate on your own task before relying on it; closing the gap is future work.
Key differences from MIPROv2:
Optimizes instructions only (no demonstrations) -> shorter, more generalizable prompts
Uses textual feedback from a reflection LM analyzing failure traces
a Pareto frontier maintains diverse candidate pool (vs. best-so-far)
Optional crossover merges complementary candidates
Parameters
LLM model for reflection / instruction proposal. Calls are routed through the training DSL's tracked executePrompt, so timing and consumption are recorded under the appropriate iteration stage.
Path for saving the optimization artifact.
Maximum number of evolution iterations.
Number of training items sampled per iteration for reflection.
How to select which modules to update each iteration.
Whether to attempt merging complementary candidates during the loop.
Maximum number of crossover attempts per optimization run.
Seed for reproducibility.
Converts a dataset item's label to a string for the reflection LM.
Constructors
Types
Persistence helpers for the evolved OptimizationArtifact.
Functions
Trains the agent using the provided session, which gives access to a TrainingSession.use block where the training scope (agent, dataset, tracked execution methods) is available.