Skip to content

test: solver-gradient certification + staircase FD methodology (phase 5 of #657) - #240

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/point-solver-implicit-diff
Jul 31, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/point-solver-implicit-diff

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase-5 certification of the PointSolver implicit-diff gradients (#657; library PR linked below). Extends the point-source gradient certification script to the full variant matrix and re-verifies value invariance.

FD methodology for solver-chained fits (encoded in the script prose): the forward solve quantizes positions at pixel_scale_precision, so the computed likelihood is a staircase — central differences below the stair width read exactly zero while the implicit AD gradient (the exact-solve envelope derivative) is correct. Certification therefore uses a fine-precision solver (1e-5) + the per-parameter rel_steps FD sweep, with a justified 2% tolerance on the solver blocks (residual stair noise ~1–2%; a wrong rule misses by factors at every parameter and step).

Scripts Changed

  • scripts/point_source/jax_grad/gradient.py — phase-5 marker note removed; four new blocks: FitPositionsImagePairAllSolved + PointSolved (solved β* through the solver, FD-certified), FitPositionsImagePairAll + Point (sampled centre, exercises the dβ term, FD-certified), FitPositionsImagePairRepeatSolved (finiteness + liveness only — min-selection subgradient, exclusion documented), fluxes+time-delays solved combo (nested autodiff through Hessian magnifications; H0 live). Solver-chained models carry no cosmology component (documented limitation: free cosmology cannot cross the custom_jvp boundary; harmless for 2-plane positions).

All blocks pass end-to-end; the four jax_likelihood scripts re-run against the library branch with every regression literal unchanged (value-invariance gate).

Upstream PR

PyAutoLabs/PyAutoLens#677

Test Plan

  • scripts/point_source/jax_grad/gradient.py runs green end-to-end (all six blocks)
  • scripts/point_source/jax_likelihood/{point,source_plane,image_plane,fluxes_time_delays}.py — literals unchanged
  • Local smoke 20/21 — sole failure is the KNOWN WSL-laptop margin imaging/subhalo_recovery.py TIMEOUT(300s) (green on main CI; untouched by this diff; recorded in phase 3)

Generated by the PyAutoLabs agent workflow.

… (phase 5 of #657)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 31, 2026
@Jammy2211
Jammy2211 merged commit 244f0de into main Jul 31, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/point-solver-implicit-diff branch July 31, 2026 11:23
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 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