Tau-leaped parallel discrete Hamiltonian sampler
Implementation & benchmark of arXiv:2608.17961 — Hamiltonian dynamics for sampling on discrete spaces
Source paper: Hamiltonian dynamics for sampling on discrete spaces arXiv:2608.17961 ⓘ · analyzed Sep 1, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Approximate the exact event-by-event lifted sampler by drawing independent Poisson jump counts over a short interval and applying compatible discrete moves in parallel. This converts sequential neighbor events into batched GPU-friendly updates while retaining the Hamiltonian rate structure; the step size controls the error-versus-throughput tradeoff.
Formulas
Mathematical statement
For current state x and momentum p, let q_e(x,p) be the lifted Hamiltonian neighbor rate and let h>0 be a leap interval. The tau-leap approximation replaces the exact continuous-time counting process by independent Poisson counts N_e\sim\operatorname{Poisson}(h q_e(x,p)). For a set of non-conflicting edges, apply each selected jump once when N_e>0; for conflicting edges use a random maximal independent subset or resolve collisions by selecting one edge per coordinate. The expected number of jumps is E[N_e]=h q_e and the probability of at least one jump is 1-e^{-h q_e}. Since q_e depends on the old state, this is first-order accurate in h; exact Gillespie simulation is the reference process. A bounded-update version uses Bernoulli indicators B_e\sim\operatorname{Bernoulli}(1-e^{-h q_e}) and resolves multiple substitutions of the same coordinate using their rates.
Implementation notes
Use this as an inference-time sampler for categorical diffusion, discrete energy-based models, or VAE latent refinement where exact Gillespie simulation is too serial. At each sampler step, evaluate U on all one-coordinate neighbors in a tensorized batch. For a configuration with d coordinates and k possible replacements, create a [batch,d,k] neighbor tensor, obtain delta_e=U(x^e)-U(x), and compute q_e=relu(p_e)*exp(-0.5*delta_e), using the persistent-momentum rate from the formula. Choose h so that the mean total event count h*sum_e q_e is between 0.1 and 1.0. Generate Bernoulli indicators B_e with probability 1-exp(-h*q_e). Resolve collisions independently per coordinate: among active replacements for coordinate i, choose one using normalized q_e, and leave the coordinate unchanged if none is active. Update momenta with p<-rho*p+sqrt(1-rho^2)*xi after each leap, or after every K leaps. The paper’s mathematical approximation is the Poisson/Bernoulli count; estimate discretization bias empirically by comparing to exact Gillespie trajectories at matched physical time. First benchmark a 20-dimensional, 32-category synthetic energy model and a small discrete diffusion model on binarized MNIST. Compare wall-clock effective samples and reverse-sampling quality against sequential Gibbs and exact Gillespie. Sweep h and report target-KL, mode coverage, GPU utilization, and samples per second. Success is at least 4x wall-clock throughput at a tau-leap setting whose KL or generated-sample metrics remain within 1% of exact sampling.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Inconclusive
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Built a reproducible tau-leaped categorical Hamiltonian sampler with Gillespie reference dynamics, Bernoulli collision resolution, Poisson identity checks, bias sweeps, and timing comparison. The controlled binary-chain experiment showed abs(endpoint bias)/h approximately 0.0647–0.0715 across h=0.002–0.2, confirming first-order error, and collision probability divided by h^2 approached the predicted q1*q2=0.77 (0.769 at h=0.002). The mechanism manifested, but the scalar implementation provided only 1.41x speedup rather than the claimed 4x; GPU batching was not implemented.
- Agent confidence
- 8/10
- Baseline
- Exact Gillespie: 75.96 paths/s, 1.316 s for 100 paths, 4.45 events/path
- Idea
- Tau-leap h=0.05: 106.93 paths/s, 0.935 s for 100 paths, 1.41x speedup, 3.94 events/path; controlled bias/h 0.0647–0.0715; collision p/h^2 0.7686 at h=0.002 vs predicted 0.77
Limitations: The main sampler is scalar NumPy rather than tensorized CUDA, so GPU utilization and the intended batched GPU throughput were not tested. The high-dimensional endpoint comparison used small replicate counts and showed noisy coordinate TV rather than a robust KL estimate; no MNIST, diffusion model, VAE, or 4x wall-clock benchmark was evaluated.
How to run: python3 controlled_check.py && /home/maxwelhelp/main/bin/python3 tau_leap_experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2608.17961)
No significant difference vs. the tuned baseline (+4.9%, p=0.3679, wins 3 / 8 paired seeds).
- Benchmark
- Categorical_energy
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 0.2025
- Idea mean
- 0.2125
- Effect (Δ)
- 0.01 (+4.9%; negative = idea better)
- Wins
- 3 / 8 paired seeds
- p-value
- 0.3679 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- n/a
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
A custom track was necessary because no built-in track contains categorical discrete-energy structure. This tested training-time stochastic refinement rather than inference-time diffusion/VAE sampling; exact Gillespie quality, GPU throughput, and the proposed 4x speedup were not tested.
How to run: python3 stage2_bench.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 9/10
The tau-leaped categorical refinement was implemented as an end-to-end modification of a shared MLP on a custom categorical-energy classification track. Its mechanism prediction was confirmed, but it worsened test error and was not statistically significant, so the idea did not win.
- Baseline
- lr=0.01; mean test error 0.20250; std 0.03614
- Idea
- h=0.02, lr=0.01; mean test error 0.21250; std 0.04822; paired delta +0.01000; permutation p=0.3679
Benchmark result
No significant difference vs. the tuned baseline (+4.9%, p=0.3679, wins 3 / 8 paired seeds).
- Benchmark
- Categorical_energy
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 0.2025
- Idea mean
- 0.2125
- Effect (Δ)
- 0.01 (+4.9%; negative = idea better)
- Wins
- 3 / 8 paired seeds
- p-value
- 0.3679 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- n/a
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
A custom track was necessary because no built-in track contains categorical discrete-energy structure. This tested training-time stochastic refinement rather than inference-time diffusion/VAE sampling; exact Gillespie quality, GPU throughput, and the proposed 4x speedup were not tested.
How to run: python3 stage2_bench.py
Artifacts
- bench_report.json 4.7 KB View Raw
- categorical_track.py 1.0 KB View Raw
- controlled_check.py 1.7 KB View Raw
- controlled_results.json 2.5 KB View Raw
- report.md 1.6 KB View
- report_bench_2026-09-01T171323.md 3.5 KB View
- results.json 2.1 KB View Raw
- stage2_bench.py 5.4 KB View Raw
- tau_leap_experiment.py 3.8 KB View Raw