Sampling Is Computing: The Language-Model Decoder Is a P-Bit, and Any QUBO Compiles into It

Every language model contains a probabilistic computer: the softmax sampler that picks its next token is, exactly, the update rule of a probabilistic bit (p-bit). We give, to our knowledge, the first compiler that turns any quadratic unconstrained binary optimization (QUBO) energy into ordinary transformer weights, so that standard decoding, with no training, runs exact block Gibbs sampling. Earlier compiled transformers are deterministic, and earlier language-model Gibbs samplers use learned conditionals with no known joint law. Each token sets k variables from their exact joint conditional, and the sampling temperature is the Gibbs temperature. We prove that decoding reproduces the Gibbs transition kernel exactly (the decoder–Gibbs equivalence), that floating-point evaluation is exact for integer QUBOs under stated bounds, and that otherwise the token process stays within a computable total-variation distance of the exact chain. A second, programmable transformer reads any integer QUBO with up to 40 variables from its prompt. A counting bound shows the weight count is optimal for dense problems up to constant factors at fixed precision, and a higher-order extension samples any strictly positive distribution on binary variables, at exponential cost in general. Experiments check the exactness token by token. The compiled decoder reaches the best-known cuts of the 800-node Gset graphs G1 and G6, stays exact in Hugging Face generate() and on a GPU, and, given QUBOs from a language-model repair, chooses the same weight edits as a direct sampler. Any transformer runtime can run a provably correct stochastic algorithm with the sampler it already has.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-30
DOI
https://doi.org/10.5281/zenodo.24673363
Primary Topic
Quantum Computing Algorithms and Architecture
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Sampling Is Computing: The Language-Model Decoder Is a P-Bit, and Any QUBO Compiles into It

Soufiane Chehraoui
Zenodo (CERN European Organization for Nuclear Research)
Quantum Computing Algorithms and Architecture
preprint

Sampling Is Computing: The Language-Model Decoder Is a P-Bit, and Any QUBO Compiles into It

Soufiane Chehraoui
preprint en

Abstract

Every language model contains a probabilistic computer: the softmax sampler that picks its next token is, exactly, the update rule of a probabilistic bit (p-bit). We give, to our knowledge, the first compiler that turns any quadratic unconstrained binary optimization (QUBO) energy into ordinary transformer weights, so that standard decoding, with no training, runs exact block Gibbs sampling. Earlier compiled transformers are deterministic, and earlier language-model Gibbs samplers use learned conditionals with no known joint law. Each token sets k variables from their exact joint conditional, and the sampling temperature is the Gibbs temperature. We prove that decoding reproduces the Gibbs transition kernel exactly (the decoder–Gibbs equivalence), that floating-point evaluation is exact for integer QUBOs under stated bounds, and that otherwise the token process stays within a computable total-variation distance of the exact chain. A second, programmable transformer reads any integer QUBO with up to 40 variables from its prompt. A counting bound shows the weight count is optimal for dense problems up to constant factors at fixed precision, and a higher-order extension samples any strictly positive distribution on binary variables, at exponential cost in general. Experiments check the exactness token by token. The compiled decoder reaches the best-known cuts of the 800-node Gset graphs G1 and G6, stays exact in Hugging Face generate() and on a GPU, and, given QUBOs from a language-model repair, chooses the same weight edits as a direct sampler. Any transformer runtime can run a provably correct stochastic algorithm with the sampler it already has.

Zenodo (CERN European Organization for Nuclear Research)
Quantum Computing Algorithms and Architecture
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon