Nous.Eval.Optimizer.Strategies.GEPA (nous v0.21.1)

Copy Markdown View Source

Reflective evolution with a Pareto pool (GEPA, Agrawal et al. 2025).

Each step:

  1. Parent - sampled from the Pareto frontier of the pool over the per-case validation scores: a candidate's weight is the number of validation cases on which it reaches the best score, after removing candidates another one dominates (GEPA Alg. 2). Seeded, so a run is reproducible.
  2. Components - one component per step in round-robin order (default), all of them (mode: :all), or a tool's description with its parameter descriptions as one group (mode: :coupled).
  3. Minibatch - the next minibatch_size train cases from a seeded, epoch-shuffled order.
  4. Proposal - the parent is evaluated on the minibatch, the reflector proposes new text from those train cases' records, and the lint runs.
  5. Strict improvement - the child is evaluated on the same minibatch and kept only if its summed objective is strictly higher.
  6. Guard filter - the guard-tagged cases must not regress (Nous.Eval.Optimizer.Context.feasible/3); an infeasible child never enters the pool, so it can never become a parent.
  7. Validation - the child is scored on the whole validation split and added to the pool.

best/1 is the pool member with the highest mean validation score (ties go to the earlier candidate). Every rejected proposal is logged with its reason.

Merge

With merge: n (0 by default, at most 5 in the paper), after an accepted child the next step tries a merge first: two pool members that are not each other's ancestors and share an ancestor are combined component by component (the text from whichever changed it relative to the ancestor; the higher-scoring one when both did). No model call. The merge is kept when its mean validation score is at least that of both sources and it passes the guard filter.