name: compose-sweep-adaptive
description: The compose sweep's adaptive search modes — de (differential evolution) and bo (Bayesian optimisation) spend a slot `budget` in rounds, each round's points chosen from the ranked values before. When to search rather than sample, the budget and rank rules, the de / bo knobs, labels, failures, predict's budget report and the refusals.
type: guide
kind: design
applies_to: compose, predict
covers: [SweepSpec, SweepDE, SweepBO, SweepBOInit, budget, differential evolution, Bayesian optimisation, adaptive search, hyperparameter search]
requires: [capability:compose_sweep, capability:compose_sweep_sampling, capability:compose_sweep_adaptive]
Compose sweep adaptive search
A grid or an lhs sample fixes every point before any slot runs. An adaptive sweep spends a budget of slots in rounds and picks each round’s points from the ranked values of the rounds before, so most of the budget lands near the best region. Use it to FIND an optimum of one ranked number; lhs / random MAP the space (ranking_profile), a grid covers a few discrete values (compose-sweep-sampling, compose-sweeps).
{
"sweep": {
"mode": "bo",
"budget": 40,
"bo": {"n_init": 8, "batch": 2},
"axes": [
{"name": "decay", "range": {"min": 0.0, "max": 0.95}},
{"name": "lambda", "range": {"min": 0.001, "max": 10, "scale": "log"}},
{"name": "form", "values": ["linear", "log"]}
],
"request": {"...": "the body, reading {\"$var\": \"decay\"} / {{lambda}} / {{form}}"},
"rank": {"by": "regressions.mmm.holdout.rmse"}
}
}
Which mode
bo: costly slots, a small budget (tens), a smooth objective. A Gaussian-process surrogate (Matérn 5/2) is refitted every round and the next points maximise expected improvement.de: cheap slots, a larger budget, a rugged or multi-modal objective. A population evolves by rand/1/bin, one generation per round.- Under
ComposeParallela round’s slots run concurrently: aderound is the whole population; aboround isbatchpoints (raisebatchto use the workers; each pick then sees fewer finished points).
Budget and rank
budget(>= 1, required) is the slot count; it counts towardMaxComposeSlotswith the explicit slots, refused before anything runs.rankis required:rank.byis the objective, minimised underorder: "asc", maximised underdesc.- Axes: a
range(searched continuously;scaleandintegerhonoured, the sampling rules) orvalues(searched by value index;boone-hot encodes them). Every list value is rendered once up front, so an undecodable one is refused before anything runs, by predict too. - Seeded like lhs:
rng_seed, else a seed derived from the spec; echoed assweep_seed. The same request replays the same search on any architecture, serial or parallel.
Mode de
Round 0 is a Latin-hypercube population; each later round is one generation; a budget remainder is a final partial generation. Optional de {population, f, cr}: population 4..budget (default 10 × axes, capped at budget), f in (0, 2] (default 0.8), cr in [0, 1] (default 0.9). A trial replaces its target when it is not worse.
Mode bo
Round 0 is the initial design; each later round fits the surrogate to every point so far and proposes the next. Optional bo {init, n_init, batch}: init lhs (default) or random; n_init (default 2 × axes, capped at budget) and batch (default 1) in 1..budget. A batch above 1 is filled by constant liar. A surrogate that cannot be fitted (a non-finite objective) fails the batch at run time: PULSE_SWEEP_INVALID bo_surrogate_failed {mode, round, cause}.
Labels, failures, results
- Every label is
sample=<slot>_<pattern>(the authoredlabelpattern or the defaultaxis=valuepairs);slotcounts from 0 in run order, so labels stay unique even when a point repeats. Read a winner fromranking[0].axes. - A slot that fails, or whose value at
rank.byis null, is penalised (scored as the worst value so far, left out ofranking) and the search goes on; failures warnPULSE_SLOT_FAILEDonce for the batch (details.failed_indices). fits[].from_sweepbinds the winner (compose-sweep-bind).result()may read an explicit slot or a round-0 slot by label; a later round’s label is unknown until it runs, so reading it isPULSE_RESULT_INVALIDslot_unknown, in predict and at run time.
Round trace
Each ranking[] entry carries round (0-based, round 0 present). sweep_trace is one entry per round: {round, slots: [first, last], evaluated, penalised, best, best_so_far, best_label}. penalised = the round’s unranked slots (failed stubs, a null value at rank.by); best the round’s best ranked value, best_so_far the best over rounds 0..round, both null (never 0) while nothing ranked, and best_label is then absent. Read over the full ranking, before rank.top. It sits outside the compose return (full precision); --stream adds it to the final {"ranking"} line ([] when empty). Absent under non-adaptive modes.
Predict
Predict reports expanded_count = budget, adaptive: true, the effective rng_seed, each range axis’s count = budget, and labels: round 0’s real labels, then null for every later slot. Every slot is checked statically, so a refusal predict reports is the run’s.
Refusals
PULSE_SWEEP_INVALID(details.reason):adaptive_requires_budget,budget_invalid,adaptive_requires_rank;de_population_invalid,de_population_over_budget,de_f_invalid,de_cr_invalid;bo_init_invalid,bo_n_init_invalid,bo_n_init_over_budget,bo_batch_invalid,bo_batch_over_budget.PULSE_SWEEP_MODE_MISMATCH:samples(samples_under_adaptive) orsweep.overlays(overlays_under_adaptive) under an adaptive mode;budgetunder another mode (budget_without_adaptive);dewithoutmode: "de"(de_without_de_mode),bowithoutmode: "bo"(bo_without_bo_mode); an axis with bothvaluesandrange.PULSE_SWEEP_RANGE_INVALID: the range rules ofcompose-sweep-sampling.
See
compose-sweep-sampling (ranges, seeds, lhs) · compose-sweeps (axes, placeholders, rank) · compose-sweep-bind (bind the winner)