jaxrens.sampling.adaptation.stepsize_handler

Step size adjustment via trial moves — pure JAX functions.

Two production entry points, one per batcher regime:

  • adjust_step_size() — full in-XLA bisection (lax.while_loop) for SingleRun / VmapRuns / PmapVmapRuns. Vmaps cleanly over runs; per-replica convergence handled by the vmap-of-while_loop “any-active” semantics.

  • adjust_step_size_sharded() — sibling for ShardedSingleRun. Same in-XLA lax.while_loop structure, with cross-shard lax.psum reductions inside the body so each shard sees the global trial rate. Must be called inside a jax.shard_map over the "shard" mesh axis.

Both share _process_rate_jax() (branchless rate-window decision). The outer loop (when to trigger, how to write back into the population) lives in jaxrens.sampling.adaptation.manager.build_adapt_step() and its caller _run_loop.

Functions

adjust_step_size

Adjust step size for one move type until acceptance rate is in window.

adjust_step_size_sharded

Adjust step size with the population sharded across n_gpu GPUs.

Classes

FLOOR_THRESHOLD

Convert a string or number to a floating point number, if possible.