Repository navigation
refactor: MultiStart onto run(ctx), split into phases (search-ext A5 PR 3/4) - #1691
Merged
Merged
Conversation
…PR 3) AbstractMultiStartGradient's 800-line _fit becomes run(ctx) plus four phases: _step_functions (the scalar/stepped value_and_grad objectives, scaler/bijector/clipper set-up), _restored_state (the archived search_internal of an interrupted run), _fresh_state (the broad starting population) and _step_loop (stepping, archive and update at each iterations_per_full_update boundary). The quick-update cadence moves to fitness_overrides, so the bridge builds the same Fitness. An intermediate boundary updates through ctx.update, which also saves the dill resume state; the terminal boundary saves through ctx.checkpointer (the same atomic dill write save_search_internal made). _broad_starts, _seed_for and the grid child_seed semantics are untouched. Seeded samples.csv and the full search_internal (22 keys, opt_state excluded) byte-identical to main df6d218 for all four MultiStart variants, also with chunked updates and resurrect on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Search-extensibility phase A5 (library), PR 3 of 4 (stacked on PR 2; merge in order): the four MultiStart searches move onto
run(ctx), and the 800-line_fitis split into phases (survey 01 P5). Part of #1688.AbstractMultiStartGradient.runnow orchestrates four methods:_step_functions— the scalar and batched steppedvalue_and_gradobjectives onfitness.objective("scalar", compile=False), with the scaler/bijector/clipper set-up;_restored_state— the step-loop state from an interrupted run's archivedsearch_internal(same exception tuple and fresh-start fallback as before);_fresh_state— the broad starting population (_broad_starts, unchanged, on_seed_for(0));_step_loop— stepping, archiving and updating at everyiterations_per_full_updateboundary.The quick-update cadence moves to
fitness_overrides, so the bridge builds the identicalFitness. An intermediate boundary updates throughctx.update(which saves the dill resume state); the terminal boundary saves throughctx.checkpointer.save— the same atomic dill writepaths.save_search_internalmade, with no duplicate write._seed_forand the A4 gridchild_seedsemantics are untouched. A resumed run that is already converged returns its storedsearch_internal, as before.Decision flagged: the loop state passes between the phases as a dict unpacked into the loop's locals, so the loop body (and its source-level wiring tests) stays verbatim; the tests now read the joined source of the five methods.
API Changes
None — internal changes only.
See full details below.
Test Plan
unittest-nojaxemulation: 3474 passed, 180 skippedpython docs/_generate_searches.py --check: clean · Sphinx: 30 warningsseed=1, gaussian_x1, JAX analysis,n_starts=8, n_steps=100) vs main df6d218:samples.csvIDENTICAL for MultiStartAdam, MultiStartProdigy, MultiStartADABelief, MultiStartLion; the full archivedsearch_internal(22 keys,opt_stateexcluded) IDENTICAL for Adam and Prodigy, and for Adam withiterations_per_full_update=30+resurrect=True(exercisingctx.updateand the redraws)autofit_workspace_test/scripts/searches/MultiStart{Adam,ADABelief,Lion,Prodigy,ResumeNaNCounters,Resurrect}.pyatPYAUTO_TEST_MODE=1and=2: 2/6 pass on both modes, the same pass set as main (Adam, Prodigy, ResumeNaNCounters, Resurrect fail identically on main df6d218 — script assertions under the reduced test-mode budget, e.g.KeyError: 'n_resurrections'; pre-existing, not touched here)Full API Changes (for automation & release notes)
Changed Behaviour
AbstractMultiStartGradientno longer overrides_fit; new private methodsrun,fitness_overrides,_step_functions,_restored_state,_fresh_state,_step_loop.Companion changes required
None beyond the A5 consumers task. The pre-existing
autofit_workspace_testMultiStart/NUTS script failures (identical on main) are not introduced here; worth a separate look.Validation checklist (--auto run — plan was not pre-approved)
/prm), merge after PR 2pyauto-heart smokeon PR 2 and PR 4 heads: rc 0, 53 PASS each) · review CLEAN (independent Opus reviewer; it also probed the resumed-and-converged path) · Heart STALE 85 within launch ack (reasons: "release validation incomplete: no rehearsal for current source")🤖 Generated with Claude Code