Overview
searches/ currently runs a JAX gradient MAP optimizer (af.MultiStartAdam) only on the single-lens/single-MGE-source cell. This task extends that proven MGE cell to a 4-deflector + 4-source group-scale model (~50–55 non-linear params) to answer: do the JAX gradient max-likelihood optimizers scale to a higher-dimensional, harder lens model? We benchmark the MultiStart gradient family (fixed-step and auto-convergence) against Nautilus and check truth recovery. If cold-start optimizers fail, a careful-initialization arm follows.
Plan
- Write
simulators/group4_mge.py — simulate a 4-lens + 4-source MGE imaging dataset with known truth (truth.json).
- Add a
group/mge cell to the searches/ harness (_setup.py dataset+model builders, AnalysisImaging).
- Add
searches/_recovery.py — compare max_log_likelihood_instance to truth; emit a per-galaxy recovery block into the summary JSON.
- Register the MultiStart gradient family in two modes — fixed-step (
convergence=None) and automatic-convergence (af.MultiStartGradientConvergence), including a first-class multi_start_prodigy_autoconv cell — plus Nautilus as the reference.
- Run the benchmark, aggregate a recovery + wall-time comparison.
- Contingency: if cold-start fails recovery, add narrow-prior / warm-start initialization and re-benchmark.
Detailed implementation plan
Affected Repositories
- autolens_profiling (primary) — workspace/research only, no library source changes
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./autolens_profiling |
research/multiband-compile-ab |
dirty (untracked dataset/imaging/jwst_lw/) |
Suggested branch: feature/group4-mge-search-benchmark (fresh worktree off main via /start_workspace)
Model (settled)
- 4 lenses:
al.mp.Isothermal mass + MGE light (al.model_util.mge_model_from), ExternalShear on lens_0; per-galaxy centre prior seeded near truth.
- 4 sources: per-galaxy MGE light at distinct source-plane positions. Amplitudes stay linear (inversion); non-linear count ~50–55.
Samplers
nautilus (reference), and MultiStart JAX family run fixed-step (n_steps=300) and auto-convergence (MultiStartGradientConvergence(check_for_convergence=True, window=50, rtol=1e-4, atol=1e-3, min_steps=100)). First-class multi_start_prodigy_autoconv cell; summary surfaces actual steps-taken for the early-stop-vs-fixed-300 comparison.
Implementation Steps
simulators/group4_mge.py (mirror simulators/imaging.py CLI + simulators/group.py geometry) -> dataset + truth.json under dataset/imaging/group4_mge/<instrument>/.
searches/_setup.py: dataset_class="group" -> _build_group_imaging (auto-simulate via dataset_type="group4_mge"), _group_mge_model(), AnalysisImaging branch, _mask_radius_for + format_best_fit updates.
searches/_recovery.py + _runner._build_summary "recovery" block loading truth.json.
searches/_samplers.py: ("group","mge"): 200 n_live; fixed + autoconv builders; register in SAMPLER_BUILDERS.
- Leaf scripts
searches/<sampler>/group/mge.py; add cell to searches/sweep.py.
- Run cells (CPU JAX first);
searches/aggregate.py; record findings.
- Contingency (Phase 4): narrow-prior / warm-start init arm if cold-start fails.
Key Files
- New:
simulators/group4_mge.py, searches/_recovery.py, searches/{nautilus,multi_start_adam,multi_start_prodigy,multi_start_prodigy_autoconv,multi_start_lion,multi_start_adabelief}/group/mge.py
- Edit:
searches/{_setup,_samplers,_runner,sweep}.py, searches/README.md
Verification
ruff check . && ruff format --check .; AUTOLENS_PROFILING_SMOKE=1 import-smoke; simulate -> 4 lensed sources; Nautilus recovery anchor; then gradient sweep + aggregate.
Original Prompt
Click to expand starting prompt
Research profiling experiment in the autolens_profiling repo. We currently have autolens_profiling examples that run JAX gradient max-likelihood optimizers on a single lens galaxy with a single MGE source. Extend this to a much higher-dimensional, harder model: 4 lens galaxies + 4 source galaxies. Write a simulator.py that generates the dataset from known input truth, then run the existing JAX gradient optimizers (max-likelihood samplers) alongside Nautilus and record whether any of them scale to this dimensionality and recover the input truth. If none of the optimizers succeed, investigate more careful initialization strategies. This is an exploratory benchmark, not a library change.
Overview
searches/currently runs a JAX gradient MAP optimizer (af.MultiStartAdam) only on the single-lens/single-MGE-source cell. This task extends that proven MGE cell to a 4-deflector + 4-source group-scale model (~50–55 non-linear params) to answer: do the JAX gradient max-likelihood optimizers scale to a higher-dimensional, harder lens model? We benchmark the MultiStart gradient family (fixed-step and auto-convergence) against Nautilus and check truth recovery. If cold-start optimizers fail, a careful-initialization arm follows.Plan
simulators/group4_mge.py— simulate a 4-lens + 4-source MGE imaging dataset with known truth (truth.json).group/mgecell to thesearches/harness (_setup.pydataset+model builders,AnalysisImaging).searches/_recovery.py— comparemax_log_likelihood_instanceto truth; emit a per-galaxy recovery block into the summary JSON.convergence=None) and automatic-convergence (af.MultiStartGradientConvergence), including a first-classmulti_start_prodigy_autoconvcell — plus Nautilus as the reference.Detailed implementation plan
Affected Repositories
Branch Survey
dataset/imaging/jwst_lw/)Suggested branch:
feature/group4-mge-search-benchmark(fresh worktree offmainvia/start_workspace)Model (settled)
al.mp.Isothermalmass + MGE light (al.model_util.mge_model_from),ExternalShearon lens_0; per-galaxycentreprior seeded near truth.Samplers
nautilus(reference), and MultiStart JAX family run fixed-step (n_steps=300) and auto-convergence (MultiStartGradientConvergence(check_for_convergence=True, window=50, rtol=1e-4, atol=1e-3, min_steps=100)). First-classmulti_start_prodigy_autoconvcell; summary surfaces actual steps-taken for the early-stop-vs-fixed-300 comparison.Implementation Steps
simulators/group4_mge.py(mirrorsimulators/imaging.pyCLI +simulators/group.pygeometry) -> dataset +truth.jsonunderdataset/imaging/group4_mge/<instrument>/.searches/_setup.py:dataset_class="group"->_build_group_imaging(auto-simulate viadataset_type="group4_mge"),_group_mge_model(),AnalysisImagingbranch,_mask_radius_for+format_best_fitupdates.searches/_recovery.py+_runner._build_summary"recovery"block loadingtruth.json.searches/_samplers.py:("group","mge"): 200n_live; fixed + autoconv builders; register inSAMPLER_BUILDERS.searches/<sampler>/group/mge.py; add cell tosearches/sweep.py.searches/aggregate.py; record findings.Key Files
simulators/group4_mge.py,searches/_recovery.py,searches/{nautilus,multi_start_adam,multi_start_prodigy,multi_start_prodigy_autoconv,multi_start_lion,multi_start_adabelief}/group/mge.pysearches/{_setup,_samplers,_runner,sweep}.py,searches/README.mdVerification
ruff check . && ruff format --check .;AUTOLENS_PROFILING_SMOKE=1import-smoke; simulate -> 4 lensed sources; Nautilus recovery anchor; then gradient sweep + aggregate.Original Prompt
Click to expand starting prompt
Research profiling experiment in the autolens_profiling repo. We currently have autolens_profiling examples that run JAX gradient max-likelihood optimizers on a single lens galaxy with a single MGE source. Extend this to a much higher-dimensional, harder model: 4 lens galaxies + 4 source galaxies. Write a simulator.py that generates the dataset from known input truth, then run the existing JAX gradient optimizers (max-likelihood samplers) alongside Nautilus and record whether any of them scale to this dimensionality and recover the input truth. If none of the optimizers succeed, investigate more careful initialization strategies. This is an exploratory benchmark, not a library change.