Skip to content

feat: per-lane best (params, fom, step) preservation in MultiStartGradient - #1515

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/multistart-per-lane-best
Aug 23, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/multistart-per-lane-best

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #1514.

Inference-programme Phase 3 pre-req (Epic: jax-inference-profiling, CP-3 — autolens_profiling/results/notes/inference/PROGRAMME.md §4/§7): per-start basin classification needs each lane's own best, not just its final position and the global best.

What

  • _fit now maintains lane_best_params (PHYSICAL, like best_params), lane_best_foms, and lane_best_steps (index into fom_history, stable across resumes), persisted in search_internal. Diagnostics only — never gates a redraw or a step (the NaN-lane-counter rule).
  • Capture is a pure-NumPy static helper _lane_best_update: strict < so ties keep the earliest best step ("steps after best" stays an honest waste measure); a lazy gather_physical callable keeps the device→host copy off no-improvement steps; alive-masked foms mean dead lanes never update.
  • Resume: new keys restored defensively — legacy search_internal files re-seed from the restored finals (inf foms) rather than KeyError-ing, same doctrine as alive_history.
  • Resurrection: a redrawn slot is a NEW start — its record resets (NaN params, inf fom, step stamped) rather than conflating two starts' basins in one slot.
  • Seed/restore use np.array copies: np.asarray of a JAX device array is read-only and the update writes in place. This was caught by an end-to-end JAX validation run (quadratic objective, 6 starts), which then passed: every lane finite, global best == min over lane bests, best lane's params == best_params.

Tests

  • Direct _lane_best_update tests: improvement capture, untouched non-improved lanes, dead-lane immunity, tie handling, lazy improved-only gather, monotonicity across calls.
  • _fit source-level wiring guards (capture call, persistence keys, defensive resume, resurrection reset), per the suite's NumPy-only contract — JAX behaviour validated by the e2e run above and downstream in autofit_workspace_test.
  • Full suite: 2036 passed, 3 skipped.

No public-API change; the profiling repo reads search_internal directly. Downstream (autolens_profiling CP-3 arms) consumes the new keys for per-lane basin classification.

🤖 Generated with Claude Code

https://claude.ai/code/session_019s6eAYCjAvn7tRNetAFadP

…dient (#1514)

Each lane's best figure-of-merit, physical position, and step index are
now tracked in the _fit loop and persisted in search_internal
(lane_best_params / lane_best_foms / lane_best_steps) alongside the
existing global best and per-lane finals. Diagnostics only — the same
never-gates rule as the NaN-lane counters. Needed by the inference
programme's Phase 3 (per-start basin classification / p_hit measurement;
finals are unreliable because a lane can leave its best basin late, die,
or pin to a bound after its best step).

- Capture is a pure-NumPy static helper (_lane_best_update), strict-<
  so ties keep the earliest best step, with a lazy gather so the
  device->host copy only happens on improving steps. Seed/restore use
  np.array copies — np.asarray of a device array is READ-ONLY and the
  update writes in place (caught by an end-to-end JAX run).
- Resume restores the new keys defensively; legacy search_internal
  files re-seed from the restored finals rather than KeyError-ing.
- A resurrected slot is a NEW start: its record resets (NaN params,
  inf fom) rather than conflating two starts' basins in one slot.
- Tests: direct helper tests + _fit source-level wiring guards, per the
  suite's NumPy-only contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019s6eAYCjAvn7tRNetAFadP
@Jammy2211
Jammy2211 merged commit c9ad40e into main Aug 23, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/multistart-per-lane-best branch August 23, 2026 16:35
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.

feat: per-lane best (params, fom, step) preservation in MultiStartGradient

1 participant