|q⟩ Bad Qubits

advanced · Programming · Quantum Machine Learning (Advanced)

Quantum Generative Models

A generative model learns a probability distribution and then samples new data from it, rather than mapping inputs to labels. Quantum circuits are natural generators: measuring a prepared state produces a sample, and the Born rule already gives the distribution. The cleanest realization is the quantum circuit Born machine (QCBM).

The Born machine

Prepare a state with a parameterized circuit and read off the measurement statistics. For an nn-qubit circuit U(θ)U(\boldsymbol{\theta}) acting on 0n|0\rangle^{\otimes n}, the probability of observing bitstring x{0,1}n\boldsymbol{x} \in \{0,1\}^n is given directly by the Born rule:

pθ(x)=xU(θ)0n2.p_{\boldsymbol{\theta}}(\boldsymbol{x}) = \bigl|\langle \boldsymbol{x} | U(\boldsymbol{\theta}) | 0\rangle^{\otimes n}\bigr|^2.

This is the model distribution. There is no separate likelihood to compute — the circuit is the distribution, and sampling it is just repeated measurement. The name comes from this reliance on Born's rule (Benedetti et al., 2019).

Training without an explicit likelihood

The catch is that we usually cannot write down pθ(x)p_{\boldsymbol{\theta}}(\boldsymbol{x}) for every x\boldsymbol{x} — there are 2n2^n of them. QCBMs are therefore implicit models: we can draw samples but not cheaply evaluate the full probability vector. Training uses a loss that needs only samples. A standard choice is the maximum mean discrepancy (MMD), which compares the model and data distributions through a kernel kk:

LMMD=Ex,xpθk(x,x)2Expθ,yqk(x,y)+Ey,yqk(y,y),\mathcal{L}_{\text{MMD}} = \mathbb{E}_{\boldsymbol{x},\boldsymbol{x}'\sim p_{\boldsymbol{\theta}}}\,k(\boldsymbol{x},\boldsymbol{x}') - 2\,\mathbb{E}_{\boldsymbol{x}\sim p_{\boldsymbol{\theta}},\,\boldsymbol{y}\sim q}\,k(\boldsymbol{x},\boldsymbol{y}) + \mathbb{E}_{\boldsymbol{y},\boldsymbol{y}'\sim q}\,k(\boldsymbol{y},\boldsymbol{y}'),

where qq is the target data distribution. The loss is zero exactly when the two distributions match under the kernel. Crucially, every term is an expectation over samples, so the gradient can be estimated with the parameter-shift rule even though the likelihood is intractable (Liu & Wang, 2018).

Why a quantum generator might help

Two arguments recur in the literature:

Neither argument is a proof of practical advantage, and on small problems a classical model often wins. But QCBMs are a clean, fully quantum generative primitive and a common benchmark target.

Relation to the rest of the module

A QCBM is the generative cousin of the variational classifier: same parameterized circuit and same parameter-shift training, but the output is a sample, not a label, and the loss compares distributions, not predictions. The next lesson on quantum GANs replaces the fixed MMD kernel with a learned discriminator, turning the Born machine into a generator inside an adversarial game.

Sign in on the full site to ask questions and join the discussion.