Skip to content

Restore zero-contour gradients under JAX 0.12 - #750

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/zero-contour-jax-grad
Nov 24, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/zero-contour-jax-grad

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Restore differentiation through critical curves on JAX 0.12. The contour has a two-coordinate root and a scalar residual. JAX 0.12 traces the tangent right-hand side with the shape of the root, then receives a scalar at runtime. Batching the root solve makes that mismatch visible during transposition.

The compatibility shim embeds the equation as (f(point), 0). Newton still uses the first component for each step. The implicit solve uses its normal and the original minimum-norm derivative. This representation is the implementation decision for human review. Minimal upstream reproducer

API Changes

Existing critical-curve and caustic calculations support reverse-mode differentiation on JAX 0.12.0.1. Call signatures and return shapes are preserved.

Test Plan

  • Both workspace regressions raised AssertionError before the fix on 0.12.0.1. The circle witness now passes on JAX 0.10.2, 0.11.2 and 0.12.0.1.
  • On 0.12.0.1 the area derivatives agree with the exact values to relative errors of 2.70e-5 (tangential) and 8.40e-5 (radial). The script also compares against finite differences and checks eager/JIT agreement.
  • Two-seed forward and reverse Jacobians of the recovered radius both returned 1 in each solver differentiation mode.
Full API Changes (for automation & release notes)

Changed Behaviour

Critical-curve derivatives on JAX 0.12.0.1 reach the existing implicit tangent solve.

Tracks #749.

Validation checklist

  • Supervised shift run. The plan is recorded in PyAutoGalaxy issue 749. Merge requires human review.
  • 47 library tests passed. Both workspace witnesses passed on JAX 0.12.0.1.
  • Targeted Heart smoke selected misc/jax_assertions/critical_curves_zero_contour_jit_grad.py.
  • The scoped Heart dev-ship gate is GREEN. The shift acknowledged one workspace manifest mismatch and the pending release rehearsal.
  • Human review of the equation representation and the linked workspace changes.
  • Independent Opus review CLEAN. The reviewer reproduced the failure on main, verified the fix in both AD modes, found bit-identical forward circle paths, and independently ran both restored scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

decision-taken Autonomous run took a flagged decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant