Skip to content

add Dynesty_jax.py — JAX-jitted likelihood example for DynestyStatic#19

Merged
Jammy2211 merged 1 commit intomainfrom
feature/dynesty-jax
Apr 30, 2026
Merged

add Dynesty_jax.py — JAX-jitted likelihood example for DynestyStatic#19
Jammy2211 merged 1 commit intomainfrom
feature/dynesty-jax

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

  • New scripts/searches/Dynesty_jax.py — companion to Nautilus_jax.py, exercises the JAX-jit path on af.DynestyStatic.
  • Verifies the new use_jax_jit plumbing in PyAutoFit#1243 (just merged) executes end-to-end on the 1D Gaussian dataset.

Why

Companion test for PyAutoFit#1243, which added jax.jit likelihood support to dynesty. Without a runnable example in autofit_workspace_test, there's no integration check on the new JAX-jit path beyond the library unit tests (which deliberately don't import jax).

dynesty differs from Nautilus on this path: dynesty 2.1.5's NestedSampler has no vectorized parameter, so vmap-batching doesn't apply. The script uses jax.jit only — JAX's compiled-function cache reuses the compiled likelihood across dynesty's one-sample-at-a-time call pattern.

Verification (local)

  • JAX: Applying jit to likelihood function log line emitted (the analogue of Nautilus's JAX: Applying vmap and jit... line)
  • Running Dynesty with JAX-jitted likelihood (single CPU, no pool). from PyAutoFit#1243's new log branch
  • Search converges: log_Z ≈ -54.0, dlogz ≈ 0.014 (tolerance 0.5)
  • Runtime ~3.5s with nlive=30, dlogz=0.5

Related

Test plan

  • python3 scripts/searches/Dynesty_jax.py runs end-to-end without error
  • Stdout contains JAX: Applying jit to likelihood function
  • Stdout contains Running Dynesty with JAX-jitted likelihood
  • Nautilus_jax.py still passes (vmap regression check, log_Z ≈ -54.13)
  • CI smoke tests pass

🤖 Generated with Claude Code

Companion to Nautilus_jax.py. Exercises the new jit-only JAX path on
DynestyStatic introduced in PyAutoFit#1243. Same 1D Gaussian dataset,
NullPaths search, ~3.5s runtime. Verifies the path executes
end-to-end and emits the expected `JAX: Applying jit to likelihood
function` log line — not the same as Nautilus's vmap+jit path because
dynesty 2.1.5 has no `vectorized` parameter and calls the likelihood
one sample at a time.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit 8465a9a into main Apr 30, 2026
4 checks passed
@Jammy2211 Jammy2211 deleted the feature/dynesty-jax branch April 30, 2026 19:01
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.

1 participant