Dsxir. Optimizer. SIMBA. Trial
(dsxir v0.5.0)
Copy Markdown
One SIMBA mini-batch step over a Dsxir.Optimizer.SIMBA.Sampler.
run/1 draws the next mini-batch (reshuffle-and-wrap on exhaustion), samples
diverse trajectories from the current pool, buckets them per example, builds
new candidate programs by dropping demos and applying a strategy, evaluates
the candidates on the same mini-batch, records the per-step winner, and
registers every candidate back into the pool.
All randomness threads sampler.rng_state explicitly: the batch reshuffle,
softmax program selection, the Poisson demo-drop count, the dropped indices,
and the strategy choice all take and return the :rand state. Nothing touches
global :rand, so a resumed checkpoint replays deterministically.
Summary
Functions
Drops a Poisson-sampled number of demo positions from every predictor of
program, threading rng.
Runs one mini-batch step and returns {:ok, updated_sampler, trial_result}.
Types
@type args() :: %{ :sampler => Dsxir.Optimizer.SIMBA.Sampler.t(), :trial_idx => non_neg_integer(), :metric => Dsxir.Metric.t(), optional(:opts) => keyword() }
Functions
@spec drop_demos(Dsxir.Program.t(), map(), term()) :: {Dsxir.Program.t(), term()}
Drops a Poisson-sampled number of demo positions from every predictor of
program, threading rng.
num_demos is the maximum demo count across predictors. With
max_demos_tmp = max(max_demos, 3 when max_demos == 0), the drop count is
min(max(poisson(num_demos / max_demos_tmp), floor), num_demos) where floor
is 1 when num_demos >= max_demos_tmp and 0 otherwise. The dropped
positions are sampled with replacement and removed from each predictor's
State.demos.
@spec run(args()) :: {:ok, Dsxir.Optimizer.SIMBA.Sampler.t(), map()}
Runs one mini-batch step and returns {:ok, updated_sampler, trial_result}.
The updated sampler carries the threaded rng_state, the advanced
instance_idx (and reshuffled data_indices on wrap), the grown program
pool / score lists / winning programs, the updated best_so_far, an
incremented attempts, and the per-step entry under trial_logs[trial_idx].