Key Concepts
GEPA merges genetic algorithms (selection, crossover, mutation, elitism) with Pareto optimization (multi-objective trade-offs). Its distinguishing feature is the use of natural language reflections to guide the evolutionary process.
Basic Usage
from gepa import GEPAOptimizer
optimizer = GEPAOptimizer(
population_size=20,
generations=10,
mutation_rate=0.2,
crossover_rate=0.7,
objectives=["accuracy", "clarity", "completeness"],
reflection_model="gpt-4"
)
compiled = optimizer.compile(
program=program,
trainset=training_data,
valset=validation_data
)