Quantum circuit Born machines: generative models that sample by measurement
A quantum circuit Born machine (QCBM) is a generative model in which a parametrised quantum circuit is the probability distribution: each measurement returns one bit string, with probability equal to its squared amplitude. Training tunes the gate angles until the samples match the data, usually by minimising a distance between sample sets. Published studies show QCBMs matching or beating small classical models such as restricted Boltzmann machines on toy and financial data; none we know of shows an advantage over a strong classical generator on a real task.
Updated
At a glance
- What it models
- A probability distribution over bit strings, such as discretised returns of several assets
- Where samples come from
- Measuring the circuit: the Born rule turns squared amplitudes into probabilities, hence the name
- How it trains
- By comparing samples with data through a kernel distance (MMD)[1] or a Sinkhorn divergence[3], with gradients from the parameter-shift rule
- Its quantum contrast
- The QGAN, which pairs a circuit generator with a classical discriminator[7]
- Its classical twin
- The tensor-network Born machine, an MPS that also gives exact probabilities and exact samples[8]
- In eigenkit
- No QCBM estimator. You build one from a circuit, the PyTorch interface and
probabilities(), as below
How a Born machine works
Start from qubits in and apply a circuit with trainable angles . The final state has an amplitude for each of the bit strings, and measuring it returns string with probability . A circuit is therefore a distribution you can sample by running it, one shot per sample. Generative modelling asks for exactly this: a model that produces new samples that look like the training data.
On hardware a QCBM is an implicit model: it gives samples, but no value of for a given , much like a generative adversarial network. Liu and Wang made it trainable by minimising the maximum mean discrepancy (MMD), a kernel distance between the model's samples and the data, whose gradient can itself be estimated from samples with the parameter-shift rule. They demonstrated it on the Bars and Stripes dataset and on Gaussian mixtures, and found circuit depth and gradient-based optimisation important[1]. Benedetti et al. proposed a closely related data-driven circuit learning scheme the same year and ran it on an ion-trap computer[2].
The argument for the model is expressiveness: some distributions produced by quantum circuits are believed to be hard to sample classically, so a circuit may represent correlations that a classical model of the same size cannot. That is an argument about capacity, not about any dataset. Whether real data needs that capacity is the open question the studies below try to answer.
Training a QCBM, step by step
Every published QCBM follows roughly the same loop. The choices at each step decide whether the model learns or stalls.
Turn the data into bit strings
Discretise each variable to bits and concatenate them, so variables need qubits. Coyle et al. used currency pairs at 2 to 7 bits[3] each. More bits means a finer distribution and a wider circuit.
Choose an ansatz
Layers of single-qubit rotations and entangling gates, usually laid out along the device's native connectivity so the circuit needs no routing. Depth sets how much correlation the model can express.
Estimate a sample-based loss
Draw shots from the circuit, compare them with a batch of data through MMD or a Sinkhorn divergence, and estimate the gradient with parameter shifts. Exact losses such as KL divergence need itself, which only a simulator gives.
Check generalisation, not just fit
A model that reproduces the training distribution may simply have memorised it. Gili et al. measured whether a 12-qubit QCBM generates valid strings it never saw, and found the best generalisation with as little as 30%[6] of the valid data in the training set.
Sample the trained circuit
Once trained, the circuit is the generator: each shot is a new sample. On a simulator this step is free; on hardware it is where noise shows up in the samples.
Run it on a real QPU with EigenOrbit RouterIn eigenkit:
pip install "eigenkit[router]", thenprovider=RouterConfig(device=...)(docs).
A three-qubit Born machine with eigenkit and PyTorch
import numpy as np
import torch
from eigenkit import Circuit, CircuitBuilder, Z
n, depth = 3, 3
# The ansatz: RY on every qubit and a CNOT ladder, repeated, then a last RY layer.
qc = CircuitBuilder(n_qubits=n)
w = iter(qc.add_weights(n * (depth + 1)))
for _ in range(depth):
for q in range(n):
qc.ry(next(w), q)
for q in range(n - 1):
qc.cnot(q, q + 1)
for q in range(n):
qc.ry(next(w), q)
spec = qc.build()
# Measure every product of Z over a non-empty set of qubits; qubit 0 is the leftmost bit.
def z_string(mask):
ops = [Z(q) for q in range(n) if mask >> (n - 1 - q) & 1]
term = ops[0]
for op in ops[1:]:
term = term * op
return term
init = 0.1 * torch.randn(spec.n_weights, generator=torch.Generator().manual_seed(0), dtype=torch.float64)
model = Circuit(spec, observables=[z_string(m) for m in range(1, 2**n)], interface="torch", init=init)
# The Born rule from those values: p(x) = 2**-n * sum over S of (-1)**|x & S| <Z_S>.
signs = torch.tensor([[(-1) ** bin(x & s).count("1") for s in range(2**n)] for x in range(2**n)],
dtype=torch.float64)
def born():
z = torch.cat([torch.ones(1, dtype=torch.float64), model(torch.empty(0))])
return signs @ z / 2**n
# The target: two bumps over the values 0 to 7, which no product of one-qubit distributions gives.
x = np.arange(2**n)
bumps = np.exp(-((x - 1.5) ** 2) / 2) + 0.6 * np.exp(-((x - 5.5) ** 2) / 2)
target = torch.tensor(bumps / bumps.sum())
opt = torch.optim.Adam(model.parameters(), lr=0.1)
for step in range(300):
opt.zero_grad()
kl = torch.sum(target * torch.log(target / born().clamp_min(1e-12)))
kl.backward()
opt.step()
print(f"KL divergence: {kl.item():.0e}") # 3e-14
# Read the trained circuit with the NumPy interface and draw 1,000 samples from it.
probs = Circuit(spec).probabilities(model.weights.detach().numpy(), [])
print(np.round(target.numpy(), 3)) # 0.082 0.224 0.225 0.089 0.061 0.135 0.135 0.049
print(np.round(probs, 3)) # the same eight numbers
samples = np.random.default_rng(1).choice(2**n, size=1000, p=probs / probs.sum())
print(np.bincount(samples, minlength=2**n)) # 78 232 228 76 57 135 137 57The PyTorch interface returns expectation values, not probabilities, so the circuit measures all seven Z products and a fixed sign matrix turns them into the eight probabilities. That costs observables, so it is a teaching device for a few qubits, not a way to train at scale.
QCBM, QGAN and the tensor-network Born machine
| Model | Generator | How it trains | What it gives you |
|---|---|---|---|
| QCBM | A parametrised circuit; samples are measurements | A sample distance such as MMD, with parameter-shift gradients[1] | Samples only, on hardware; exact probabilities on a simulator |
| QGAN | A parametrised circuit, judged by a classical neural network | Adversarial: generator and discriminator take turns[7] | Samples, and a circuit that loads the learned distribution into a quantum state |
| MPS Born machine | A matrix product state on a classical computer | Likelihood, with a DMRG-like sweep that adapts bond dimensions[8] | Exact probabilities and exact, cheap sampling |
Zoufal, Lucchi and Woerner pitched the QGAN as a way to load a distribution into a circuit with polynomially many gates, where exact loading needs [7], so that amplitude estimation can price against it.
What the finance studies found
The most cited test is by Coyle et al. with Rigetti and the University of Edinburgh. They took 5,070[3] daily log-returns of four currency pairs from 1999 to 2019, discretised them, and compared a QCBM with a restricted Boltzmann machine (RBM) of equal parameter count. In simulation the Born machine always at least matched the RBM, and with two currency pairs in the model it pulled ahead from about 4 bits[3] of precision per pair. The trained circuits that won were also the more entangled ones, although the data is entirely classical. On hardware the picture changes: a 28-qubit[3] Born machine run on Rigetti's Aspen-7 chip learned despite hardware errors, but performed significantly worse than its RBM counterpart; the authors note they could not simulate a QCBM of that size to compare.
Zhu et al., a Fidelity and IonQ team, mapped copulas, the standard tool for joint distributions with fixed marginals, onto entangled states, trained a QCBM and a QGAN on two-variable stock market data, and ran them on IonQ's trapped-ion machines for up to 8 qubits[4]. They report results better than the classical baselines, a classical GAN of similar size and a parametric Gaussian copula[4]. An IonQ and GE Research follow-up scaled to 3- and 4-variable copulas for risk aggregation. Training got harder as models grew, a trait variational circuits share (see barren plateaus); an annealing-inspired schedule recovered it, and the quantum models predicted comparably to or better than standard classical models[5].
The pattern across these papers is consistent. The classical baselines are small and chosen to match parameter counts, the problems fit in a few dozen bits, and hardware noise erodes whatever edge simulation showed. None of them compares against a modern classical generator such as a normalising flow or a diffusion model on the same data. The same pattern runs through quantum machine learning as a whole, and the guide on when quantum machine learning makes sense sets out how to test for it.
The classical twin, and when it is enough
Replace the circuit by a matrix product state and you get the same kind of model on a classical computer: squared amplitudes are probabilities, and samples come from a simple sweep along the chain. Han et al. trained such a model on Bars and Stripes, random binary patterns and MNIST[8]. Unlike a QCBM on hardware, it gives the exact likelihood of every string, so it can be trained by maximum likelihood and checked directly. The tensor networks page explains the structure and how the same model drives the TN-GEO optimiser.
The twin also sets a bar for the quantum model. A QCBM whose circuit is shallow and builds little entanglement can be simulated as an MPS at low cost[9], so for it to offer anything new, its trained state must be entangled beyond what a practical bond dimension can hold. Coyle et al.'s observation that the winning circuits were the more entangled ones points in that direction; it does not yet show that such states are needed to model market data well.
For finance, the QCBM's most practical role may be the one the QGAN paper proposed: a compact way to load a learned distribution into a quantum state for a later algorithm, such as the amplitude estimation route in quantum option pricing.
Run it on a real QPU with EigenOrbit RouterCopy the trained angles into a hardware backend, sample the circuit and compare the counts with the target distribution.In eigenkit: pip install "eigenkit[router]", then provider=RouterConfig(device=...) (docs).
Questions
What is a quantum circuit Born machine?
It is a generative model made of a parametrised quantum circuit. Measuring the circuit returns a bit string with probability equal to its squared amplitude, so the circuit defines a probability distribution and every run is a sample. Training adjusts the gate angles until the samples resemble the training data.
Why is it called a Born machine?
After the Born rule of quantum mechanics, which says that the probability of a measurement outcome is the squared magnitude of its amplitude. The model uses that rule as its way of producing probabilities, the way a Boltzmann machine uses the Boltzmann distribution.
What is the difference between a QCBM and a QGAN?
Both use a parametrised circuit as the generator. A QCBM is trained directly on a distance between its samples and the data, such as the maximum mean discrepancy. A QGAN adds a discriminator, usually a classical neural network, and trains the two against each other. The QCBM has fewer moving parts; the QGAN can be easier to steer on complex data but inherits the instability of adversarial training.
Can a QCBM run on real quantum hardware?
Yes. A Born machine of a few dozen qubits was partly trained on Rigetti's Aspen-7 chip, and copula models of a few qubits were trained on IonQ's trapped-ion systems. In both cases hardware noise reduced the quality of the samples compared with simulation, and the training loop ran partly on classical computers.
Is a QCBM better than a classical generative model?
Not on present evidence. Simulated QCBMs have matched or beaten restricted Boltzmann machines of equal parameter count on small financial datasets, and trapped-ion copula models matched or beat standard classical copulas. No published study shows a QCBM beating a strong modern generator on a real task, and an MPS Born machine often does the same job classically.
Does eigenkit have a QCBM?
No. eigenkit has no QCBM estimator and no MMD loss. It has the parts: circuits built gate by gate, a PyTorch interface that trains gate angles with autograd, and a probabilities method on the NumPy interface that returns the full output distribution, which together make the short Born machine on this page.
Sources
- J.-G. Liu, L. Wang. Differentiable learning of quantum circuit Born machines. Physical Review A 98, 062324, 2018. arXiv:1804.04168.
- M. Benedetti, D. Garcia-Pintos, O. Perdomo, V. Leyton-Ortega, Y. Nam, A. Perdomo-Ortiz. A generative modeling approach for benchmarking and training shallow quantum circuits. npj Quantum Information 5, 45, 2019. arXiv:1801.07686.
- B. Coyle, M. Henderson, J. Chan Jin Le, N. Kumar, M. Paini, E. Kashefi. Quantum versus classical generative modelling in finance. Quantum Science and Technology 6, 024013, 2021. arXiv:2008.00691.
- E. Y. Zhu, S. Johri, D. Bacon, M. Esencan, J. Kim, M. Muir et al. Generative quantum learning of joint probability distribution functions. Physical Review Research 4, 043092, 2022. arXiv:2109.06315.
- D. Zhu, W. Shen, A. Giani, S. Ray-Majumder, B. Neculaes, S. Johri. Copula-based risk aggregation with trapped ion quantum computers. Scientific Reports 13, 18511, 2023. arXiv:2206.11937.
- K. Gili, M. Hibat-Allah, M. Mauri, C. Ballance, A. Perdomo-Ortiz. Do quantum circuit Born machines generalize? Quantum Science and Technology 8, 035021, 2023. arXiv:2207.13645.
- C. Zoufal, A. Lucchi, S. Woerner. Quantum generative adversarial networks for learning and loading random distributions. npj Quantum Information 5, 103, 2019. arXiv:1904.00043.
- Z.-Y. Han, J. Wang, H. Fan, L. Wang, P. Zhang. Unsupervised generative modeling using matrix product states. Physical Review X 8, 031012, 2018. arXiv:1709.01662.
- G. Vidal. Efficient classical simulation of slightly entangled quantum computations. Physical Review Letters 91, 2003. arXiv:quant-ph/0301063.
Run it yourself with eigenkit
eigenkit is EigenOrbit's open-source Python library: write a circuit once, run it on any simulator or QPU, and test it against a classical baseline on your own data before you invest in it or rule it out.
$ pip install eigenkit