Skip to content

test: Delaunay JAX likelihood-invariance parity guards (near-caustic + rtol 1e-8)#155

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/delaunay-qhull-callback
Jul 9, 2026
Merged

test: Delaunay JAX likelihood-invariance parity guards (near-caustic + rtol 1e-8)#155
Jammy2211 merged 1 commit into
mainfrom
feature/delaunay-qhull-callback

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase 2 of PyAutoArray#367: permanent parity guards for the qhull-only JAX Delaunay callback (library PR PyAutoLabs/PyAutoArray#368). The eager NumPy path still calls scipy find_simplex directly and is the numerical ground truth; these scripts pin the JAX path to it at rtol 1e-8, on a configuration deliberately chosen to stress the new visibility-walk point locator (folded near-caustic sliver triangles + split-cross regularization points).

Merge gate: library-first. Do not merge before PyAutoLabs/PyAutoArray#368 — the tightened 1e-8 asserts only hold with the exact walk locator (the old host callback also passes, but the new near-caustic script's pinned tolerances were validated against the new library).

Scripts Changed

  • scripts/jax_likelihood_functions/imaging/delaunay.py — eager-vs-JIT assert tightened rtol 1e-4 → 1e-8 (measured Δ ~7e-15 relative); vmap pin unchanged.
  • scripts/jax_likelihood_functions/imaging/delaunay_near_caustic.pynew: axis-ratio ~0.5 PowerLaw + γ≈0.11 shear (extended folded caustic), ConstantSplit (split-cross locator exercised), border relocator on (hull/outside-hull fallbacks hit). Asserts eager ≡ JIT ≡ every vmap lane at rtol 1e-8 (measured Δ 3.3e-10 / 2.5e-10 relative — fold-amplified fp, still 30× inside tolerance).
  • scripts/jax_likelihood_functions/imaging/delaunay_mge.py — intentionally untouched at rtol 1e-4 (mixed-precision config; fp32-scale deltas by design).

Test Plan

  • delaunay.py under the new library: vmap pin −22205.87818084 exact (3 lanes); eager vs JIT Δ ~7e-15 relative at the tightened 1e-8
  • delaunay_near_caustic.py: eager −12522.472691848 vs JIT −12522.472687704 (3.3e-10 relative); vmap lanes −21155.20143635 ≡ eager figure_of_merit (2.5e-10 relative)
  • Rerun both post-merge of PyAutoArray#368 on main (regression cadence)

Validation checklist (--auto run)

🤖 Generated with Claude Code

Permanent guards for the invariance contract of the qhull-only Delaunay
callback (PyAutoArray#368): the JAX likelihood must match the eager
NumPy reference - which still uses scipy find_simplex directly and is
the numerical ground truth - to fp precision.

- delaunay.py: eager-vs-JIT assert tightened from rtol 1e-4 to 1e-8
  (measured delta ~7e-15 relative; the new visibility-walk locator is
  exact, so only fp reduction ordering remains).
- delaunay_near_caustic.py (new): axis-ratio ~0.5 PowerLaw + strong
  external shear so the source-plane caustic folds the Delaunay mesh
  into compressed sliver triangles - the geometry that defeated the
  original 2-ring locator design - with ConstantSplit so the
  split-cross point location is exercised. Asserts eager == JIT ==
  every vmap lane at rtol 1e-8 (measured deltas 3.3e-10 / 2.5e-10).
- delaunay_mge.py deliberately stays at rtol 1e-4: it runs
  use_mixed_precision=True, so its eager-vs-JIT delta is fp32-scale by
  design, unrelated to point location.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 9, 2026
@Jammy2211 Jammy2211 merged commit 6daedd8 into main Jul 9, 2026
4 checks passed
@Jammy2211 Jammy2211 deleted the feature/delaunay-qhull-callback branch July 9, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant