You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: opt-in gradient-safe log-det via Settings.log_det_method (default unchanged)
The two Bayesian-evidence log-det terms (log_det_curvature_reg_matrix_term and
log_det_regularization_matrix_term) use 2*sum(log(diag(cholesky(M)))), which
returns NaN on the JAX backend (raises on numpy) when M is not numerically
positive-definite -- stalling gradient-based searches on ill-conditioned
regularization matrices (autolens_workspace_developer#104).
Add Settings.log_det_method (Optional -> conf general.yaml fallback, mirroring
the use_positive_only_solver pattern):
- "cholesky" (default) -- the historical computation, byte-for-byte unchanged
including the test-mode LinAlgError guard. Both terms route through a shared
_log_det_symmetric_from helper; the default branch is the identical expression.
- "slogdet" -- logabsdet of xp.linalg.slogdet(M): identical where M is
positive-definite, finite and differentiable where the Cholesky would NaN.
Opt-in, non-default, general (serves the adaptive schemes too); intended for
gradient-based work and for comparison against the Cholesky evidence.
Scope decided by an independent adversarial review of the reg-logdet
investigation: the current evidence's coefficient-dependence is correct to
machine precision, so the DEFAULT is deliberately not changed. This adds an
opt-in alternative only.
Full test_autoarray suite 926 passed (every existing log_evidence test
unchanged = byte-identical default). New tests: default==cholesky==numpy log det;
slogdet==cholesky on a PD matrix; slogdet finite where cholesky fails on a
non-PD matrix. No workspace config mirroring needed -- packaged-only keys layer
through production config (verified, like nnls_target_kappa).
Closes#391.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: autoarray/config/general.yaml
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ inversion:
9
9
nnls_jacobi_preconditioning: true # If True (default), the curvature matrix passed to jaxnnls.solve_nnls_primal is Jacobi-preconditioned (D Q D y = D q, x = D y). Fixes NaN backward-pass gradients on ill-conditioned Q and roughly halves forward solve time. Set False to restore the raw unpreconditioned solve.
10
10
nnls_target_kappa: 1.0e-11# Central-path relaxation parameter passed to jaxnnls.solve_nnls_primal. Larger values smooth the relaxed-KKT backward pass and prevent NaN gradients on ill-conditioned Q; smaller values tighten the primal solve. Verified finite gradients across all MGE/rectangular/delaunay pipelines (imaging + interferometer) with scale invariance over 5 orders of magnitude in noise. jaxnnls's own default (1e-3) is too aggressive for the backward pass.
11
11
reconstruction_vmax_factor: 0.5# Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.
12
+
log_det_method: cholesky # How the Bayesian-evidence log-determinant terms are computed. "cholesky" (default) is the historical 2*sum(log(diag(cholesky(M)))); "slogdet" uses logabsdet of slogdet(M), which is identical where M is positive-definite but finite (not NaN) where the Cholesky fails, for gradient-based searches (opt-in, non-default; does not change the default evidence). See PyAutoArray#391.
0 commit comments