Repository navigation
Description
Overview
The smoothness regularization schemes (Constant, ConstantSplit, Adapt, AdaptPower, AdaptSplit, AdaptSplitPower) build an H whose rows sum to zero, so the constant vector is a null mode held up only by the net 1e-8 diagonal jitter. The evidence term log det H therefore contains log(1e-8 + O(eps·‖H‖)): an arbitrary constant plus rounding noise. At large coefficients that noise breaks eager/jit agreement and gradient checks. It's latent on main for Delaunay + AdaptSplit, and it's what blocks the #609 KNN fix. Found while investigating #609 (mechanism write-up).
Plan
- Mark each regularization scheme with whether its
Hhas the constant vector as an exact null mode by construction. Measured: the six smoothness schemes yes; the zeroth and kernel schemes no. - For those schemes, normalise the evidence with the pseudo-determinant (the standard intrinsic-GMRF treatment): ground one pixel per regularized mapper block,
log pdet(H) = Σ_b log P_b + log det(H with those rows/cols removed). This stays sparse and jit-static. - A unit test pins each scheme's flag to its measured spectrum, and the pseudo-determinant is checked against an eigenvalue oracle.
- Validate with autolens_workspace_test
jax_grad/delaunay.py(log det H eager/jit, latent drift on main) and the full PyAutoArray suite. fix: Preserve KNN neighbors in a partial final point block #609's PR then follows and must leavejax_grad/knn.pygreen with no tolerance changes. - Likelihood change (approved by the maintainer 2026-11-09): every fit using these six schemes shifts its log evidence by a constant +½·ln(1e8) = +9.21 nats per regularized mapper. Parameter inference is unchanged apart from noise removal.
- Tier: judge. Merge mode: human
/prm.
Detailed implementation plan
Affected Repositories
- PyAutoArray (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoArray | main | clean |
Suggested branch: feature/intrinsic-reg-pseudo-det. PyAutoArray is also claimed by magnification-maps-wiring; the maintainer override of 2026-11-08 applies.
Implementation Steps
autoarray/inversion/regularization/abstract.py: addhas_constant_null_mode: bool = Falsewith a docstring explaining the intrinsic prior.- Set it True on
Constant,ConstantSplit,Adapt,AdaptPower,AdaptSplit,AdaptSplitPower. Set it explicitly False onAdaptSplitZeroth/AdaptSplitZerothPower, which subclassAdaptand add a zeroth term.CurvatureMask/FourthOrderMaskstay False: higher-order operators may have larger null spaces, which is a follow-up. autoarray/inversion/inversion/abstract.pylog_det_regularization_matrix_term: compute the grounded indices (first parameter of each intrinsic regularized block, inregularization_matrix_reducedcoordinates). ReturnΣ log P_b + _log_det_symmetric_from(H[keep][:, keep]). The per-schemeslogdethook (kernel schemes) is untouched.- Tests in
test_autoarray/inversion/: (a) flag vs measured spectrum for every scheme on Delaunay and rectangular fixtures; (b) the grounded log det equals the eigen pseudo-determinant and is independent of the jitter; (c) a multi-mapper block case; (d) update hard-coded evidence values that shift by exactly +9.21 nats per intrinsic mapper. - Validate: full unit suite, autolens_workspace_test
jax_grad/delaunay.pyandjax_likelihood/*. Pinned likelihood values there may shift (expected:log_likelihoodpins unaffected; evidence/figure-of-merit pins shift +9.21). Report them rather than editing workspace pins (library-first).
Key Files
autoarray/inversion/regularization/*.py: scheme flagsautoarray/inversion/inversion/abstract.py:log_det_regularization_matrix_term
Original Prompt
Click to expand starting prompt
Mind prompt draft/bug/autoarray/intrinsic_regularization_log_det_pseudo_determinant.md (Priority high, Consequence judge).
Witness:
- For every intrinsic scheme (Constant, ConstantSplit, Adapt, AdaptPower, AdaptSplit, AdaptSplitPower), log det H equals the pseudo-determinant (Σ log P_b + log det of H grounded on one pixel per block), independently of the jitter.
- autolens_workspace_test
jax_grad/delaunay.py: log det H eager/jit agree to 1e-10 (1.2e-8 on main). - A unit test pins
has_constant_null_modeto the measured spectrum of every scheme.
Symptom. The smoothness schemes build an H whose rows sum to zero by construction, so the constant vector is a null mode held up only by the net 1e-8 diagonal jitter. Measured on Delaunay and rectangular fixtures: λ_min(H) = 1.000e-8, with eigenvector exactly 1/√P, for Constant, ConstantSplit, Adapt, AdaptPower, AdaptSplit and AdaptSplitPower. The zeroth and kernel schemes have λ_min of order 1. log det H therefore contains log(1e-8 + O(eps·‖H‖)). At large coefficients (AdaptSplit outer = 10, ‖H‖ ≈ 3e4), rounding moves it by about 1e-4 relative:
- Delaunay + AdaptSplit on main shows log det H eager/jit drift of 1.2e-8 (figure of merit 1.6e-9).
- Once fix: Preserve KNN neighbors in a partial final point block #609 is fixed, KNN + AdaptSplit fails
jax_grad/knn.py: eager/jit 3.9e-9 against the 1e-10 bar, and AD vs FD off by 1–3%.
Fix. Treat H as the precision of an intrinsic GMRF and normalise with the pseudo-determinant over the non-constant modes. For a symmetric H with null vector 1/√P, pdet(H) = P · det(H with one row and column deleted), which stays sparse and static-indexed under jit.
- Gate per scheme with an explicit
has_constant_null_modeattribute: False by default, explicitly False on zeroth-term subclasses. - CurvatureMask / FourthOrderMask stay unchanged; higher-order operators may have larger null spaces (follow-up).
The maintainer approved changing likelihood values on 2026-11-09. Every fit using these six schemes shifts its log evidence by a constant +½·ln(1e8) = +9.21 nats per regularized mapper; parameter inference is unchanged apart from noise removal. This ships before the #609 KNN fix (two-PR decision, 2026-11-08).
Activity
Jammy2211 commentedon Nov 9, 2026
Library PR Created
API change summary:
AbstractRegularization.has_constant_null_mode.log_det_regularization_matrix_termis now the pseudo-determinant for Constant, ConstantSplit, Adapt, AdaptPower, AdaptSplit and AdaptSplitPower. Log evidence /figure_of_meritrises by +9.21 nats per such regularized mapper.Workspace impact (option ii, pins). Six autolens_workspace_test scripts pin figure-of-merit values that shift by exactly +9.21 or +18.42:
imaging/jax_likelihood/delaunay.pyimaging/jax_likelihood/rectangular.pyimaging/jax_likelihood/rectangular_rtu.pyimaging/jax_likelihood/rectangular_mge.pyimaging/jax_likelihood/rectangular_dspl.pyimaging/jax_likelihood/rectangular_dspl_rtu.pyrectangular_mge_rtu.pyhangs in its vmap step on main as well, so it can't be re-measured here.Next: /start_workspace → companion autolens_workspace_test PR updating those pins.
Generated by Claude Code
Jammy2211 commentedon Nov 9, 2026
Shipped — 2026-11-09
jax_likelihoodfigure-of-merit values, all measured: +9.2103 per intrinsic-regularized mapper.draft/research/autoarray/evidence_over_solved_parameters_with_zeroed_pixels.md(option K) anddraft/bug/autoarray/curvature_fourth_order_mask_null_space.md.Generated by Claude Code