Skip to content

Make remaining message and prior xp paths JAX-traceable - #1461

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/message-prior-xp-jax-trace
Aug 9, 2026
Merged

Make remaining message and prior xp paths JAX-traceable#1461
Jammy2211 merged 1 commit into
mainfrom
feature/message-prior-xp-jax-trace

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Make the remaining message and compound-prior array-namespace paths genuinely JAX-traceable.

  • select the JAX backend while constructing traced Beta/Gamma messages
  • dispatch Beta/Gamma log-partition special functions through SciPy or jax.scipy
  • propagate xp recursively through arithmetic and modified priors
  • use xp.log / xp.log10 for compound-prior modifiers
  • add scalar, batched, nested-prior, and NumPy-parity JIT regressions

API Changes

Prior.instance_for_arguments gains an optional xp=np keyword, aligning direct priors with AbstractPriorModel.instance_for_arguments. Beta/Gamma message construction and compound-prior evaluation now honor JAX inputs instead of coercing them through NumPy. Existing NumPy calls and defaults are unchanged.

See full details below.

Test Plan

  • Direct tests against untouched post-Use xp.stack in messages so JAX can trace fixed arrays #1460 main: 12 expected JAX failures, 20 passes
  • Direct branch tests on JAX 0.10.2: 32 passed
  • Direct branch tests on supported-minimum JAX 0.7.0: 32 passed
  • Focused message/prior suites: 317 passed
  • Full PyAutoFit suite: 1701 passed, 4 skipped
Full API Changes (for automation & release notes)

Changed Signature

  • Prior.instance_for_arguments(arguments, ignore_assertions=False, xp=np) — adds an optional backend argument used by recursive compound-prior evaluation.

Changed Behaviour

  • BetaMessage and GammaMessage constructors select JAX broadcasting for traced parameters.
  • BetaMessage.log_partition(xp=jnp) uses jax.scipy.special.betaln.
  • GammaMessage.log_partition(xp=jnp) uses jax.scipy.special.gammaln and xp.log.
  • Arithmetic and modified priors propagate xp to nested children.
  • Log and Log10 dispatch through xp.log and xp.log10.

Migration

  • None. Existing callers remain valid; xp is optional and defaults to NumPy.

Closes #1459

Generated by the PyAutoLabs agent workflow.

@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 9, 2026 — with ChatGPT Codex Connector
@Jammy2211
Jammy2211 marked this pull request as ready for review August 9, 2026 16:46
@Jammy2211
Jammy2211 merged commit fbe9f45 into main Aug 9, 2026
3 checks passed
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.

fix: make remaining message and compound-prior xp paths JAX-traceable

1 participant