Tune.Optimizers.Reflective (Tune v0.5.0)

Copy Markdown View Source

The reflective evolutionary search shared by GEPA and Optimize.Anything.

A component is one tunable text: a predictor instruction, or a declared parameter value rendered as text. The search keeps a pool of candidates, each fully evaluated on the validation set with per-row scores and lineage. Each iteration either:

  • reflects: selects a parent from the per-row Pareto frontier (a candidate is sampled in proportion to the number of validation rows on which it has the best score), picks the parent's next component round robin, runs the parent on a training minibatch, sends the trajectories with their scores and metric feedback to the proposal role, and builds a child with the proposed text. The child is scored on the same minibatch and gets a full validation pass only if it beats the parent's minibatch total; or
  • merges: every merge_every iterations, finds two pool candidates with a common ancestor that changed different components, combines those changes into one child, and validates it.

Only complete, eligible validation results can become the incumbent; ties keep the earlier candidate.

Summary

Types

component()

@type component() :: %{
  name: String.t(),
  get: (Tune.t() -> String.t()),
  put: (Tune.t(), String.t() -> {:ok, Tune.t()} | {:error, term()}),
  propose: (Tune.Search.Program.Context.t(), String.t(), String.t() ->
              {String.t() | nil, Tune.Search.Program.Context.t()})
}

Functions

run(config, program, components, ctx)