Dsxir. Optimizer. MIPROv2. Trial
(dsxir v0.3.0)
Copy Markdown
Runs one MIPROv2 trial: apply a sampled config to a program's per-predictor
state, run the program over a minibatch in parallel, score each prediction
with the metric, and return a Dsxir.Optimizer.MIPROv2.Stats.Record.
Parallelism uses Task.Supervisor.async_stream_nolink/4 under
Dsxir.TaskSupervisor. Each worker replays the caller's settings snapshot
via Dsxir.Settings.run/2 so the LM, adapter, metadata, and call_plugs are
preserved per-tenant.
Cache hits are tracked via Dsxir.Optimizer.Cache.fetch_or_put/3's
{:hit | :miss, value} return. A miss increments lm_calls; a hit
increments cached_calls. When the cache is disabled (tid == nil) every
call is reported as a miss so lm_calls reflects the true number of
program executions and cached_calls stays at zero.
Examples whose program forward function raises score 0.0 and the batch
continues. Worker exits (timeout, crash) likewise score 0.0 without
aborting the trial.
Summary
Types
@type args() :: %{ program: Dsxir.Program.t(), config: map(), candidates: Dsxir.Optimizer.MIPROv2.Candidates.t(), examples: [Dsxir.Example.t()], metric: Dsxir.Metric.t(), cache_tid: Dsxir.Optimizer.Cache.tid(), settings_snapshot: %{globals: map(), stack: [map()]}, trial_index: non_neg_integer(), batch_size: pos_integer() }
Functions
@spec run(args()) :: Dsxir.Optimizer.MIPROv2.Stats.Record.t()
Apply config to program, evaluate examples in parallel, return a
Record summarising mean score, LM calls, cache hits, and duration.