Skip to content

bug: jit/imaging/delaunay.py — log_evidence rebuild returns -inf vs FitImaging's finite 26288.32 #69

@Jammy2211

Description

@Jammy2211

Summary

On clean main (autolens_workspace_developer@4e99bf9, PyAutoLens 2026.5.14.2), jax_profiling/jit/imaging/delaunay.py crashes its self-consistency check at the log_evidence step: both the step-by-step rebuild and the inv-matrices rebuild return -inf, while the eager FitImaging.log_evidence reference returns a finite, expected 26288.32. The bug is in the rebuild, not in FitImaging.

Surfaced by the autolens_profiling Phase 1 follow-up smoke (issue #67); split out of that triage because it's an independent numerical / underflow bug not related to the point_source regression drift.

Reproduction

cd autolens_workspace_developer
source ../activate.sh
python jax_profiling/jit/imaging/delaunay.py

Output (relevant tail)

--- Step 13: Mapped reconstruction + log evidence ---
  [log_evidence_eager] 0.5566 s
  [log_evidence_jit_lower] 0.0364 s
  [log_evidence_jit_compile] 0.2256 s
  [log_evidence_jit_first_call] 0.1473 s
  [log_evidence_jit_steady_x10] 1.2660 s
    -> per-call avg: 0.126602 s
  log_evidence (step-by-step) = -inf
  log_evidence (inv matrices) = -inf
  log_evidence (reference)    = 26288.321397232066
Traceback (most recent call last):
  File ".../jax_profiling/jit/imaging/delaunay.py", line 833, in <module>
    np.testing.assert_allclose(
AssertionError:
Not equal to tolerance rtol=0.0001, atol=0
Log_evidence from inversion matrices does not match FitImaging.log_evidence
-inf location mismatch:
 ACTUAL: array(-inf)
 DESIRED: array(26288.321397)

Diagnosis hint

  • FitImaging.log_evidence (the high-level path) produces a sensible finite number.
  • Both the step-by-step rebuild and the inv-matrices rebuild produce -inf.
  • That means the bug is in one of the building-block computations the script calls directly (regularization-determinant term, NNLS-residual term, or curvature-determinant term), not in FitImaging itself.
  • The earlier steps (data vector, curvature matrix, regularization matrix, reconstruction, mapped reconstruction) all produce finite results with sensible shapes — only the final log_evidence aggregation goes to -inf.

Most likely culprits:

  • log / slogdet of a near-singular matrix returning -inf from the JAX path under xp=jnp.
  • Negative argument to xp.log somewhere in the Bayesian-evidence aggregation.
  • The same expression on the eager xp=np path is benefiting from numpy's slight numerical-noise tolerance.

Context

  • All other JIT scripts on clean main behave consistently:

interferometer/delaunay.py passes on the same Delaunay pixelization with the same regularization (ConstantSplit), so the imaging-specific Delaunay log_evidence rebuild is the narrow culprit.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions