Repository navigation
Description
Overview
Gradients are now certified for all 3 pixelized mesh families — rectangular kernel-CDF, KNN, and Delaunay (frozen-tables, merged 2026-07-26) — and af.MultiStartProdigy (learning-rate-free, per-start vmapped state, resurrect knob) won the MGE benchmark. But Prodigy has never been run on a pixelized source: the prior pix campaigns (#100/#101) used MultiStartAdam-era code, where adam only became searchable with resurrection (−51201 → +1718 over 3000 steps) and Nautilus won decisively (+17419). This research task answers, one way or the other: does MultiStartProdigy (or a better-suited optimizer / small likelihood change) reach the right solution on rectangular, knn and delaunay pixelized sources, and in how many steps — on RAL CPU (A100s busy; wall-time and compile slowness acceptable; A100 profiling is a follow-up).
Plan
- Repair the pix objective (
pix_multi_start.pystill references the pre-consolidationRectangularKernelAdaptDensityname) and generalize it to all 3 certified mesh configs via aPIX_MESHknob. - Add a
pix_prodigy.pyrunner on the libraryaf.MultiStartProdigy(resurrect on, fixed-step, resume-chained across 24 h SLURM jobs) + aral-partition CPU sbatch. - Establish per-mesh success bars: truth-point logL scans (all meshes) + converged Nautilus (+17419 exists for rectangular; launch knn/delaunay Nautilus CPU baselines in parallel).
- Run the 3 Prodigy chains on RAL CPU; monitor best-logL vs bar, steps-to-bar, resurrection churn.
- Contingency arms only where Prodigy misses: start band, fixed regularization coefficient, kernel bandwidth (0.1 vs library-default 1.0), other optimizers. The slogdet log-det swap is already answered (job 330953: no help — the wall is the descent direction, not the log-det).
- Findings doc
searches_minimal/pix_prodigy_findings.mdwith the per-mesh verdict.
Detailed implementation plan
Affected Repositories
- autolens_workspace_developer (primary, only)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./autolens_workspace_developer | main | clean (2 unpushed merge commits, to be pushed first) |
Suggested branch: feature/pix-prodigy-cpu (worktree ~/Code/PyAutoLabs-wt/pix-prodigy-cpu/)
Implementation Steps
- Stage 0 — repair + generalize (
searches_minimal/pix_multi_start.py):- Fix
al.mesh.RectangularKernelAdaptDensity(shape=(30,30), bandwidth=0.1)→al.mesh.RectangularAdaptDensity(...)(kernel-CDF took the plain names in the rectangular-mesh consolidation;pix_lr_free.pyimports from here and is broken on current main). - Add
PIX_MESH=rectangular(default) |knn|delaunay, mirroring the certified configs inautolens_workspace_test/scripts/imaging/jax_grad/{pixelization,knn,delaunay}.py:- rectangular: as today — os_pix=1, free
reg.Constant. - knn:
al.mesh.KNearestNeighbor(pixels=300, zeroed_pixels=30)+ freeal.reg.AdaptSplit(theConstant/Adaptregs raiseTracerArrayConversionErrorunder grad on this family — *Split regs mandatory).KNNBarycentriconly as an optional diagnostic arm (failed its science gate). - delaunay:
al.mesh.Delaunay(pixels=300, zeroed_pixels=30)+ freeal.reg.AdaptSplit. - knn+delaunay: Hilbert image mesh (
pixels=300, weight_power=3.5, weight_floor=0.01+ circle-edge points) +al.AdaptImagesnumpy bootstrap; keys are the stringified path tuplestr(("galaxies","source")).
- rectangular: as today — os_pix=1, free
- Model shape stays SLaM source_pix[1]: fixed MGE lens-light geometry (truth), free Isothermal+shear (broad priors), free regularization.
- Fix
searches_minimal/pix_prodigy.py— libraryaf.MultiStartProdigy:n_starts=16,n_stepsenv (300/job),batch_sizeenv,resurrect=True,convergence=af.MultiStartGradientConvergence(check_for_convergence=False)set explicitly (Nonesilently enables checking),number_of_cores=1. Resume-chaining via the search's persistedsearch_internal(fixed name/path_prefix per mesh) — CPU throughput is ~5-6 min/step at 16 starts (job 330953), so 3000 steps spans multiple 24 h jobs. Report: best logL vs bars, r_E vs truth 1.6 (and Nautilus mode 1.31 for rectangular), steps-to-bar fromfom_history,n_resurrections,stop_reason, wall/step; summary tosearches_minimal/output/pix_prodigy_<mesh>.txt.--truth-barmode: numpy-path truth-point logL with reg-coefficient scan (rectangular sanity: ≈ +25537).searches_minimal/pix_prodigy_cpu.sbatch— cloned frompix_slogdet_ab_cpu.sbatch:--partition=ral --cpus-per-task=32 --mem=128gb --time=24:00:00,JAX_PLATFORMS=cpu, warmJAX_COMPILATION_CACHE_DIR=/mnt/ral/jnightin/scratch/jax_cache,PYTHONUNBUFFERED=1, logs/mnt/ral/jnightin/pixgrad_logs/; x64 set in-script (sbatch does not inheritJAX_ENABLE_X64). Plus a Nautilus-baseline sbatch for knn/delaunay (force_x1_cpu=True, use_jax_vmap=True, n_batch=16).- Stage 2 — chains: RAL smoke first (
PIX_N_STEPS=2, batch_size=1per mesh — compile + finiteness filter + resume-file), then 300-step resume-chained jobs until bar reached or 2 consecutive plateau-with-resurrection-churn jobs. - Stage 3 — contingencies (only where Prodigy misses, in order): resurrect on/off + narrowed
start_lower/upper_limit;PIX_FIX_REG(the free LogUniform(1e-6,1e6) reg direction is the fragile one — fix: localise the pixelized likelihood's non-finite walls (phase 1) #104); rectangularbandwidth=1.0arm (library default, smoother landscape); otheroptax_methodarms (adam@1e-2 reference, DoG/mechanic), lbfgs polish only if a basin is found unresolved. Skip slogdet (answered). - Stage 4 — findings:
searches_minimal/pix_prodigy_findings.mdper-mesh verdict + steps + resurrection stats; ship via workspace flow; A100 profiling deferred follow-up.
Key Files
searches_minimal/pix_multi_start.py— objective builder (fix +PIX_MESH)searches_minimal/pix_prodigy.py— new runner (library MultiStartProdigy)searches_minimal/pix_prodigy_cpu.sbatch— RAL CPU submit (+ Nautilus baseline sbatch)searches_minimal/pix_prodigy_findings.md— deliverable- Reference configs:
autolens_workspace_test/scripts/imaging/jax_grad/{pixelization,knn,delaunay}.py - Prior art:
searches_minimal/{pix_gradient,lr_free,pix_nonfinite}_findings.md;autolens_profiling/scripts/misc/searches/_samplers.py
Success criterion
Per mesh: Prodigy reaches the bar (± few nats) and we report steps-to-bar — or a documented negative with the wall signature and which arm (if any) changes the verdict.
Original Prompt
Click to expand starting prompt
Yesterday, we showed that gradients are robust for all 3 pixelized meshes, rectangular, knn, delaunay. In autolens_workspace_developer and autolens_profiling, we eventually landed on MultiStartProdigy being the best gradient initializer based on an MGE source model. We basic doing a bit of work on testing its performance for pixelized mehses, which had a search akin to source_pix[1] of a SLaM pipeline (e.g. lens light uses fixed values from previous fit, or probably in this case from the simulator truth). We didnt finish that investigation. I therefore want us to confirm that MultiStartProdigy sampling works for these pixelized source meshes, or to demonstrate that it does not, even thought for MGE source it does. we have done work on this, albeit the docs I can find (e.g. pix_gradient_findings.md) imply we did this with MultiStartAdam not MultiStartProdigy. You have freedom to try other optimizers if you think it would be more suitable for pixelized models, and investigate if small changes to the likelihood function (e.g. linear algebra implementation, regularization scheme) might help. Finally, not that thw A100s on RAL seem busy, so we will likely need to do this investigation using RAL CPUs. The overall run times will thus be slow as likelihood evaluations are slow on CPU for pixelizations, but we really just want to confirm gradients can get to the right solution and monitor how many steps it takes, overall run time profiling on A100s can thus be a follow up. JAX compile times may also be slow, which we'll just deal with and follow up to optrimize once we have our final appraoch, so long as they compile eventually and thus we can figure out the right methods.
Activity
feat: PIX_NAME_SUFFIX isolates smoke runs from the resume chain (#117)
Jammy2211 commentedon Jul 27, 2026
Milestone 1 — harness shipped, campaign launched (Stage 0/1).
pix_multi_start.pyrepaired (post-consolidation mesh nameRectangularAdaptDensity) and generalized:PIX_MESH=rectangular|knn|delaunaybuilds the certified jax_grad configs (Hilbert + AdaptImages + freeAdaptSplit(inner,outer; signal_scale pinned) for the Delaunay family; freereg.Constantfor rectangular kernel-CDF). All 3 build: 8/9/9 free params.pix_prodigy.pyrunner on the libraryaf.MultiStartProdigy(per-start vmapped state,resurrect=True, explicit convergence-off,batch_sizetiling, resume-chained via persistedsearch_internalevery 50 steps) +pix_prodigy_cpu.sbatch(ralpartition).ralpartition has ~25 idle nodes (gpu busy/down as expected). Smoke jobs 331177–331179 (2 steps, real batch shape to warm the compile cache) RUNNING for all 3 meshes.feat: truth-point bars from the reg scans wired into the report (#117)
Jammy2211 commentedon Jul 27, 2026
Milestone 2 — per-mesh truth bars established; Nautilus baselines launched.
Truth-point reg scans (objective at simulator-truth mass/shear, coefficient scanned; local CPU, ~4-16 s/eval warm):
These are upper references (a converged free-reg fit sits below: rectangular Nautilus +17419 vs +27059 truth-point). Two observations of note:
Scan artifacts:
searches_minimal/output/pix_truth_bar_<mesh>.txt. Bars wired into the runner's report (steps-to-bar readout).RAL: smoke jobs 331177-331179 running (cold compile); Nautilus CPU baselines for knn (331180) + delaunay (331181) submitted (48 h walltime, resume-capable).
Jammy2211 commentedon Jul 27, 2026
Milestone 3 — smokes passed; the three Prodigy chains are running.
All 3 smoke jobs finished rc=0 (knn/delaunay ~4 min wall for the full 2-step pipeline incl. compile — far below the 5-6 min/step planning estimate from job 330953; rectangular ~28 min, its eval path is the heavy one). Compile cache warmed at the production batch shape.
Launched:
afteranydependency chains, so 24 h walls resume unattended.GPU note for the record: both A100 nodes are unavailable for the foreseeable future (gpu-1 down; gpu-2's 4 GPUs saturated by a ~94-task external array with multi-day tasks) — CPU-first was the only viable route.
fix: int-cast iterations_per_full_update post-construction — library …
Jammy2211 commentedon Jul 27, 2026
Milestone 4 — chain relaunch after a library crash-bug; all 3 chains running again.
The first chain launch (331182-331190) died on step-loop entry:
TypeError: 'float' object cannot be interpreted as an integeratmulti_start_gradient/search.py:298. Root cause is a PyAutoFit bug:abstract_search.py:219float-coercesiterations_per_full_update, and_fitpassesmin(float_cadence, steps_remaining)intorange()— it only fires when the cadence is below the remaining budget (config defaults are huge, so no prior run ever took that branch; our 50-step checkpoint cadence did). The smoke jobs passed becausemin(50.0, 2)returned the int 2 — precisely the wrong reassurance.search.iterations_per_full_update = 50(int) inpix_prodigy.py(commit c34fb67), verified locally.PyAutoMind/draft/bug/autofit/multistart_iterations_per_full_update_float_crash.md(one-lineint()fix + numpy unit test; the workspace hotfix comes out when it ships).Jammy2211 commentedon Jul 27, 2026
Milestone 5 — Delaunay hits a mesh-specific hard blocker; retried resurrect-off. Rect + knn progressing.
The delaunay chain (331197-99) died ~8 min into descent: a start's params went non-finite, the NaN-traced mesh points reached the host qhull
pure_callback, and scipy raisedValueError: Points cannot contain NaN→JaxRuntimeErrorkilling the entire 16-start batch. The persisted checkpoint holds the NaN params, so both dependent links crashed instantly on resume.This is a finding, not just an ops failure: the pure-JAX meshes (rectangular, knn) honor the "NaN propagates → apply_if_finite/resurrection handles it" contract; the Delaunay tables callback breaks it — one poisoned lane is process-fatal. So Delaunay currently cannot use the resurrection machinery (Fit#1400) that made pixelized search viable in #101.
draft/bug/autoarray/delaunay_tables_callback_nan_points_crash.md(lane-level isfinite guard in the callback → sentinel tables → NaN logL; coordinate with the active interferometer intermittent-qhull-NaN prompt — likely the same missing guard).Jammy2211 commentedon Jul 27, 2026
Milestone 6 — Delaunay verdict firming up: BLOCKED for any broad-start gradient search (not resurrection-specific).
The resurrect=False retry (331202→331203) crashed identically — same qhull
Points cannot contain NaN→CpuCallbackprocess death, before the first checkpoint. So the NaN points are produced by ordinary descent trajectories (extreme mass configs → non-finite deflections → non-finite traced mesh points), not by the resurrection machinery, and the where-guard can't help because the exception fires during the forward eval. No campaign-side workaround exists; delaunay is parked as BLOCKED pending the PyAutoArray callback fix (draft/bug/autoarray/delaunay_tables_callback_nan_points_crash.md, updated with this evidence) and will be rerun with resurrect=on once it ships.Meanwhile: knn (331194) is 4 checkpoints (~200 steps) in at ~20 s/step, no errors; rectangular (331191) pre-first-checkpoint (slower eval path); both Nautilus baselines >1 h and healthy — notably the delaunay Nautilus baseline survives where gradient descent crashes, consistent with sampler proposals staying in finite-deflection regions while descent trajectories wander out.
Jammy2211 commentedon Jul 27, 2026
Upstream fix for the
iterations_per_full_updatecrash is open: PyAutoFit#1421The
range(float)TypeErrorthat killed chain jobs 331182–331190 is fixedupstream in PyAutoLabs/PyAutoFit#1421 (issue
PyAutoLabs/PyAutoFit#1420) — the MultiStart gradient chunk size is now cast to
intat the consumer (and floored at 1, so a fractional cadence can't produce azero-length chunk and hang).
Action for this task once that PR merges: delete the post-construction int
overwrite in
searches_minimal/pix_prodigy.pyonfeature/pix-prodigy-cpu. Itwas only ever a workaround for the library bug, and leaving it behind is exactly
the "documented trap" pattern we keep removing. This repo is claimed by this
task, so the deletion belongs here rather than in the library PR.
feat: delaunay Nautilus CPU baseline bar (+19982, caveated) (#117)
Jammy2211 commentedon Jul 27, 2026
Milestone 7 — HEADLINE: MultiStartProdigy WORKS on the knn pixelized mesh from broad starts.
knn chain (331194), 400 steps in (~2 h, ~20 s/step on 32 CPUs):
einstein_radius = 1.633 (truth 1.6 — in basin), n_resurrections = 75/400 steps (moderate churn, not the #101 runaway-wall signature). This overturns the #101 verdict for this mesh: the adam-era attempts sat at −40k…+1.7k after 3000 steps; library Prodigy (per-start vmapped state, lr-free) + resurrection converges in ~250 steps. Chain link 1 will complete the full 3000-step budget within its 24 h wall — remaining steps are plateau-confirmation.
Delaunay Nautilus baseline landed (331181, 2.3 h): max logL +19982 at r_E 0.962 — ~10 k nats below its truth-point bar (+30079) and far from truth. Caveat: single n_live=100 run; possibly an under-converged or degenerate mode. Bar recorded with caveat; it will matter for the post-callback-fix delaunay rerun.
Still running: knn Nautilus baseline (its converged value is the direct comparison for the +22515 plateau), rectangular Prodigy chain (slower eval path).
chore: drop the iterations_per_full_update hotfix — fixed upstream in…
Jammy2211 commentedon Jul 27, 2026
Milestone 8 — both library fixes merged; post-fix delaunay rerun launched.
c042d72/8c5e28e).pix_prodigy.pyis deleted (commit cad9b0c) — the fixed library makes it dead code.feat: knn Nautilus CPU baseline (+5704, caveated) — Prodigy beats it …
1 remaining item
feat: PIX_START_LOW/HIGH start-band knob for the Stage-3 arms (#117)
Jammy2211 commentedon Jul 27, 2026
Milestone 10 — delaunay stall confirmed at +8513; Stage-3 diagnostic arms launched.
The post-fix delaunay chain has been flat at +8512.6 for 675 consecutive steps (375→1050) while resurrections churned on (172→325, 153 redraws finding nothing better) — the stall signature, sitting 11.5k below even the caveated Nautilus floor. The mesh survives (PR#411 keeps holding) but broad-band random redraws have saturated as a discovery mechanism, consistent with the smoothness-class picture (C0 flip seams → small local basins → gradients can't see across).
Two arms now running to localise the bottleneck (~15 s/step, single 24 h links):
_fixreg: AdaptSplit pinned at the truth-bar optimum (0.032, 3.16) — tests whether the fragile free-reg axis (NaN at inner ≥ 10 in pure forward evals) is driving the churn/stall._narrow: start band narrowed 0.15–0.85 → 0.35–0.65 — if this reaches the +20-30k region the broad chain can't, the failure is global discovery, not local landscape, which is the evidence for perturb-from-best restarts (vmapped basin hopping) and/or the search-on-smooth-mesh → warm-refit-delaunay production recipe.Main chains: knn plateau-confirming (~1150 steps); rectangular in a flat at −30136 (50 steps, too early to judge, ~5.6 min/step); delaunay broad chain continues to 3000 for the record.
Jammy2211 commentedon Jul 27, 2026
Milestone 11 — DELAUNAY SOLVED by the fixreg arm: exact truth recovery in 150 steps.
+29878 is within 200 nats of the truth-point bar (+30079) and 10k above the Nautilus floor. Resurrection churn collapsed 2.2% → 0.4%/lane-step. The free AdaptSplit regularization axis — not discovery, not the flip-seam landscape — was the delaunay blocker. Consistent with its known pathology (forward-eval NaNs at inner ≥ 10; #104's double-squared λ⁴ fragility): free-reg trajectories wander into the NaN wall and the search spends itself resurrecting.
Production recipe this implies: SLaM-style — source_pix[1] inherits/fixes the regularization from a preceding fit (exactly the fixed-lens-light framing this campaign started from), and delaunay becomes as searchable as knn. No basin-hopping machinery needed on this evidence.
Completing the matrix: rect
_fixregarm launched (331256, Constant pinned at its truth-bar optimum 3.16) — tests whether the free-reg axis also explains rectangular's slow climb. knn needs no arm (free reg already succeeded there).feat: PIX_REG=matern arm — free MaternKernel(coefficient,scale) reg f…
Jammy2211 commentedon Jul 27, 2026
Milestone 12 — knn late breakout to exact truth; Matérn arm climbing clean; the reg-axis story is now coherent across meshes.
Coherent mechanism across the matrix: AdaptSplit's high-coefficient region is bad-but-finite on knn (resurrection eventually escapes, hence the late breakout) but NaN on delaunay (lanes die instead of learning, hence the permanent stall). Matérn has no NaN wall on either (graceful degradation in the scans: +15.6k at coeff 316) — its truth-point bar +29682 ≈ AdaptSplit's, so nothing is lost in fit quality by choosing the safe parametrization.
Jammy2211 commentedon Jul 28, 2026
Milestone 13 — overnight matrix complete for knn + delaunay: gradient search recovers truth on BOTH, under every viable reg configuration.
Final 3000-step results (all rc=0):
Refined mechanism: AdaptSplit's NaN wall doesn't forbid escape on delaunay, it taxes it (escape at ~step 2000 vs knn's ~1300 vs Matérn needing none). Practical ordering for free-reg delaunay: Matérn ≥ fixed-reg ≫ AdaptSplit, at equal final fit quality.
Rectangular is now the open cell — not landscape, throughput: ~5.7 min/step (~17× knn) means 19 h bought only 200 steps (broad flat at −30136; fixreg at −71108 after 100). Chains extended to 5 links (broad → 331262/331263, fixreg → 331264/331265) for a ~1000-1200-step budget; the per-step cost itself is flagged for the A100 profiling follow-up. Late-breakout evidence says don't call rect before ~1500+ steps.
docs: pix_prodigy_findings — Prodigy recovers truth on all searchable…
Jammy2211 commentedon Jul 28, 2026
Milestone 14 — results promoted; three PRs open.
pix_prodigy_findings.md, the 3-mesh harness, run artifacts.imaging/searches/multi_start_prodigy/{pixelization,knn,delaunay}.pyon the libraryaf.MultiStartProdigy; newknn+delaunay_maternmodel types (the validated gradient-safe reg pairings); model_type-aware per-cell knobs (16/3000/batch-4 for pix, existing cells untouched — verified); campaign-knowledge section insearches/README.md.guides/modeling/searches.py— the 'parametric sources only' limitation replaced with the validated pixelized-source guidance (resurrect, reg scheme, budgets).Rectangular chains continue (5-link budget); their verdict will be appended to the findings doc + PR #119 before merge, or noted as the A100 follow-up if throughput keeps it out of reach on CPU. Merges are yours as always.
feat: PIX_BANDWIDTH knob — the rect stall implicates the sharp 0.1 ke…
docs: findings close-out — rect bandwidth diagnosis, bandwidth free-v…
Jammy2211 commentedon Jul 28, 2026
CLOSING SUMMARY — the campaign question is answered.
Does MultiStartProdigy work for pixelized source meshes? YES — from fully broad mass priors it recovers the exact simulator truth on the knn mesh (+29724, r_E 1.599, free AdaptSplit reg) and the delaunay mesh (+30202 @ r_E 1.600 with inherited reg in ~150 steps; +29792 with free Matérn; +30099 even with free AdaptSplit after its resurrection tax), beating matched-settings Nautilus baselines by 10-24k nats at a fraction of the wall time. The #100/#101 verdict is overturned.
The mechanism was the regularization axis, not mesh landscape: AdaptSplit's λ⁴ high-coefficient region is escape-taxed (knn) or NaN-walled (delaunay); fixed/inherited reg (the SLaM pattern) or free Matérn removes the hazard at equal fit quality. Rectangular remains open — throughput-bound (~17× knn step cost, an A100 target) with the sharp-bandwidth hypothesis in flight; its verdict appends to PR #119.
Deliverables: findings doc + harness + artifacts (PR #119); mature
af.MultiStartProdigycells +knn/delaunay_maternmodel types + campaign knowledge in autolens_profiling (PR #91); user-facing lessons inguides/modeling/searches.py(PR #363). Two library bug arcs found + merged along the way (Fit #1423 cadence, Array PR#411 Delaunay NaN callback). Six follow-ups filed toPyAutoMind/ideas.md(warm-started sampler wave, resurrection→divergence validation, heavy Nautilus refs, Matérn-as-production, A100 profiling, bandwidth scan).Closing at human direction; merges remain human.
data: truth-bar scan artifacts (local runs; rectangular file is the b…
Merge pull request #119 from PyAutoLabs/feature/pix-prodigy-cpu
research: batch size and regularization close out phase 2 (#125)