Skip to content

fix: regenerate rectangular-mesh constants and un-park the jax_grad gradient check - #280

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/gradient-eager-jit-divergence-py313
Aug 26, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/gradient-eager-jit-divergence-py313

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

⚠️ Merge after PyAutoArray#490 — library-first. These constants are wrong against a library that does not yet carry the mapper fix, so CI here will be red until #490 lands.

Closes #279.

What this is

#490 corrects mirrored bilinear row weights and a round-off-dependent cell assignment in the adaptive rectangular mapper. That changes reconstructions for every adaptive rectangular mesh, so the hardcoded assertion constants for the affected scripts move. This regenerates them and un-parks the script that surfaced the bug.

Every constant regenerated from measurement, and only where attributable

A full 16-script paired sweep — the fixed build against a venv pinned to main's interpolator — so each change is known to be caused by #490 rather than by pre-existing breakage:

verdict count
regenerate 8 passed before, moved by the fix
unchanged 6 pass on both builds — all four interferometer/jax_likelihood/rectangular*, misc/jax_assertions/sparse_operators, interferometer/datacube/rectangular
skipped 2 imaging/jax_likelihood/rectangular_{mge,mge_rtu} hang to the timeout on both builds (the known jax vmap compile stall)

The two skipped scripts matter: they never completed on either build, so regenerating their constants from a run that did not finish would have baked in a value nothing verified. They are left untouched, and are pre-existing — not caused by this change.

script old new
imaging/jax_likelihood/rectangular.py -651692.997799 -650470.379097
imaging/jax_likelihood/rectangular_rtu.py -644121.021562 -652043.028434
imaging/jax_likelihood/rectangular_dspl.py -3695.93899659 -69.493112
imaging/jax_likelihood/rectangular_dspl_rtu.py -3823.887477 -78.805812
multi_dataset/jax_likelihood/rectangular.py -12932.06852498 -6531.732467
multi_dataset/jax_likelihood/rectangular_rtu.py -8903.89296045 -6619.860182
multi_dataset/jax_likelihood/rectangular_mge.py -6157.55707862 1871.070372
multi_dataset/jax_likelihood/rectangular_mge_rtu.py -3810.18711583 1964.629322

Shifts go in both directions. That is expected rather than alarming: with a pixelized source the inversion solves for the source values, so the mapping is a basis, not a prediction, and the figure of merit at an unfitted model point is not a correctness signal. The correctness evidence is in #490 — linear reproduction, continuity, convergence under refinement, and ground-truth source recovery, all of which improve.

Un-parking interferometer/jax_grad/gradient.py

It was NEEDS_FIX for an eager/jit divergence attributed to pure_callback constant-folding on Python 3.13. Both attributions were wrong (#279):

  • Not 3.13-only — 3.12 reproduces the failure identically on the same host, so the CI split was runner hardware, not CPython.
  • Not pure_callback — it is structurally absent from a rectangular-mesh path; it exists only in the Delaunay/Sibson qhull triangulation.

The cause was the mapper defect #490 fixes. With it the script is green on both legs, all four variants, all FD/AD checks, all gradients live — eager/jit gap exactly 0.0, with assert_eager_jit_consistent left untouched at rtol=1e-10 (3.13 83s, 3.12 86s against the 300s cap).

The surrounding narrative comment in no_run.yaml is updated too, since "The one below remains" is no longer true.

Validation

All nine touched or un-parked scripts exit 0 against the fixed library, on a stack built from source at the versions of retime run 32741386752 (jax/jaxlib 0.11.1, jaxnnls 1.0.1, numpy 2.5.2, scipy 1.17.1).

autogalaxy_workspace_test needs no changes — it asserts jax-vs-numpy parity, and both backends shift together.

🤖 Generated with Claude Code

https://claude.ai/code/session_016azuS2UbS3mFvfxkDFGsKj


Generated by Claude Code

…radient check

Follows PyAutoArray#490, which corrects mirrored bilinear row weights and a
round-off-dependent cell assignment in the adaptive rectangular mapper. That
changes reconstructions for every adaptive rectangular mesh, so the hardcoded
assertion constants for those scripts move.

MERGE AFTER PyAutoArray#490 — these constants are wrong against a library that
does not yet carry the fix.

Every constant here was regenerated from measurement, and only for scripts
confirmed to PASS on the pre-fix build and FAIL on the fixed one, so each change
is attributable to #490 rather than to pre-existing breakage. A full 16-script
paired sweep (fixed build vs a venv pinned to main's interpolator) gave:

  8  regenerate  passed before, moved by the fix
  6  unchanged   pass on both builds - all four interferometer/jax_likelihood
                 rectangular scripts, misc/jax_assertions/sparse_operators and
                 interferometer/datacube/rectangular are untouched
  2  skipped     imaging/jax_likelihood/rectangular_{mge,mge_rtu} hang to the
                 timeout on BOTH builds (the known jax vmap compile stall), so
                 they were never regenerated from a run that did not complete

The un-parked entry: interferometer/jax_grad/gradient.py was NEEDS_FIX for an
eager/jit divergence attributed to pure_callback constant-folding on Python 3.13.
Both attributions were wrong (autolens_workspace_test#279). 3.12 reproduces the
failure identically on the same host, so the CI split was runner hardware, not
CPython; and pure_callback is structurally absent from that path. The cause was
the mapper defect #490 fixes. With it, the script is green on both legs, all four
variants, with assert_eager_jit_consistent left untouched at rtol=1e-10 and an
eager/jit gap of exactly 0.0 (3.13 83s, 3.12 86s against the 300s cap).

Verified: all nine touched/un-parked scripts exit 0 against the fixed library.

Refs PyAutoLabs/PyAutoArray#490
Closes #279

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016azuS2UbS3mFvfxkDFGsKj

Copy link
Copy Markdown
Collaborator Author

CI on the first run went red on one script — this is the library-first ordering, not a content failure, and it is now resolvable.

Failing check: smoke / smoke (3.13), run 32921336533

Running 22 listed scripts
  scripts/imaging/jax_likelihood/rectangular.py ...   FAIL (16.1s)  DESIRED: array(-650470.379097)

Why it is not this PR's content. -650470.379097 is the new constant this PR introduces, so the script carried the change while the library did not: the run started at 02:04:20 and PyAutoArray#490 merged at ~02:04:50, so the dependency clone took pre-merge main. Against an unfixed mapper the script still produces the old -651692.997799, so the assertion fails exactly as expected.

Corroborating, from the same run:

  • Only one of the 22 smoke scripts failed, and it is one of the eight this PR regenerates — the only regenerated script that is in the curated smoke_tests.txt.
  • scripts/interferometer/jax_likelihood/rectangular.py passed, which matches the paired sweep's finding that all four interferometer rectangular scripts are unchanged by #490.
  • Everything else passed.

The upstream fix is now merged. PyAutoArray@158db384 carries it on main — verified directly: ix_up = xp.ceil is gone and ix_up = ix_down + 1 is present. A re-run therefore builds against the fixed library.

Re-running the failed jobs now. That is the single re-run this warrants; if it fails again the failure is real and I will treat it as such rather than re-running further.


Generated by Claude Code

@Jammy2211
Jammy2211 merged commit 8be3d59 into main Aug 26, 2026
4 of 6 checks passed
@Jammy2211
Jammy2211 deleted the feature/gradient-eager-jit-divergence-py313 branch August 26, 2026 20:07
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.

fix: interferometer jax_grad Variant B eager/jit NNLS branch flip

2 participants