Thermalizing Stochastic Programs

arXiv:2608.01615 · cs.ET, cs.LG · Submitted 2026-08-13 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: Next we'll be talking about the paper "Thermalizing Stochastic Programs".

Jane: The paper was written by Mirko Amico, Andraž Jelinčič, Colin Oscar Nancarrow, Leo Tyrpak, David Roberts et al. from Extropic Corporation and CUNY Graduate Center.

Tom: Stay tuned as we take you through the paper and discuss its implications.

Title: Tom: Welcome back to the show, everyone. Today we're diving into a paper that's got a title that sounds like it belongs in a physics lab, but honestly, it's about something way cooler. It's called "Thermalizing Stochastic Programs." Jane, what's your first take on that title?

Jane: Tom, I love it. It sounds intimidating, but when you break it down, it's actually about teaching computers to use the natural randomness of the physical world to do calculations. Instead of a traditional chip that does math step-by-step, this paper is about using the jiggling of atoms, basically, to run programs.

Tom: Right! And that's the "thermalizing" part. You're literally using heat and thermal noise to make the computer work. The authors are from Extropic Corporation, which is a company that's all about this kind of thermodynamic computing. They're trying to build hardware that's incredibly energy-efficient by using physics itself as the calculator.

Jane: And "stochastic programs" just means programs that have randomness built in. Think of it like a weather forecast that doesn't just say "sunny," but says "there's a seventy percent chance of sun." These are the kinds of programs that are super useful for things like modeling financial markets or simulating complex ecosystems.

Tom: Exactly. And the big problem they're solving is that we have these amazing, energy-hungry AI models, but they're consuming massive amounts of power. This paper is proposing a way to run those kinds of models on hardware that could be a thousand times more efficient.

Jane: A thousand times. That's not a small number. That's the kind of leap that could make AI accessible everywhere, not just in giant data centers.

Tom: So, the core idea here is that they're taking a regular program, which is like a recipe with a bunch of steps, and they're translating it into a language that this new type of hardware can understand. The hardware's native language is energy and equilibrium.

Jane: Right, and the paper gives us a whole toolkit for doing that translation. It's not just a one-off trick; it's a framework. They call it "variational compilation," which is a fancy way of saying they're training the hardware to mimic each step of the original program.

Tom: And that's what we're going to dig into. How do you take a step-by-step recipe and turn it into a physical system that just relaxes into the right answer? Stick around, because this is where it gets really clever.

Paper discussion segment 2: Jane: So, Tom, we've set the stage. The paper is "Thermalizing Stochastic Programs," and it's all about this compilation process. But what does that actually look like in practice? How do they make the leap from a software program to a physical chip?

Tom: Great question. The secret sauce is what they call a "thermodynamic kernel." Imagine you have a grid of tiny magnetic switches, which they call p-bits. Each one can be on or off, like a bit in a normal computer. But instead of setting them with a clock, you let them randomly flip based on the temperature and the connections between them.

Jane: So it's like a bunch of dice that are all connected to each other. The connections determine the odds of each die landing on a certain side.

Tom: That's a perfect analogy. Now, if you hold some of those dice in a fixed position—that's your input—and let the others tumble around, they'll eventually settle into a pattern that represents the output. That whole process, from input to output, is the thermodynamic kernel. It's a single, physical operation that does a calculation.

Jane: And the paper's big move is to show that you can take any step in a complex program and replace it with one of these kernels. You just have to train the connections between the p-bits so that the kernel gives the right output distribution for a given input.

Tom: Right. And they call that training process "variational compilation." It's like teaching the hardware to speak the language of your program. They even have a way to measure how much error you're introducing with each kernel, and they show that the errors can add up as you chain these kernels together.

Jane: Which is the classic problem with any kind of approximation. If you're off by a little at each step, by the end of a long program, you could be way off. But the paper has a solution for that too.

Tom: They do. They introduce a few different techniques. One is called "context matching," where you retrain a kernel based on the kinds of inputs it's actually going to see when it's running inside the bigger program. It's like practicing for a test with the actual questions you'll get, not just generic ones.

Jane: And then there's a second stage of training they call "trajectory-level REINFORCE." This is where they look at the entire output of the program, not just the individual steps, and they adjust all the kernels together to make the final result more accurate.

Tom: Exactly. It's a two-stage process. First, you get each kernel roughly right on its own. Then, you fine-tune the whole orchestra together to make the symphony sound perfect. And they show this works on a bunch of different examples, from a simple random walk to a model of a whole financial market.

Paper discussion segment 3: Jane: We've talked about the mechanics, Tom, but the demonstrations in "Thermalizing Stochastic Programs" are really where you see the power of this. They didn't just test it on toy problems. They went for some pretty wild stuff.

