feat: NNLS solver knobs via Settings (nnls_solver_tol / nnls_max_iter), default off#371
Merged
Merged
Conversation
…) — PARKED, not for merge (#369) Vendored jaxnnls while_loop driver with configurable tolerance and iteration cap; defaults bit-identical to upstream (solutions and gradients, validated on real production systems). Parked at user request 2026-07-09 — the measured win (~15-20% of solve) was judged not worth the new solver code path; this branch preserves the validated implementation should that change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QgtjXWS2iJegXMTDU4GHth
…), default off (#369) Rework of the parked d8a1c84: the knobs move from general.yaml config keys to per-fit Settings attributes (defaults None = jaxnnls's own tolerance formula and 50-iteration cap — behaviour identical when unset). The vendored autoarray/util/jax_nnls.py driver is unchanged: reuses all jaxnnls building blocks + the relaxed-KKT custom-vjp backward; defaults validated bit-identical to upstream in solutions and gradients on real production systems. Measured on the real HST pixelization+MGE systems (PyAutoArray#369): Settings(nnls_solver_tol=1e-6) saves ~15-20% of solve time with rel delta-objective 3.8e-13 (delta log-evidence ~1e-8); nnls_max_iter also caps the vmap worst-case lane. Full ledger: autolens_profiling results/notes/nnls_solver_ledger.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QgtjXWS2iJegXMTDU4GHth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per-fit knobs for the JAX positive-only (NNLS) interior-point solve, exposed on the
Settingsclass and default off (unset = bit-identical to upstream jaxnnls, validated in solutions and gradients on real production systems):Settings(nnls_solver_tol=1e-6)— ~15-20% of solve time on production HST pixelization+MGE fits, rel Δobjective 3.8e-13 (Δlog-evidence ~1e-8).Settings(nnls_max_iter=...)— caps the solve; undervmapthis bounds the worst-case (slowest-lane) batched cost.Implementation:
autoarray/util/jax_nnls.pyvendors only jaxnnls'swhile_loopdriver (tolerance/cap are hard-coded upstream); every building block (initialize,pdip_pc_step,solve_relaxed_nnls,diff_nnls) and the relaxed-KKT custom-vjp backward pass are reused from jaxnnls. Knobs are static closure params behind anlru_cacheso JIT tracing caches hit. NumPy (fnnls_cholesky) path untouched.Evidence
Full measurement record: #369 and
autolens_profiling/results/notes/nnls_solver_ledger.md(the closed optimization ledger — every deeper lever measured negative; this knob is the one real win).Test plan
test_autoarray/util/test_jax_nnls.py: module-level JAX-import guard, Settings defaults-off, NumPy-path invariance to the knobs.🤖 Generated with Claude Code
https://claude.ai/code/session_01QgtjXWS2iJegXMTDU4GHth