# Thermalizing Stochastic Programs

arXiv: https://arxiv.org/abs/2608.01615 · HTML: https://mlsanity.com/paper/2608.01615/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 5 of its 86 references that are in the map.
- First posted on arXiv 3 Aug 2026.

## Builds on (most cited first, 5 of 5)

- [Scaling Laws for Neural Language Models](https://mlsanity.com/paper/2001.08361/) (2020)
- [A Data-driven Market Simulator for Small Data Environments](https://mlsanity.com/paper/2006.14498/) (2020)
- [Thermodynamic Computing](https://mlsanity.com/paper/1911.01968/) (2019)
- [PASS: An Asynchronous Probabilistic Processor for Next Generation Intelligence](https://mlsanity.com/paper/2409.10325/) (2024)
- [A Blueprint for Equilibrium-Based Differentiable Continuous-Variable Thermodynamic Computing](https://mlsanity.com/paper/2607.16183/) (2026)

## Abstract (arXiv)

We present a set of tools for mapping general stochastic programs to thermodynamic hardware designed for energy-efficient stochastic sampling. Given a target stochastic program expressed as a Directed Factor Graph (DFG) of stochastic channels, or equivalently as a Parametrized Stochastic Circuit (PSC), we first introduce a method to approximately compile each factor in the DFG to an Energy-Based Model (EBM) that is native to the hardware. We then analyze how the error of the compiled DFG accumulates from the per-factor errors, and introduce two training refinements, context matching and trajectory-level REINFORCE post-training, which can reduce the residual error left by training each factor in isolation. The textttthermalizers framework takes a stochastic program expressed in the texttttorx library and replaces its factors with thermodynamic kernels implemented and sampled using the textttthrml library. We demonstrate it on several example applications, including a market simulator that learns the joint day-to-day dynamics of a panel of financial time series from recorded market history alone, a probabilistic model from mathematical ecology, Gibbs sampling of an EBM the hardware cannot natively express, and a sequential Bayesian design loop over a Gaussian stochastic circuit.
