jaxrens.sampling.adaptation.manager

Build the per-iteration step-size adapt step.

Public surface: build_adapt_step(). Returns either:

  • None — adaptation is inactive (no moves, no per-move kernels, or adjust_interval <= 0). Caller should skip adaptation entirely.

  • A callable adapt_step(ns_state, emax, rng_key) -> (new_ns_state, diag, new_rng_key) that runs one full per-move bisection pass and writes the updated step sizes back into ns_state.population.

The closure carries no run state. It is constructed once per NS run / burn-in before the outer loop; the caller owns the firing schedule (i > 0 and i % adjust_interval == 0) and the loop-level RNG carry.

All batcher-specific dispatch is concentrated in this builder. Each per-move callable is a single JIT’d in-XLA bisection (lax.while_loop) — same structure for SingleRun / VmapRuns / PmapVmapRuns, with the sharded variant adding lax.psum reductions for cross-shard rate aggregation.

Historical note: this module is named manager.py for legacy import reasons. The previous AdaptationManager class held no state and has been collapsed to this builder; rename of the file is a trivial follow-up.

Functions

build_adapt_step

Build the per-iteration adapt step.