A computer whose bits hold real numbers and are redrawn from an energy, not computed.
Write down an energy; the machine samples. On a rugged 40-dimensional landscape it lands on the best
point its grid allows while restarted Adam, given the same budget, is 58× worse.
A probabilistic bit is a bit that, when updated, is resampled from a distribution its neighbours define, rather than computed from them. Thousands of them in a loop make an Ising machine. They have almost always been binary, so a real-valued variable has to be spread across many of them.
First hardware demonstration of a continuous-state probabilistic computer with programmable energy-defined sampling (October 2026) builds the machine where a p-bit holds a bounded real number and is redrawn from
p(x_i | everything else) ∝ exp( -E(x_i, x_rest) / T )
at finite precision, with the random source kept deliberately separate from the sampler that consumes it. continuous-pbit is that machine in numpy: about 120 lines of sampler, five energies, four random sources, and the experiments that say where it wins and where it does not.
pip install -e ".[dev,experiments]"
python experiments/optimise.py # the headline, about a minute
pytest -q # 24 testsimport numpy as np
from continuous_pbit import Machine, Rastrigin, Schedule
energy = Rastrigin(dimension=10)
machine = Machine(energy, bounds=np.tile([-5.12, 5.12], (10, 1)), bits=8)
machine.run(Schedule(start=30.0, stop=0.02, sweeps=150))
machine.best_energy # 0.7987 — the lowest value this grid containsRastrigin has one global minimum and a lattice of local ones about a unit apart in every direction. Gradient descent finds whichever is nearest to where it started; the usual remedy is to start it again elsewhere, many times, which works until the local minima outnumber the restarts.
Every method below gets the same number of scalar energy evaluations.
| dimensions | continuous p-bits | restarted Adam | random search | best the grid allows |
|---|---|---|---|---|
| 2 | 0.1597 | 0.3980 | 0.0657 | 0.1597 |
| 5 | 0.3994 | 4.1788 | 13.2452 | 0.3994 |
| 10 | 0.7987 | 21.8890 | 58.5056 | 0.7987 |
| 20 | 1.5975 | 66.6620 | 184.6932 | 1.5975 |
| 40 | 3.1950 | 184.8626 | 473.1901 | 3.1950 |
Mean over 5 seeds, lower is better, global minimum 0. python experiments/optimise.py
The machine's column is identical to the last one: at every dimension it finds the lowest value its grid contains, exactly. Restarted Adam degrades with dimension because the number of local minima does, and by 40 dimensions it is 58× worse.
Two honest notes about that table. The grid is the catch: the machine can only return values on it, and since the grid never contains 0 exactly, its "perfect" score is 0.0799 per dimension rather than zero — which is why random search beats it at 2 dimensions, where being unconstrained matters more than being systematic. And a sweep evaluates a whole column at once, which is the one thing this hardware does in parallel and numpy does not; the comparison above counts scalar evaluations, so it is fair on arithmetic and pessimistic on the machine's wall-clock.
A physical noise source does not hand you a uniform deviate. It hands you thermal noise, or arrival times, or whatever its device produces. Because the conditional sampler only ever needs a uniform, any source can drive the machine by passing its own draws through its own CDF first — which is what lets the hardware be wired to whatever noise is cheapest.
from continuous_pbit import Cauchy, Exponential, Gaussian, Uniform
Machine(energy, bounds, source=Cauchy()) # a heavy-tailed device drives it just as wellThat is a testable claim rather than a slogan, so it is a test: for each of the four sources, 40,000
draws from one p-bit must match exp(-E/T) on the grid to within a total-variation distance of
0.02. All four do.
Recall from an associative memory. Ten digits are written straight into a dense associative-memory energy — nothing is trained anywhere in this repository — and a corrupted one is handed to the machine to clean up.
| pixels flipped | continuous p-bits | greedy descent |
|---|---|---|
| 0% | 100.0% | 100.0% |
| 10% | 97.5% | 98.0% |
| 20% | 91.0% | 91.5% |
| 30% | 69.0% | 70.5% |
| 40% | 23.5% | 23.5% |
| 50% | 1.0% | 2.0% |
200 trials per row. python experiments/recall.py
Sampling buys nothing here, and that is the result. This energy's basins are clean enough that taking each p-bit's lowest-energy value — the fixed-point iteration an ordinary continuous Hopfield network runs — already finds the stored pattern whenever anything can. A machine that samples is only worth its temperature schedule on a landscape that has somewhere to get stuck, which is why the Rastrigin result above is the one to look at.
Factoring. Product makes the p-bits multiply to a target, so two of them factor a semiprime:
| bits | solved | mean sweeps | divisions trial division would need |
|---|---|---|---|
| 7 | 50% | 20 | 10 |
| 10 | 12% | 13 | 25 |
| 12 | 0% | — | 54 |
It works at the 7-bit scale the paper demonstrates and falls apart immediately after. The reason is
visible in the energy: (ab − N)² has a whole continuum of solutions, every real pair on the
hyperbola ab = N, and nothing in the surface points toward the integer ones. This is not a
factoring algorithm, it is not competitive with trial division at any size, and it is in the
repository because it is one more energy you can hand the same machine.
An energy needs two methods. total(state) is the honest one. column(state, i, grid) is the
energy for every candidate value of one p-bit with the rest held where they are — it is what makes
a sweep cheap, since the whole grid is scored in one vectorised shot.
class Ring(Energy):
"""Keep the state on a circle of radius r."""
def __init__(self, radius): self.radius = radius
def total(self, state):
return (np.linalg.norm(state) - self.radius) ** 2
def column(self, state, index, grid):
rest = np.sum(state**2) - state[index] ** 2
return (np.sqrt(rest + grid**2) - self.radius) ** 2Getting column wrong is the one mistake that will silently ruin a run, so the test suite checks
every shipped energy against its own total at every grid point, to 1e-9. Do the same with yours;
tests/test_continuous_pbit.py has the three-line version.
Shipped: Rastrigin (rugged box-constrained), Quadratic, Patterns (dense associative memory),
Hebbian (the classical one, spurious minima included), Product (multiply to a target).
- The idea is the paper's: continuous p-bits, energy-defined conditional sampling at finite precision, and the separation of the random source from the sampler.
- This is software. The paper's contribution is an FPGA, and its headline number — roughly 33,000× against one evaluated QUBO solver on 7-bit factorisation — is a hardware result about hardware. Nothing here reproduces it, nothing here is compared against it, and the numpy machine in this repository is slower than the FPGA by whatever factor an FPGA is faster than numpy.
- The experiments are this repository's. Rastrigin, the digits and the baselines were chosen here; the paper uses MNIST patterns and its own comparisons.
- The paper reports 100% MNIST pattern recovery. The recall result above is on 5×7 digits with a dense associative-memory energy and is not the same experiment.
MIT. Paper: arXiv:2610.31339.

