Skip to content

feat(fixed-light): lever 3 verdict — shared Cholesky log det(F+λH) 1.19x on numba CPU; phase 3 = 1.80x (#267) - #272

Merged
Jammy2211 merged 15 commits into
mainfrom
feature/fixed-light-numba-levers-l3
Sep 16, 2026
Merged

Jammy2211 merged 15 commits into
mainfrom
feature/fixed-light-numba-levers-l3

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lever 3 of #267, stacked on #271 (lever 2): the CPU A/B and A100 rows for PyAutoArray's shared-Cholesky log det of F + λH and cached curvature_reg_matrix (library PR: PyAutoLabs/PyAutoArray#555), the five-pin witness, the deliberate handshake flip in the phase-1 accounting test, and the lever 3 section of the phase-3 verdict note.

Verdict

Control = lever 2, feature = lever 3.

RAL job 343356 (CPU, gpu partition CPUs-only, 1 thread, route b memo ON, --n-repeats 64 = 32 counterbalanced ABBA blocks): whole call 273.194 → 230.031 ms, 1.188x (1.191x on medians, −43.163 ms); inversion.log_det_curvature_reg_matrix_term 40.849 → 6.318 ms (6.47x on the site, 14.95 % of the call to 2.75 %); inversion.curvature_reg_matrix 4.536 → 2.281 ms with n_calls 2 → 1; solver.fnnls_cholesky — the row that must not move — 63.928 → 61.133 ms, −4.4 % against a 31–36 % clean spread with solver_stats identical in both arms. All four cell gates PASS in both arms, witness W1–W5 PASS with the fast and dense-forced log dets bit-identical (Δ exactly 0.0 nats against a 1e-10 gate), the figure_of_merit bit-identical and the reconstruction byte-identical, and both arms' production log_likelihood bit-identical at 18665.014330695605. The only three gates numbers that move are log-det-derived at one ULP (+3e-12 and −5e-12 nats).

Job 343355 ran the same A/B at 16 repeats: its control completed (268.681 ms, ABBA 1.0182 PASS — the bridge row, reproducing lever 2's recorded 267.448 ms to +0.46 %) and its feature arm measured 224.330 ms before tripping the harness's 1.03 instrumentation-overhead cap over 8 blocks and dying with no JSON. That cap's fixed cost does not shrink with the call (1.0147 at 413 ms → 1.0366 at 224 ms), so 64 repeats was applied symmetrically to both arms; the gate and the estimator are untouched. The bridge row's JSON+PNG are kept unversioned under output/ral_job343355_16repeats/.

RAL job 343357 (fixed_light.py cell, A100 80GB PCIe, fp64, COMPLETED): identity. s3/rows["Log det Cholesky (F+λH reduced)"] 1.125 → 1.139 ms; all six log_evidence_terms bit-identical in both systems; the eager xp=np family — which does take the fast path — bit-identical too (log_evidence_eager 29140.295876199474 in both arms, where lever 2's moved −3.4466e-06 nats); S0 log-det pins PASSED and pinned_drift empty in both. The A100's own dense potrf of the same F + λH is 1.139 ms against 40.849 ms on one CPU core and 5.344 ms on lever 3's route, so CPU-only — and structurally so, since the JAX path never runs fnnls and has no factor to read.

Cumulative levers 1+2+3 vs merge base 413.3 ms: 413.301 → 230.031 ms, 1.797x (1.80x), 183.270 ms removed — a lower bound, since job 343356 re-measured lever 2's library 2.1 % slow and that applies to both of its arms.

Scripts Changed

  • hpc/batch_cpu/submit_breakdown_imaging_fixed_light_numba_levers_l3_delaunay_ral_hst_fp64 — new: two-arm Leg D run, control lever 2 / feature lever 3 on private PYTHONPATH checkouts; in-job proof the arms differ by exactly lever 3 (log_det_from_passive_cholesky_from and the factor keyword present only in the feature tree); witness in the feature arm.
  • hpc/batch_gpu/submit_breakdown_imaging_fixed_light_numba_levers_l3_delaunay_a100_hst_fp64 — new: two-arm fixed_light.py Delaunay cell on the A100, fp64.
  • scripts/imaging/likelihood_breakdown/fixed_light_numba_levers_l3_witness.py — new: W1 fast path fires once and the factor covers k_active ≈ 1485 of 1500; W2 fast vs dense-forced log det; W3 figure_of_merit ≤ 1e-9 (bit-identical or the nats); W4 curvature_reg_matrix same object on repeat access and the fnnls solution byte-identical with/without the fast path; W5 same-fit timing.
  • scripts/imaging/likelihood_breakdown/fixed_light_numba.py — the inversion.curvature_reg_matrix site is now declared cached=True (it became a cached_property in lever 3).
  • scripts/misc/test/test_fixed_light_numba.py — test_curvature_reg_matrix_is_recomputed_more_than_once → test_curvature_reg_matrix_is_cached, asserting n_calls == 1: the phase-1 handshake, flipped on purpose. This test fails against any PyAutoArray without lever 3, so this PR merges after feat(inversion): read log det(F + λH) off the NNLS Cholesky factor; cache curvature_reg_matrix (#267 lever 3) PyAutoArray#555 (library-first).
  • results/breakdown/imaging/ — 4 JSON + 4 PNG + witness JSON.
  • results/notes/fixed_lens_light_levers_2026_09.md — lever 3 sections; the published F + λH and Log determinants + evidence group rows re-cut, since log_det_curvature_reg_matrix_term no longer owns a factorisation (the solve does).

Cross-reference

Library change: PyAutoLabs/PyAutoArray#555 (feature/fixed-light-numba-levers-l3 @ b4322c3e, stacked on #554). Merge order was #269 → #271 → this; superseded on 2026-09-16 by merging this PR alone against main (see Merge route below). Library: #553 → #554 → PyAutoLabs/PyAutoArray#555, all merged.

Tracked by #267 (lever 3 of 3).

Heart gate

pyauto-heart readiness was RED (score 20) at ship time with two release-chain reasons unrelated to this branch — "install verification FAILED (testpypi; checks F)" and "release validation FAILED (stage integrate)" — acknowledged by the human on 2026-09-16 for PR-open only (levers 2 and 3). Merge stays a human act via /prm.

Merge route (2026-09-16, /prm)

This PR is now based on main and carries the whole phase-3 stack: the lever 1 commits of #269 (7c7968c, c899326), the lever 2 commits of #271 (289cea3, fd80eb9), the lever 3 commits above, plus three ship-side test commits and the merge of main (#270). #269 and #271 are closed as superseded, not merged, because the lint workflow checks out PyAutoArray main, which since PyAutoArray #555 merged (91240e43) already contains all three levers: the lever 1 / lever 2 copies of scripts/misc/test/test_fixed_light_numba.py pin the pre-lever-3 library (curvature_reg_matrix recomputed, patched() without factor) and can never go green on their own again. Nothing in their diffs is lost — every commit lands through this PR.

Ship-side fixes (no submit script changed; the recorded RAL runs depend on their text):

  • test_fixed_light_cell.py excludes the two-arm _fixed_light_numba_levers_ submits from its single-arm contracts (as the library and trace families already are), and test_fixed_light_numba_levers_submits.py owns them: two subshell arms on private control/feature checkouts, provenance echoes, paired _control/feature config names, --mesh + harvest prefix + per-arm cache wipe where the cell is fixed_light.py, the adapt_split provenance where it is delaunay.py (lever 1).
  • Merge of main (research: trace-based one-process decomposition of the certified Delaunay GPU call (residue phase 1, #268) #270 trace legs) resolved in that same _submits() filter: all three family exclusions kept.

🤖 Generated with Claude Code

Jammy2211 and others added 7 commits September 16, 2026 10:17
…267)

Lever 1 of the numba CPU levers task replaced the two pure-Python loops in
PyAutoArray's split-regularization assembly (`reg_split_np_from`,
`pixel_splitted_regularization_matrix_np_from`) with numba kernels, keeping
the original loop bodies as `_reg_split_reference` /
`_pixel_splitted_regularization_matrix_reference`. This adds the measurement
and correctness legs for that lever.

* `hpc/batch_cpu/submit_breakdown_imaging_fixed_light_numba_levers_delaunay_ral_hst_fp64`
  — one job, two arms: phase 2's Leg D (route b, sparse_numba, memo ON,
  threads 1, n-repeats 16, iid) run against a private merge-base checkout
  (5e2bc0f4) and against the lever branch (bae9296e), each in its own
  subshell with its own PYTHONPATH prepend and numba cache, each printing
  `autoarray.__file__` and its checkout's HEAD. `gpu` partition CPUs-only,
  no --gres.
* `hpc/batch_gpu/submit_breakdown_imaging_fixed_light_numba_levers_delaunay_a100_hst_fp64`
  — the same two arms of `delaunay.py --regularization adapt_split
  --split-setup --vmap-batch 16`. Lever 1 changed only the `xp == np` branch
  and this cell builds H with `xp=jnp`, so the expectation is identity; the
  row exists to confirm the #536 compacted scatter is the path that runs and
  to record the measured H.
* `scripts/imaging/likelihood_breakdown/fixed_light_numba_levers_witness.py`
  — W1 bit-identity of `inversion.regularization_matrix` against the
  reference chain (`np.array_equal`), W2 the interpolator's cached stencil
  tables are unmutated, W3 the fit's `figure_of_merit` is unchanged when both
  numpy entry points are monkeypatched to the references. PASSes locally on
  the HST Delaunay N=1500 source-only AdaptSplit system with all three
  differences exactly 0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n numba CPU, A100 identity (#267)

RAL job 343345 (gpu partition CPUs-only, 1 thread, private merge-base control):
route b memo-ON whole call 413.301 -> 299.709 ms, inversion.regularization_matrix
110.599 -> 5.924 ms; all cell gates PASS; witness W1-W3 PASS (H bit-identical,
tables unmutated, log evidence relative diff 0.0). RAL job 343346 (A100 fp64):
identity to 0.03 % on the H prefix; the #536 compaction constants are inert at
K=4. Note: results/notes/fixed_lens_light_levers_2026_09.md (levers 2-3 pending).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
#267)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…CPU, A100 identity, CPU-only lever (#267)

RAL job 343353 (gpu partition CPUs-only, 1 thread, control = lever 1): route b memo-ON
whole call 302.709 -> 267.448 ms, inversion.log_det_regularization_matrix_term
37.480 -> 6.508 ms; all cell gates PASS; witness W1-W5 PASS (route fires once,
log det rel 1.2e-9, log evidence rel 2.3e-10, gates admit, 6.0x same-matrix).
RAL job 343354 (A100 fp64, fixed_light.py): all log_evidence_terms bit-identical;
the A100's dense Cholesky of H is 1.13 ms, so the lever stays on the numpy path.
Cumulative levers 1+2 vs merge base: 413.3 -> 267.4 ms (1.55x). Note section
added to results/notes/fixed_lens_light_levers_2026_09.md (lever 3 pending).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… curvature_reg_matrix cache handshake (#267)

Lever 3 (PyAutoArray b4322c3e, stacked on lever 2 0b17c292) publishes the NNLS
solve's Cholesky factor through an optional `factor` out-dict and reads
`log det(F + λH)` off it via a Schur complement over the ~15 active columns,
instead of factorising the same (1500, 1500) matrix a second time; it also makes
`curvature_reg_matrix` a `cached_property`.

CPU A/B submit (control = lever 2, feature = lever 3), A100 A/B submit on
`fixed_light.py`, and a W1-W5 witness. Witness PASS locally: fast path fires
exactly once, k_active 1485 == len(passive_set) with 15 active columns,
log det Δ +1.819e-12 nats (rel 2.2e-16, gate 1e-10 — three decades tighter than
lever 2's), figure_of_merit BIT-IDENTICAL, reconstruction byte-identical,
`curvature_reg_matrix` the same object on two accesses; site timing 54.0 -> 7.5 ms
(7.2x) plus one 3.6 ms `_xp.add(F, H)` build.

Profiling-side handshake, correct only against lever 3's PyAutoArray:
the `inversion.curvature_reg_matrix` site spec now declares the site cached, and
`test_curvature_reg_matrix_is_recomputed_more_than_once` became
`test_curvature_reg_matrix_is_cached` asserting `n_calls == 1`. Measured: 27
passed against b4322c3e; against 0b17c292 that one test fails with `n_calls == 2`
and nothing else does. CI checks out PyAutoArray with no `ref:` (its default
branch), so this branch is RED on that one test until the library PR merges.

The spec's `cached=` flag is read off the installed class rather than written as
a literal `True`, because this job runs ONE checkout of the cell against TWO
PyAutoArray revisions: a literal would fire the cell's
`cached_site_call_count_violations` AssertionError in the control arm and kill the
control arm of the measurement the gate exists to serve. Both descriptor types are
recognised — PyAutoArray decorates with `autonerves.cached_property`, not
`functools.cached_property`. The unconditional pin stays in the test.

Also: `numpy_solver_injected`'s `patched()` now accepts and clears the `factor`
out-dict (forwarding it to the library only when the signature has it), without
which route `d_np` raises `TypeError: patched() got an unexpected keyword
argument 'factor'` under lever 3.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…A gate is a coin flip at 224 ms (#267)

Job 343355's feature arm measured 224.330 ms and then died on the ABBA
instrumentation-overhead gate (1.0366 > 1.03 over 8 blocks), taking its result
JSON with it, while its control arm passed the same gate at 1.0182. The recorded
lever-1/2 rows show that ratio climbing purely as the call shortens (1.0147 at
413.301 ms, 1.0167 at 302.709, 1.0163 at 299.709, 1.0221 at 267.448, 1.0182 at
268.681) against a 16-29 % clean-call spread, with the same per-block pattern in
every run, so at lever 3's ~224 ms the threshold sits inside the estimator's own
standard error for BOTH arms.

64 repeats gives 32 counterbalanced blocks instead of 8, applied symmetrically to
both arms — the remedy the cell itself prints. The gate is not weakened and the
estimator is untouched. The bridge to the earlier levers stays job 343355's
16-repeat control row: 268.681 ms against lever 2's recorded 267.448 ms, 0.5 %.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…19x on numba CPU, A100 identity; phase 3 = 1.80x (#267)

RAL job 343356 (gpu partition CPUs-only, 1 thread, 64 repeats, control = lever 2):
route b memo-ON whole call 273.194 -> 230.031 ms; inversion.log_det_curvature_reg_matrix_term
40.849 -> 6.318 ms; curvature_reg_matrix n_calls 2 -> 1; all cell gates PASS; witness W1-W5
PASS with log det and log evidence bit-identical. Job 343355 (16 repeats) tripped the 1.03
instrumentation-overhead cap on the shorter call and is kept as the bridge row (control
268.681 ms vs lever 2's 267.448). RAL job 343357 (A100 fp64): identity; CPU-only lever.
Cumulative levers 1+2+3 vs merge base: 413.3 -> 230.0 ms (1.80x). Note sections added to
results/notes/fixed_lens_light_levers_2026_09.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Jammy2211 and others added 8 commits September 16, 2026 22:56
… submits (#267)

test_fixed_light_cell.py's single-arm contracts caught the lever submits
through its glob: `^python3 -u` misses the indented subshell arms, lever 1
runs delaunay.py (no --mesh, its own config names, no cache by design — a
verbatim copy of the adapt_split submit), and levers 2/3 wipe per-arm caches
as JAX_CACHE_{CONTROL,FEATURE} rather than the single-arm string. Exclude
the family there, as the library family already is, and give it
test_fixed_light_numba_levers_submits.py: two arms, private checkouts on
PYTHONPATH, provenance echoes, paired _control/feature config names, mesh
and harvest prefix and per-arm cache wipe where the cell is fixed_light.py.
No submit script changes: the recorded RAL runs depend on their text.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…#267)

The lever-3 submit's header describes its provenance heredoc in prose
(`$(cat <<'EOF' ...)` — the explanation for why it is not `read -r -d ''`),
and the arm parser read that as a real `EOF` heredoc opener, swallowed the
rest of the file and found zero `( ... )` arms. Skip comment lines when
looking for an opener; the parser now finds two arms on all three levers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…oth submit-family exclusions kept (#267)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Jammy2211
Jammy2211 changed the base branch from feature/fixed-light-numba-levers-l2 to main September 16, 2026 22:12
@Jammy2211
Jammy2211 merged commit cea41bb into main Sep 16, 2026
1 check passed
@Jammy2211
Jammy2211 deleted the feature/fixed-light-numba-levers-l3 branch September 16, 2026 22:15
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