Imp.Optimizer.SignatureOptimizer (Imp v0.5.0)

Copy Markdown View Source

Optimizes one program signature instruction while leaving demonstrations unchanged.

A program with multiple named predictors must select one explicitly with predictor:. The proposal sees the complete program structure, but candidate application changes only that predictor. This keeps the search opportunity explicit instead of silently rewriting every stage with one instruction.

Pass proposer_lm: for task-aware proposals grounded in the program and training examples. Pass candidates: for explicit manual search. Supplying both is rejected rather than silently ignoring one source. With neither, the optimizer remains provider-free and reports that it used the native fallback proposal set.

Candidate selection is performed only on the required validation set. The original program is always evaluated and wins equal-score ties.

proposal_response_format: :required binds each proposer call to an exact one-instruction JSON Schema envelope. :auto uses that envelope when the LM advertises schema support; :off retains the pinned text-compatible parser. Invalid structured responses become explicit proposal fallbacks rather than executable explanatory prose. Ordinary proposer failures are likewise retained as fallbacks, while operational route, cost, budget, transport, and cancellation guards abort before candidate evaluation.

Summary

Functions

new(metric, opts \\ [])