Reflective mutation proposer.
Generates new candidates through reflection on execution traces.
Candidate text must be proposed by the adapter, a custom proposer, or an
instruction_proposal backed by a reflection LLM.
With LLM-based Instruction Proposal
llm = GEPA.LLM.req_llm(:openai)
instruction_proposal = GEPA.Proposer.InstructionProposal.new(llm: llm)
proposer = Reflective.new(
adapter: my_adapter,
trainset: trainset,
instruction_proposal: instruction_proposal
)Without LLM
If the adapter does not implement propose_new_texts/4 or /3, pass a
custom_candidate_proposer function. GEPA no longer ships a production
placeholder mutation path.
Summary
Types
@type t() :: %GEPA.Proposer.Reflective{ adapter: term(), batch_sampler: module() | struct(), callbacks: [term()] | nil, candidate_selector: module() | struct(), custom_candidate_proposer: function() | nil, instruction_proposal: GEPA.Proposer.InstructionProposal.t() | nil, minibatch_size: pos_integer(), module_selector: module() | struct(), perfect_score: float(), skip_perfect_score: boolean(), trainset: GEPA.DataLoader.t() }
Functions
@spec propose(t(), GEPA.State.t()) :: {:ok, GEPA.CandidateProposal.t(), t(), GEPA.State.t()} | {:error, term(), t(), GEPA.State.t()} | {:none, t(), GEPA.State.t(), map()}
Propose a new candidate through reflective mutation.
Algorithm:
- Select candidate from Pareto front
- Sample minibatch from training set
- Evaluate with trace capture
- Check for perfect scores (optional skip)
- Generate improved version:
- Adapter
propose_new_texts - Custom proposer
- LLM-backed
instruction_proposal
- Adapter
- Evaluate new candidate
- Return proposal if improved