feat(autofit): restart-on-death (resurrection) for multi-start gradient search#1400
Merged
Conversation
…earch Phase 2 of the multi-start gradient v2 promotion (autolens_workspace_developer#101), building on the per-start vmapped optimizer state from Phase 1 (#1398). Add a resurrect=False knob to af.AbstractMultiStartGradient. When on, any start whose objective goes non-finite is redrawn each step (fresh params from the start band + its per-start optimizer state reinitialised) via a jnp.where mask over the vmapped state pytree, leaving alive starts untouched. Keeps the population alive on likelihoods with broad non-finite regions (pixelized sources), where apply_if_finite alone latches a start at the cliff edge. Default off leaves the MGE-cell behaviour unchanged. Tracks an n_resurrections diagnostic through search_internal (resume-safe) and samples_info. Numpy-only unit tests; JAX validation follows in autofit_workspace_test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merged
1 task
Collaborator
Author
|
Linked workspace PR (resurrection JAX validation): PyAutoLabs/autofit_workspace_test#59 ( |
This was referenced Jul 21, 2026
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
Phase 2 of the multi-start gradient v2 promotion (autolens_workspace_developer#101), building on the per-start
jax.vmaped optimizer state from Phase 1 (#1398, merged).Adds restart-on-death (resurrection) to
af.AbstractMultiStartGradientvia aresurrect: bool = Falseknob. When on, any start whose objective goes non-finite is redrawn each step — fresh params from the start band + its per-start optimizer state reinitialised — merged into the alive population with ajnp.wheremask over the vmapped state pytree, leaving alive starts untouched. On likelihoods with broad non-finite regions (pixelized sources) every trajectory otherwise walks into a wall within ~25–50 steps andapply_if_finitealone latches the start at the cliff edge; resurrection keeps the population alive and makes the landscape searchable (adam −51201 → +1718 over 3000 steps, ref job 330598).Default off — the parametric (MGE-class) cell is unchanged. An
n_resurrectionsdiagnostic flows throughsearch_internal(resume-safe) andsamples_info. Honest caveat (in docstring): even with resurrection a nested sampler still wins such landscapes decisively; this makes gradient MAP viable there, not competitive.API Changes
resurrect: bool = Falseconstructor argument onaf.AbstractMultiStartGradient(inherited by allMultiStart*searches). DefaultFalse→ no behaviour change.n_resurrectionsdiagnostic tosearch_internalandsamples_info.No migration required — the new argument is optional and off by default; existing
MultiStart*behaviour is byte-for-byte unchanged.Test Plan
pytest test_autofit/non_linear/search/mle/— 9 passed (resurrectdefault-off + carried knob, dict round-trip,n_resurrections/resurrectinsamples_info)._reinit_dead_startsredraws only the dead rows (params + per-start optimizer state), alive rows byte-identical;resurrecton/off give the identical best basin on the 1D Gaussian (49.82/25.27/9.996) with resurrection firing incidentally (n_resurrections=1) without perturbing the winner./ship_workspace):autofit_workspace_testJAX validation. Full pixelized-landscape validation is A100-only (the searches_minimal reference proved it; this port mirrors that exactreinit_startslogic).Full API Changes (for automation & release notes)
Added
af.AbstractMultiStartGradient(..., resurrect: bool = False, ...)— restart-on-death; redraws dead starts (params + per-start optimizer state) each step. Serialised into_dict/from_dict.search_internal["n_resurrections"]andsamples_info["n_resurrections"]/samples_info["resurrect"]— cumulative redraw diagnostic (resume-safe).AbstractMultiStartGradient._reinit_dead_starts(...)— the redraw + vmapped-state reinit + masked merge helper.Migration
resurrectdefaults off; existingMultiStart*code and results are unchanged.Generated by the PyAutoLabs agent workflow.