Tom: They really did. My favorite is the market simulator. They took fourteen years of real financial data—stocks, bonds, commodities, all of it—and they trained a thermodynamic program to generate its own fake market history. The goal wasn't to predict the next day's price, which is basically impossible, but to reproduce the *statistical fingerprints* of the real market.

Jane: Like the fact that calm days tend to cluster together, and turbulent days cluster together. And the fact that when the market crashes, everything crashes together. Those are the "stylized facts" of finance, and their simulator was able to reproduce them.

Tom: And they even showed that their model was better at this than a standard single energy-based model. They used a clever setup where they had two kernels working together, one to make a rough draft of the day's market move and another to refine it. That two-step process was key.

Jane: But it wasn't just about finance. They also showed they could use this to sample from a physical system that the hardware couldn't natively represent. They had a model with three-body interactions, which is like a party where three people have to agree at the same time, and their hardware only supports two-body interactions, which is like a dance between two people.

Tom: Right, and they did it by compiling the *process* of sampling that system, not the system itself. They built a program that performs the Gibbs sampling algorithm, which is a way to explore a distribution step-by-step, and they compiled that program to the hardware. It's a meta-trick, a program that runs another program.

Jane: And the results were impressive. They were able to get very close to the exact answer, even with the hardware's limitations. The error stayed small and didn't blow up over time, which is a huge deal for a long-running simulation.

Tom: And let's not forget the Gaussian stochastic circuit. They used this to do something called "Bayesian experimental design." Imagine you're trying to map out an unknown field, like the temperature in a room, but you can only take measurements one point at a time. Their program figured out the best place to measure next, based on what it already knew, and it did it almost as well as a perfect, super-expensive calculation.

Jane: So it's not just about generating data, it's about making smart decisions. This framework is a general-purpose tool for running any kind of probabilistic program on this incredibly efficient hardware.

Conclusion: Tom: Well, Jane, we've covered a lot of ground on "Thermalizing Stochastic Programs." We started with the basic idea of using thermal noise to compute, and we ended with a program that can design its own experiments. It's a pretty remarkable journey.

Jane: It is. And I think the biggest takeaway is that this isn't just a theoretical paper. They built a software library called `thermalizers` that does all this compilation automatically. You write your program in one language, and it spits out the code to run on the thermodynamic hardware.

Tom: Which means the path from research to real-world application is much shorter. This could be the foundation for a whole new generation of energy-efficient AI.

Jane: Absolutely. And while the hardware itself isn't in every laptop yet, this paper gives us the software blueprint for how to use it when it is. It's a major step toward making powerful AI not just smarter, but also sustainable.

Tom: So, from all of us here, that was "Thermalizing Stochastic Programs." A big thank you to the authors for sharing this work. We're going to take a quick break, and then we'll be back to discuss the next paper on our list.

Jane: See you in a bit, everyone.

Mirko Amico, Andraž Jelinčič, Colin Oscar Nancarrow, Leo Tyrpak, David Roberts, Seth Morton, Dalton Sakthivadivel, Ashwin Gopal, Guillaume Verdon

Extropic Corporation · CUNY Graduate Center

cs.ET, cs.LG

Submitted: 2026-08-13

Code: https://github.com/extropic-ai/thrml

License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/

Importance score: 72/100

The gist: The paper "Thermalizing Stochastic Programs" by Mirko Amico, Andraž Jelinčič, Colin Oscar Nancarrow, Leo Tyrpak, David Roberts, Seth Morton, Dalton Sakthivadivel, Ashwin Gopal, and Guillaume

Terminology

Summary

The paper Thermalizing Stochastic Programs by Mirko Amico, Andraž Jelinčič, Colin Oscar Nancarrow, Leo Tyrpak, David Roberts, Seth Morton, Dalton Sakthivadivel, Ashwin Gopal, and Guillaume Verdon (Extropic Corporation, San Francisco, California, USA, dated August 14, 2026, arXiv:2608.01615v2 [cs.ET]) presents a set of tools for mapping general stochastic programs to thermodynamic hardware designed for energy-efficient stochastic sampling.

The paper is motivated by the growing energy requirements of generative artificial intelligence, noting that the continued development of artificial intelligence systems with growing capabilities has come with increased energy requirements over the past several years, and that the bulk of AI training and inference is carried out in a relatively small number of data centers, the largest of which draw power comparable to that of a large city. The authors argue that Realizing artificial intelligence as a general-purpose technology, deployed pervasively rather than consumed as a centrally metered service, requires reducing the energy cost of AI algorithms by orders of magnitude. They note that Simulations of denoising-based generative algorithms running on such devices suggest that non-trivial inference tasks can be executed with as little as 10−4 or even 10−6 of the energy required by GPUs.

