test: Delaunay JAX likelihood-invariance parity guards (near-caustic + rtol 1e-8)#155
Merged
Merged
Conversation
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>
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
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_simplexdirectly 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.py— new: 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.pyunder the new library: vmap pin −22205.87818084 exact (3 lanes); eager vs JIT Δ ~7e-15 relative at the tightened 1e-8delaunay_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)Validation checklist (--auto run)
🤖 Generated with Claude Code