Skip to content

Design Make Gibbs kernels composable [DO NOT MERGE] - #2243

Open
juanitorduz wants to merge 2 commits into
pyro-ppl:masterfrom
juanitorduz:make-gibbs-kernels-composable
Open

Design Make Gibbs kernels composable [DO NOT MERGE]#2243
juanitorduz wants to merge 2 commits into
pyro-ppl:masterfrom
juanitorduz:make-gibbs-kernels-composable

Conversation

@juanitorduz

Copy link
Copy Markdown
Collaborator

Related to #898

@fehiepsi this is the scaffolding design ready for feedback. Once we are happy with the design, I will proceed with the implementation.

@juanitorduz juanitorduz self-assigned this Aug 15, 2026
@juanitorduz
juanitorduz requested a review from fehiepsi August 15, 2026 11:46
@github-actions
github-actions Bot requested a review from Qazalbash August 15, 2026 11:46
@github-actions github-actions Bot added the awaiting review Awaiting review from maintainers label Aug 15, 2026
@github-actions

Copy link
Copy Markdown

Benchmark report

this PR make-gibbs-kernels-composable at 8b5a19a6 vs baseline master at 26cc211a

+ run time:     1 faster
  compile time: unchanged across 32 benchmarks

Significant changes (1)

                         ─────── run time ───────     ───── compile time ─────
  benchmark              baseline  this PR      Δ     baseline  this PR      Δ
──────────────────────────────────────────────────────────────────────────────
+ categorical_log_prob     1.7 ms   1.5 ms  -9.0%      54.7 ms  50.9 ms  -6.9%

Red is slower, green is faster; a row is coloured by the worse of its two columns. A delta in parentheses cleared the threshold on a measurement below the resolution floor, so it is shown without being called a change. † marks a benchmark that could not be compared — see below.

Full results

distributions

                                 ───────── run time ────────     ────── compile time ──────
  benchmark                      baseline  this PR         Δ     baseline   this PR       Δ
───────────────────────────────────────────────────────────────────────────────────────────
  biject_to_constraints            3.0 ms   3.0 ms     +0.9%     205.8 ms  197.6 ms   -4.0%
+ categorical_log_prob             1.7 ms   1.5 ms     -9.0%      54.7 ms   50.9 ms   -6.9%
  dirichlet_log_prob               431 µs   434 µs     +0.8%     393.3 ms  324.2 ms  -17.6%
  dirichlet_sample                41.3 ms  42.1 ms     +1.8%     578.2 ms  575.3 ms   -0.5%
  gamma_log_prob                   1.3 ms   1.3 ms     +0.2%       1.94 s    1.89 s   -2.7%
  gamma_sample                    19.1 ms  19.2 ms     +0.4%     531.7 ms  521.9 ms   -1.8%
  lkj_cholesky_sample              4.3 ms   4.2 ms     -2.5%     824.3 ms  848.2 ms   +2.9%
  mixture_same_family_log_prob     1.5 ms   1.5 ms     +0.4%      84.3 ms   81.7 ms   -3.1%
  multivariate_normal_log_prob     399 µs   406 µs     +1.6%     125.3 ms  108.7 ms  -13.3%
  normal_log_prob                  440 µs   460 µs     +4.6%      48.9 ms   48.3 ms   -1.2%
  normal_sample                   19.1 ms  19.3 ms     +1.3%     160.6 ms  161.7 ms   +0.7%
  stick_breaking_transform         4.5 ms   4.5 ms     +1.4%     168.6 ms  177.3 ms   +5.2%
  student_t_log_prob               2.5 ms   2.4 ms     -3.0%      69.4 ms   69.9 ms   +0.7%
  truncated_normal_log_prob        528 µs   460 µs  (-12.9%)      46.5 ms   43.0 ms   -7.3%

handlers

                                  ───────── run time ─────────     ────── compile time ──────
  benchmark                       baseline   this PR         Δ     baseline   this PR       Δ