The authors state that A general method for executing stochastic programs on this class of hardware has been missing until now, as Existing programming models for such devices usually restrict attention to problems the hardware expresses natively.

The paper introduces a framework operating on three levels: "At the highest level of abstraction, the stochastic program is a directed factor graph of Markov kernels, or equivalently a parametrized stochastic circuit, passing wire variables zl from the program's inputs to its output. Each factor of the DFG is compiled to a thermodynamic kernel, defined as a conditional distribution obtained from an EBM by clamping the input spins x, marginalizing hidden spins w and normalizing over the output spins y. The compiled kernel is then laid out spatially on a region of the thermodynamic hardware, a Thermodynamic Sampling Unit (TSU), whose physical dynamics samples it natively."

The key insight is that "When a subset of the variables of a thermodynamic computer is held fixed, the device samples from the conditional distribution of the remaining variables, so that a single choice of energy function realizes a probabilistic transition kernel from the clamped variables to the free variables. We call this object a thermodynamic kernel. The thermodynamic kernel is the basic instruction from which our programs are assembled."

The paper defines Thermodynamic Hypergraphical Models (THMs) as an energy-based model defined on a finite hypergraph G = (V, E) with energy Eφ(s) = −Σe∈E Je Πvi∈e si, where s ∈ −1, 1 n. The authors note that A THM of order 2 is also called a Boltzmann machine. Sampling is performed using Gibbs sampling, wherein we define a Markov chain that resamples spins according to the conditional probability pφ(si = 1 s) = σ(2 Σe∋i Je Πj∈ei sj).

The hardware platform, referred to as Z1, would support pairwise Ising energies E(s) = −½s⊤Js − h⊤s on a fixed planar topology. The Z1 topology is described as a sparse, locally connected, 2-colorable graph, where each node supports two different couplings per edge. The chip has approximately 250,000 nodes, each Gibbs iteration is estimated to cost approximately 3 × 10−10 J, and the chip will perform between 106 and 107 Gibbs iterations per second. The hardware supports readout, coupling flashing, and clamping operations.

A DFG is defined as "a directed acyclic graph where each node holds a stochastic kernel and each directed edge carries some random variable sampled as an output of one stochastic kernel to then be used as input to a subsequent stochastic kernel." The full DFG defines a joint distribution over all wires by ancestral sampling: PϕDFG(z1,..., zL z0):= Πl=1L Pl(zl zpa(l); ϕl).

The paper notes that PSCs correspond more closely to how circuits are designed in quantum computers while DFGs are inspired by graphical models, and that PSCs are hardware-agnostic by design and the same logical circuit can compile to different backends: a software simulator, the XTR-0 test chip, or Z1.

The central training method is variational compilation, which minimizes the trajectory-level KL divergence LVC(φ):= DKL(P ∥ P̃φ) = Σl=1L εl(φl). Each summand depends on the parameters of one kernel only, so the kernels are trained independently of one another, in parallel.

The gradient is given by ∇φl εl = Ex∼ql−1 Ey∼Pl(·x)[−∇φl log P̃lF(y x; φl)]. The paper derives a two-phase identity for the gradient: −∇φ log P̃F(y x; φ) = E(w,y′)∼pφ(·,·x)[Φφ(x, w, y′)] − Ew∼pφ(·x,y)[Φφ(x, w, y)], where Φφ:= −∇φEφ is the vector of the THM's couplings.

The paper identifies three sources of compilation residual: "the hypothesis-class limitation set by the substrate's topology, the hidden-spin count, and the coupling caps; the optimization residual of finite gradient tolerance; and, in the intractable case, the sampling bias of unmixed phases."

