Tune.Optimizers.BootstrapFewShotWithOptuna (Tune v0.5.0)

Copy Markdown View Source

Searches example-set choices per predictor with categorical TPE.

First num_demo_sets bootstrapped example sets are built from shuffled training data. The search space has one categorical dimension per predictor: which set's demonstrations that predictor uses. num_trials joint choices are suggested by Tune.Optimizers.TPE, uniform for the first n_startup trials and modeled from validation scores afterward. Each trial is a full validation evaluation; repeated choices reuse their earlier score without new calls. The best complete eligible trial is returned.

The name identifies the DSPy optimizer family; no Optuna runtime is used. Difference from DSPy: DSPy suggests one demonstration index per predictor from a single bootstrap; this implementation chooses among whole bootstrapped sets per predictor, which keeps demonstrations from one trajectory together.

Options: :num_demo_sets (default 4), :num_trials (default 16), :n_startup (default 4), and BootstrapFewShot options (:accept_score required).