# Persistent Hamiltonian categorical sampler

- ID: 2484
- Canonical URL: https://synthcore.org/idea/2484/persistent-hamiltonian-categorical-sampler
- API JSON: https://synthcore.org/api/idea/2484.json
- API Markdown: https://synthcore.org/api/idea/2484.md
- Verification status: failed_benchmark
- Source: [arXiv:2608.17961](https://arxiv.org/abs/2608.17961)
- Category: sampling
- Solves: sample-efficiency, speedup, stability
- ML areas: diffusion-sampling, vae, sampling
- Math tags: hamiltonian, stochastic-processes, probability, dynamical-systems
- Ratings: usefulness 7/10; difficulty 6/10; novelty 7/10

## Idea description

Replace independent categorical proposals or reversible Metropolis updates for discrete latent variables with a lifted sampler carrying persistent continuous edge momenta. Neighbor transitions are biased by the momentum and use a symmetric energy factor, so momentum reversal gives the required balance relation for the target Gibbs distribution while ordinary dynamics remain non-reversible. This should reduce random-walk behavior when sampling multimodal categorical latents or token sequences.

## Mathematical statement

Use a discrete state graph G=(S,E), where x is the current discrete configuration, U(x) is the negative log target up to an additive constant, and x^e is the neighbor reached by oriented edge e. For every oriented edge define a signed momentum p_e with p_{\bar e}=-p_e, and let [z]_+=\max(z,0). The lifted jump rate is q_e(x,p)=[p_e]_+\exp(-\Delta_e U(x)/2), where \Delta_e U(x)=U(x^e)-U(x). Under momentum reversal R p=-p, the reverse edge has momentum -p_e and \Delta_{\bar e}U(x^e)=-\Delta_eU(x). Therefore q_e(x,p)\exp(-U(x))=q_{\bar e}(x^e,Rp)\exp(-U(x^e)), which is skew detailed balance for the joint invariant density proportional to \exp(-U(x))\exp(-\|p\|^2/2). A Gaussian momentum refresh p\leftarrow\rho p+\sqrt{1-\rho^2}\,\xi, with \xi\sim N(0,I), preserves the Gaussian momentum marginal and controls ergodicity.

## Key formulas

- $$\Delta_e U(x)=U(x^e)-U(x),\qquad q_e(x,p)=[p_e]_+\exp\left(-\frac{\Delta_e U(x)}{2}\right).$$
- $$q_e(x,p)e^{-U(x)}=q_{\bar e}(x^e,Rp)e^{-U(x^e)},\qquad Rp=-p.$$
- $$\mathcal{L}f(x,p)=\sum_{e\in E(x)}q_e(x,p)\bigl[f(x^e,p)-f(x,p)\bigr]+\gamma\bigl(\mathbb{E}_{p'\mid p}f(x,p')-f(x,p)\bigr).$$
- $$p\leftarrow \rho p+\sqrt{1-\rho^2}\,\xi,\qquad \xi\sim\mathcal{N}(0,I),\quad 0\leq\rho<1.$$

## Implementation notes

Integrate the sampler into a categorical latent-variable model or a discrete diffusion reverse sampler. Let x be a batch of categorical configurations, and let U(x) be the model-defined negative log target; for a VAE this can be -log p_theta(x,z) at fixed observed data, while for a diffusion model it can be the negative conditional log probability at one reverse-time noise level. Construct a small neighbor set E(x), initially all single-coordinate substitutions. Maintain one momentum p_e per candidate substitution, or more cheaply one signed scalar p_i for each coordinate and draw a random candidate replacement from the positive-momentum directions. At each event, compute the neighbor energies U(x^e), form delta=U(x^e)-U(x), and set rate q=[p_e]_+*exp(-delta/2). Sample the next event time as Exponential(sum_e q_e), select edge e with probability q_e/sum_e q_e, apply x<-x^e, and retain momentum. Every K events perform p<-rho*p+sqrt(1-rho^2)*Normal(0,1); optionally flip momentum when a configured boundary or truncation rule is hit. The displayed generator gives the exact continuous-time process; use Gillespie simulation for the first correctness test. The mathematical quantity is the rate q and its skew-balance identity; estimate U only with the target network, and do not estimate gradients. First test a 16- or 32-dimensional categorical VAE with 16 categories per coordinate on synthetic mixtures and MNIST discrete latents. Compare against random-walk Metropolis, Gibbs, and categorical local Metropolis using the same number of U evaluations. Measure autocorrelation time, effective samples per evaluation, mode coverage, and target-distribution bias. Success means at least 2x larger effective sample size at equal target evaluations with no measurable increase in stationary-distribution error.

## Verification

- Status: failed_benchmark
- Mechanism evidence: yes
- Mechanism confirmed: no
- Practical verdict: inconclusive
- Verdict: Built a Gillespie persistent-momentum sampler for a uniform categorical ring and numerically checked the skew detailed-balance identity. The predicted sign correlation 2 asin(rho)/pi and run length 1/(1-correlation) matched all five rho values with absolute correlation errors below 0.004. Persistence improved the ring position autocorrelation metric from 187.7 at rho=0 to 151.0 at rho=0.75, but this is only about a 20% improvement, so the mechanism manifested without demonstrating the claimed 2x sampling gain.

### Mechanism check

- Verdict: Built a Gillespie persistent-momentum sampler for a uniform categorical ring and numerically checked the skew detailed-balance identity. The predicted sign correlation 2 asin(rho)/pi and run length 1/(1-correlation) matched all five rho values with absolute correlation errors below 0.004. Persistence improved the ring position autocorrelation metric from 187.7 at rho=0 to 151.0 at rho=0.75, but this is only about a 20% improvement, so the mechanism manifested without demonstrating the claimed 2x sampling gain.
- Confidence: 9/10
- Limitations: Only a uniform one-dimensional ring was tested; no multimodal nonuniform categorical target, Metropolis/Gibbs baseline, batch latent model, FLOP-matched comparison, or high-dimensional token-sequence experiment was evaluated. The continuous-time waiting-time estimate is noisy because Gaussian momentum produces heavy-tailed inverse-rate waits.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.3411
- Paired wins: 4/8
- Benchmark verdict: no significant win

## Artifacts

- [bench_report.json](https://synthcore.org/code/959/bench_report.json)
- [categorical_track.py](https://synthcore.org/code/959/categorical_track.py)
- [report.md](https://synthcore.org/code/959/report.md)
- [report_bench_2026-09-01T165112.md](https://synthcore.org/code/959/report_bench_2026-09-01T165112.md)
- [results.json](https://synthcore.org/code/959/results.json)
- [sampler_experiment.py](https://synthcore.org/code/959/sampler_experiment.py)
- [stage2_bench.py](https://synthcore.org/code/959/stage2_bench.py)
- [Download all files as ZIP](https://synthcore.org/download/959)

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