─────────────────────────────────────────────────────────────────────────────────────────────
  initialize_model_hierarchical    29.1 ms   28.7 ms     -1.5%       3.17 s    3.22 s   +1.5%
  log_density_hierarchical          2.3 ms    2.3 ms     -2.2%       1.07 s    1.02 s   -4.5%
  nested_handler_stack              946 µs    944 µs     -0.2%       667 µs    637 µs   -4.5%
  potential_energy_and_grad          19 µs     19 µs     -0.3%      81.0 ms   77.0 ms   -5.0%
  predictive_forward_sampling     533.1 ms  523.1 ms     -1.9%     118.3 ms  147.3 ms  +24.6%
  trace_seeded_model                570 µs    511 µs  (-10.4%)     474.8 ms  475.0 ms   +0.0%

mcmc

                             ──────── run time ───────     ───── compile time ─────
  benchmark                  baseline   this PR      Δ     baseline  this PR      Δ
───────────────────────────────────────────────────────────────────────────────────
  hmc_logistic_regression    559.5 ms  543.7 ms  -2.8%       2.70 s   2.76 s  +2.1%
  nuts_dense_mass_funnel     892.0 ms  905.3 ms  +1.5%       2.15 s   2.23 s  +3.8%
  nuts_eight_schools         862.9 ms  860.5 ms  -0.3%       2.06 s   2.06 s  -0.1%
  nuts_hierarchical_glm        3.22 s    3.20 s  -0.5%       3.77 s   3.81 s  +0.9%
  nuts_logistic_regression   835.5 ms  825.3 ms  -1.2%       2.88 s   2.69 s  -6.5%
  nuts_vectorized_chains       1.92 s    1.92 s  +0.0%       2.30 s   2.16 s  -6.3%

svi

                                             ──────── run time ───────     ───── compile time ─────
  benchmark                                  baseline   this PR      Δ     baseline  this PR      Δ
───────────────────────────────────────────────────────────────────────────────────────────────────
  svi_autodelta_map_logistic                 239.2 ms  231.4 ms  -3.3%       2.71 s   2.70 s  -0.7%
  svi_autodiagonalnormal_hierarchical        788.6 ms  781.9 ms  -0.9%       4.48 s   4.26 s  -5.0%
  svi_automultivariatenormal_eight_schools   553.7 ms  545.2 ms  -1.5%       3.51 s   3.45 s  -1.8%
  svi_autonormal_logistic                    567.0 ms  569.5 ms  +0.4%       2.85 s   2.84 s  -0.3%
  svi_multi_particle_elbo                      1.12 s    1.09 s  -2.1%       2.97 s   2.98 s  +0.1%
  svi_trace_mean_field_elbo                  956.1 ms  944.6 ms  -1.2%       4.62 s   4.40 s  -4.7%
Methodology and environment

Each benchmark is set up untimed, then called once with the JAX caches cleared and several more times warm. Run is the fastest warm call; compile is the first call minus that, i.e. the tracing, lowering and XLA compilation the warm calls did not have to pay for.

Both refs were measured on the same runner over 2 interleaved round(s), taking the best observation per benchmark. A result is called neutral when it moves less than ±5% (run) or ±25% (compile), or when the measurement itself is under 1 ms (run) / 50 ms (compile) — a shared CI runner cannot resolve changes below that. Compile time gets the looser band because it is measured once per round rather than best-of-N, and swings by roughly 20% even between two runs of identical code. A delta shown in parentheses did clear its threshold, but on a measurement below the resolution floor, so it is reported without being called a change.

baseline this PR
ref master make-gibbs-kernels-composable
commit 26cc211a 8b5a19a6
numpyro 0.21.0 0.21.0
jax 0.11.0 0.11.0
backend cpu cpu
python 3.14.7 3.14.7

Runner: Linux-6.17.0-1022-azure-x86_64-with-glibc2.39, 4 CPUs.

Produced by this benchmark run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review Awaiting review from maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant