Dsxir. Optimizer. GEPA. Sampler
(dsxir v0.2.0)
Copy Markdown
Checkpointable state for a GEPA session. serialize/1 round-trips via
:erlang.term_to_binary/2 with [:deterministic]; deserialize/2
uses [:safe] and confirms shape.
attempts counts every step/6 invocation (including failed reflective
trials) so the budget terminates cleanly even if every operator failed.
Summary
Functions
Projects sampler state into a Stats record for reporting.
Decodes a sampler blob produced by serialize/1. Uses the :safe term
decoder and validates the resulting struct shape.
Encodes the sampler deterministically. Returns {:ok, blob, version}.
Types
@type t() :: %Dsxir.Optimizer.GEPA.Sampler{ attempts: non_neg_integer(), best_so_far: {String.t(), float()} | nil, config: map(), decls: [Dsxir.Program.PredictorDecl.t()], degraded: boolean(), demo_table: %{required(atom()) => %{required(map()) => [Dsxir.Demo.t()]}}, devset: [Dsxir.Example.t()], frontier: [String.t()], generation: non_neg_integer(), population: Dsxir.Optimizer.GEPA.Population.t(), proposer_calls: non_neg_integer(), reflective_lm: {module(), keyword()}, rng_seed: integer(), rng_state: term(), seed_program: Dsxir.Program.t(), total_devset_evals: non_neg_integer(), total_planned_trials: pos_integer() }
Functions
@spec build_stats(t()) :: Dsxir.Optimizer.GEPA.Stats.t()
Projects sampler state into a Stats record for reporting.
@spec deserialize(binary(), pos_integer()) :: {:ok, t()} | {:error, :version_mismatch | :corrupt_blob | {:bad_sampler_shape, term()}}
Decodes a sampler blob produced by serialize/1. Uses the :safe term
decoder and validates the resulting struct shape.
Encodes the sampler deterministically. Returns {:ok, blob, version}.