Skip to content

feat(autofit): restart-on-death (resurrection) for multi-start gradient search - #1400

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/multistart-resurrection
Jul 21, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/multistart-resurrection

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

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.AbstractMultiStartGradient via a resurrect: bool = False knob. 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 a jnp.where mask 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 and apply_if_finite alone 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_resurrections diagnostic flows through search_internal (resume-safe) and samples_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

  • Added a resurrect: bool = False constructor argument on af.AbstractMultiStartGradient (inherited by all MultiStart* searches). Default False → no behaviour change.
  • Added an n_resurrections diagnostic to search_internal and samples_info.

No migration required — the new argument is optional and off by default; existing MultiStart* behaviour is byte-for-byte unchanged.

Test Plan

  • Library unit suite (numpy-only): pytest test_autofit/non_linear/search/mle/ — 9 passed (resurrect default-off + carried knob, dict round-trip, n_resurrections/resurrect in samples_info).
  • JAX (validated locally): _reinit_dead_starts redraws only the dead rows (params + per-start optimizer state), alive rows byte-identical; resurrect on/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.
  • Follow-up (/ship_workspace): autofit_workspace_test JAX validation. Full pixelized-landscape validation is A100-only (the searches_minimal reference proved it; this port mirrors that exact reinit_starts logic).
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 in to_dict/from_dict.
  • search_internal["n_resurrections"] and samples_info["n_resurrections"] / samples_info["resurrect"] — cumulative redraw diagnostic (resume-safe).
  • AbstractMultiStartGradient._reinit_dead_starts(...) — the redraw + vmapped-state reinit + masked merge helper.

Migration

  • None. resurrect defaults off; existing MultiStart* code and results are unchanged.

Generated by the PyAutoLabs agent workflow.

…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>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Linked workspace PR (resurrection JAX validation): PyAutoLabs/autofit_workspace_test#59 (pending-release). Library-first: this PR merges first, then #59.

@Jammy2211
Jammy2211 merged commit f83f2f4 into main Jul 21, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/multistart-resurrection branch July 21, 2026 08:03
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant