Repository navigation
Description
Overview
An imaging/start_here.py run using MultiStartProdigy with iterations_per_quick_update=50 was reported to "stop at 49 steps", suggesting the quick-update cycle terminates the search at the first cadence boundary and returns a barely-started result.
Investigation shows the search cannot stop at a quick-update boundary: nothing in AbstractMultiStartGradient._fit reads iterations_per_quick_update (the cadence is currently inert for this family — see the EXEMPT entry in test_quick_update_wiring.py and #1433), and the only stop paths are the auto-convergence plateau check (gated behind min_steps=100) and the n_steps ceiling. An end-to-end run with iterations_per_quick_update=50 and n_steps=120 takes all 120 steps.
The "49" is search.summary's first line: Total Samples = 49 — 1 best sample + n_starts=48 per-start final points, a sample count fixed by construction that carries no step information. The summary never reports the actual step count, so its one prominent number reads as "the search ran 49 iterations", and 49 = 50 − 1 invites blaming the quick-update cadence.
Plan
- Make
search.summaryfor the MultiStartGradient family report the real run length: aTotal Steps = Nline and aStop Reason = converged|max_stepsline, and disambiguate theTotal Samplesline so it can no longer read as a step count. - Pin the non-interaction with an end-to-end regression test: a
MultiStartProdigyfit with a finiteiterations_per_quick_updatemid-search runs past the cadence boundary to then_stepsceiling (the prompt's Witness), written so it stays valid once real quick updates are wired in (by the sibling MultiStart quick-update wiring task). - No behaviour change to the search itself — this task deliberately does not wire quick updates into the step loop (that is the sibling task covering
iterations_per_quick_update/live_visual_updatebeing ignored).
Detailed implementation plan
Affected Repositories
- PyAutoFit (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoFit | main (remote session clone) | clean |
Suggested branch: feature/multistart-quick-update-49-steps
Implementation Steps
autofit/text/text_util.py— insearch_summary_from_samples, inside the gradient-search block (guarded on"n_value_nan_lane_steps" in samples_info):- rewrite the
Total Samplesline to state its composition (1 best + {n_starts} per-start final points), so the count cannot read as a step count; - append
Total Steps = {samples_info["total_steps"]}and, when present,Stop Reason = {samples_info["stop_reason"]}(read defensively — a legacysearch_internalmay predatestop_reason).
- rewrite the
test_autofit/text/test_text_util.py— new tests asserting the step-count and stop-reason lines for a gradientsamples_info, their absence for other searches, and the legacy-file (nostop_reason) path.- New
test_autofit/non_linear/search/mle/test_multi_start_quick_update_termination.py— end-to-end regression (skipped whenjax/optaxabsent, same pattern astest_blackjax_smc.py): a JAX-traceable Gaussian analysis fit withMultiStartProdigy(n_starts=4, n_steps=60, iterations_per_quick_update=25)assertstotal_steps == 60(well past the first cadence boundary at 25) andstop_reason == "max_steps". The analysis implementsperform_quick_updateas a recording no-op so the assertion stays valid if/when the sibling task wires quick updates into the step loop.
Key Files
autofit/text/text_util.py—search_summary_from_samples(the misreadTotal Samplesline; where the step count belongs)autofit/non_linear/search/mle/multi_start_gradient/search.py—_fitstep loop (evidence: cadence never read),samples_via_internal_from(samples_infoalready carriestotal_steps/stop_reason; sample list is1 + n_startsby construction)autofit/non_linear/search/mle/multi_start_gradient/convergence.py—min_steps=100gate (evidence a 49-step stop is impossible)test_autofit/text/test_text_util.py,test_autofit/non_linear/search/test_quick_update_wiring.py— existing tests around both seams
Original Prompt
Click to expand starting prompt
MultiStartProdigy stops at 49 steps when iterations_per_quick_update=50 in @PyAutoFit
Type: bug
Target: PyAutoFit
Repos:
- PyAutoFit
Difficulty: small
Autonomy: safe
Priority: normal
Status: formalised
Consequence: glance
Witness: an imaging/start_here.py run using MultiStartProdigy with iterations_per_quick_update=50 runs past the first quick update (total steps well above 50) instead of terminating at 49 steps, and the interaction is covered by a PyAutoFit unit test in which a quick update mid-search does not end the search.
Review-minutes: 3
Unattended: ready
MultiStartProdigy stops at 49 steps when iterations_per_quick_update=50 in @PyAutoFit
Type: bug
Original report (verbatim): the imaging/start_here.py run I did which uses MultiStartProdigy stopped at 49 steps, which is probbably due to iterations_per_quick_update=50, meaning the result is rubbish. Is there an issue with this combination of quick updates and prodigy?
Investigate the interaction between the quick-update cycle and MultiStartProdigy: the search appears to terminate at the first quick-update boundary (49 steps with iterations_per_quick_update=50) instead of resuming sampling afterwards, so the returned result is from a barely-started search.
Witness: an imaging/start_here.py run using MultiStartProdigy with iterations_per_quick_update=50 runs past the first quick update (total steps well above 50) instead of terminating at 49 steps, and the interaction is covered by a PyAutoFit unit test in which a quick update mid-search does not end the search.
Activity
Jammy2211 commentedon Aug 31, 2026
Library PR created: #1555 (
pending-release; --auto run, five-leg gate passed — details in the PR's validation checklist).Workspace-impact analysis → option (iii), no workspace work needed.
## API Changesis "None — internal": the diff changes only the textsearch.summarywrites for the MultiStartGradient family. Grep evidence: no library code, test, or workspace script parsessearch.summaryor itsTotal Samplesline (workspace mentions are prose in output-directory docstrings only), so no script migration and no new demos. The threestart_here.pyscripts' misleadingiterations_per_quick_updateprose is already scoped to the sibling wiring task (autofit-multistart-iterations), not this one.Batch note: merge #1555 before the sibling quick-update wiring PR (serial order per the 2026-08-31-pm batch record). The sibling's wiring change must flip the new e2e test's
quick_update_count == 0tripwire into a "fired" assertion — the test's comment says exactly this at the assertion site.Run ends at PR-open per the autonomy contract; merge stays human.
Generated by Claude Code