The key error bound is: DKL(R#P ∥ R#P̃φ) ≤ DKL(P ∥ P̃φ) = Σl=1L εl(φl) ≤ Σl=1L cl Ex∼µl[Jl(x; φl)], where the middle equality is the chain rule of the KL divergence, the left inequality is the data-processing inequality, and the right inequality bounds per-kernel losses under a generic input distribution.

The paper identifies three choices for the input distribution µl: "(i) target inputs, µl = ql−1: the weights of the exact decomposition in (17), under which the sum of per-kernel losses is the trajectory error. This is the default; (ii) model inputs, µl = q̃l−1: each kernel is trained under the input marginal it receives inside the compiled circuit; (iii) generic inputs, e.g., uniform: agnostic to the context of the rest of the program."

The paper notes that A target conditional that recurs across applications... can be compiled once and reused, with the right-most bound of (17) guaranteeing that after placement into a specific program, the kernel's contribution to the trajectory error is at most cl Ex∼µl[Jl(x; φl)].

The paper introduces trajectory-level REINFORCE post-training, which cares only about how well the readout satisfies a given objective and uses all compiled kernels jointly against a single global objective. The gradient is: ∇φlLRF = E[F(z1:L) Φφl(zl−1, wl, zl)] − E[E(w′,y′)∼pφl(·,·zl−1) Φφl(zl−1, w′, y′)]. The paper notes that "REINFORCE becomes effective only once the model is already good enough that its samples reach the region where F discriminates, and supplying a good starting model is exactly what variational compilation and context matching are for."

The first demonstration compiles a biased random walk on a 5×5 torus, where the target conditional is the asymmetric stochastic swap gate PAsymSwap. The paper reports that the median compiled total variation distance for the PAsymSwap gates is 0.096. The results show that Stacking context matching and REINFORCE reduces the final-time half-l1 occupancy error from 5.64 (compiled-only) to 0.30 (context matched) to 0.08 (context matched + REINFORCE), nearly two orders of magnitude.

The second demonstration compiles a predator-prey ecosystem model with an on-site reaction process and a diffusion-like process. The paper reports that Kernels with only four and eight visible nodes are capable of reproducing the conditional distributions of the migration and reaction processes respectively to a worst-case total variation distance of ∼ 0.01. The paper notes that REINFORCE training substantially improved the quality of the compiled model's population mean for t ∈ 1,..., TRF, but also that "Shortly thereafter, more significant departures emerge from the exact process than were evident in the pre-REINFORCE compilation, suggesting that 'reward hacking' poses a risk even with models built from a small number of unique kernels."

The third demonstration compiles the day-to-day movement of financial markets using a panel of N = 14 daily series covering the major asset classes... over 4,802 trading days from 2007 to 2026. The kernel is compiled to a conditional Thermodynamic Consistency Model (TCM), which is a chain of two BM kernels, both conditioned on the clamped B = 5-day context, in which the first samples a draft of the next day and the second refines it.

The results show that The compiled two-step TCM reaches a composite error of 0.667, below both baselines on the composite, and REINFORCE post-training improves it by a further 27% to 0.486. The paper notes that the improvement reflects generalization along two axes that the training signal does not contain: from 20-day windows to 1,200-day rollouts, and from the training split to held-out data.

The fourth demonstration shows sampling from stationary distributions corresponding to energies that are not natively expressible by the hardware substrate, calling this a meta-EBM. The construction compiles the Gibbs sampling program that samples it, where The Gibbs sampling algorithm decomposes into local, detailed-balanced update kernels, each kernel being a target conditional that can be compiled to any hardware substrate using variational compilation.

The demonstration uses a three-body Ising target on d = 12 spins and shows that the measured stationary error tracks this prediction across the full cap sweep, spanning over a decade of error, from 0.46 at the most aggressive cap down to 2.4×10−2 at Jmax = 10, at fixed ρ0 = 0.28.

The fifth demonstration compiles a Gaussian stochastic circuit for a sequential Bayesian experimental design task, where the goal is to reconstruct the field from as few measurements as possible. The results show that The RMSE against the true field falls to 0.259 ± 0.005 for the compiled THM and 0.260 ± 0.006 for the exact loop, versus 0.305 ± 0.008 for random placement.

The paper concludes that This manuscript introduced variational compilation as a way to turn directed stochastic processes into kernels that can be run on thermodynamic hardware. The authors note that Every compiled program remains approximate, because finite coupling ranges, sparse topology, optimization residuals, and finite thermalization all contribute residual error, and that "Context matching, trajectory-level post-training, and hardware-in-the-loop refinement can reduce the errors seen by the deployed program, but they do not remove the need to validate each application against its own task-level observable."

The paper identifies An important future direction is to find useful decompositions of other stochastic processes into local conditionals that can be compiled and run in this framework, and notes that A possibility open for future exploration relates to the discovery of novel stochastic algorithms, drawing a parallel to quantum computing where the approach... has been applied successfully in the discovery of quantum algorithms.

The paper also discusses "connectivity-aware compilation, where the placement of input, hidden, and output spins on the actual hardware graph is optimized together with the kernel parameters so that topology residuals can be measured and reduced rather than treated after the fact."

Improvements for AI systems

Based on the paper, here are specific improvements I can implement in AI systems:

Improvement: Replace standard GPU-based Gibbs sampling in probabilistic graphical models with a software simulator of thermodynamic kernels (THMs) that uses variational compilation to map target conditionals onto energy-based models.

What it can do:

  • Execute stochastic programs (Bayesian networks, Markov chains, Gaussian processes) at 104–106× lower energy per sample by exploiting the hardware's native equilibrium sampling, with a software fallback that mimics the same dynamics.

  • Compile any directed factor graph into a sequence of clamped-thermalization operations, enabling forward, backward, and posterior sampling from the same energy programming.

Sources

Related papers