Case Study

IQP-MMD: Generative Quantum Machine Learning

A modular research toolkit for training IQP circuits with MMD loss, covering anti-concentration theory, scaling experiments, bandwidth analysis, Qiskit validation, and formal structural modeling.

JAXPennyLaneQiskitPythonIQP CircuitsAnti-ConcentrationHPC / Grid5000
Scroll to explore

At a Glance

Key Metrics

Circuit Families

4 families

Lattice, ER, Product, Complete

Datasets

6 targets

Ising, blobs, MNIST, D-Wave, genomic

Key Finding

MMD ≠ Shape

Low loss ≠ learned distribution

Validation

Exact + Qiskit

Statevector + shot + noise cross-check

TL;DR

Summary

Built a production-quality research toolkit on top of Xanadu AI's scaling GQML paper (arXiv:2503.02934). The project implements IQP circuit training with MMD² loss across four circuit families and three kernel types, then adds a rigorous anti-concentration analysis layer showing that low loss does not imply learned distribution shape. Validated classically, against Qiskit statevector/shot/noise modes, and on Grid5000 HPC. Formal Forge models provide structural guarantees on generator graphs.

Background

Context

Generative quantum ML asks whether an IQP circuit can learn a target binary distribution by minimizing MMD², a kernel-based divergence that decomposes into Z-word expectations. The Xanadu scaling paper claimed circuits trained classically transfer to quantum hardware at up to 1,000 qubits. This project builds the infrastructure to reproduce and extend those claims with rigorous diagnostics.

The central question driving the research: does a small MMD² loss mean the circuit has actually learned the target distribution? The anti-concentration track was designed specifically to stress-test this assumption.

The circuit model: |ψ(θ)⟩ = H⊗ⁿ · exp(i Σⱼ θⱼ X^gⱼ) · H⊗ⁿ |0⟩ⁿ, where each generator bitmask gⱼ ∈ {0,1} determines which qubits interact. The circuit family defines which generators are used.

Architecture

Package Modules

Eight modules, each with its own responsibility. Click any card to see details.

circuits/

PennyLane

IQP circuit integration: parameterized gates, generator bitmasks, and exact output-probability extraction via Walsh-Hadamard transform.

tap to expand

mmd/

JAX

MMD² loss with Gaussian/Laplacian/multi-scale kernels, locked spectral conventions, exact small-n path, analytic + autodiff gradients, and per-observable diagnostics.

tap to expand

training/

SGD/Adam

Full training pipeline with per-step trajectory JSONL, .npz checkpoints, anti-concentration and marginal sidecars at every persisted step.

tap to expand

experiments/

CLI

Config-driven runners for scaling grid, Qiskit validation, training, and Forge structural search. Resolved manifest + JSONL per setting.

tap to expand

hypergraph/

NetworkX

Four primary circuit families (lattice, ER, product, complete) with Hypothesis strategies for property-based testing.

tap to expand

distributions/

NumPy

Exact and sample-based marginals, per-order TV/chi-square/Fourier squared error, and Walsh coefficient helpers for anti-concentration analysis.

tap to expand

qiskit/

Qiskit Aer

Split measured/unmeasured circuit builders, noise model factory (depolarizing, amplitude damping, thermal relaxation), and MMD² cross-check runners.

tap to expand

forge/

Formal Models

Structural Forge exports: qubits, generators, overlap-graph facts, degree constraints, and threshold predicates for automated circuit-family searches.

tap to expand

Families

Circuit Families

The primary sweep runs four families with comparable parameter counts. Family structure determines sparsity, overlap, and gradient scaling behavior.
FamilyStructureEdge DensityPlateau Risk
ZZ Lattice2D nearest-neighbor gridO(n)Low
Sparse Erdős-RényiBounded expected degree p = c/nO(c)Low
Product StateSingle-qubit generators onlyO(1)Very low
Complete GraphAll pairwise ZZ interactionsO(n²)High

Key Finding

Anti-Concentration vs. Loss

A distribution is anti-concentrated when its probability mass is spread rather than spiked. The paper uses the scaled second moment S_q = 2ⁿ · E[q(x)²] as the diagnostic: values near 1 indicate concentration, values near 2ⁿ indicate anti-concentration.

The AC11 experiment trained a lattice IQP circuit on a binary-mixture target at n=9. The target has strong anti-concentration. The learned model reduces MMD² aggressively, but its distribution remains far smoother than the target at every bandwidth tested.

Target vs Learned Anti-Concentration (n=9, lattice, binary-mixture)

σ = 1MMD² = 0.1019
target
71.0
learned
20.3
σ = 3MMD² = 0.0255
target
100.7
learned
4.8
σ = 9MMD² = 0.0010
target
85.1
learned
12.1

Key insight: Even when MMD² drives to near-zero (σ=9: loss = 0.0010), the learned distribution's scaled second moment remains far below the target. Low loss is not the same as matching the target's collision structure.

σFinal MMD²Target S_qLearned S_qGap
σ = 10.101970.9820.3350.65
σ = 30.0255100.664.8395.83
σ = 90.001085.1412.1373.01

AC12

Bandwidth & Marginal Agreement

Gaussian bandwidth σ controls which spectral orders the kernel emphasizes. Small σ focuses on low-order parity observables (single-qubit marginals). Large σ shifts weight toward higher-order correlations. The AC12 sweep ran σ ∈ {1, 3, 9, 27} and tracked per-order marginal TV error independently of the scalar MMD² loss.

Per-Order Marginal Agreement by Bandwidth (σ)

σ = 1Low-order emphasis
Order 1
82%
Order 2
41%
Order 3
18%
σ = 3Balanced
Order 1
54%
Order 2
63%
Order 3
47%
σ = 9High-order emphasis
Order 1
31%
Order 2
72%
Order 3
81%
σ = 27Heavy high-order
Order 1
19%
Order 2
61%
Order 3
93%

Higher σ shifts spectral weight toward higher-order Z-words, emphasizing fine-grained collision structure over marginal statistics.

Why this matters: Optimizing MMD² at one bandwidth can improve low-order marginals while leaving high-order structure unlearned, or vice versa. Per-order decomposition is the right diagnostic, not the scalar loss alone.

How

Methodology

01

Locked MMD² Derivation

The Gaussian kernel uses a single locked convention k(x,y) = exp(−H(x,y)/(2σ²)) with Walsh decay τ = tanh(1/(4σ²)). Sampled Z-words, exact small-n paths, and Qiskit cross-checks all share the same spectral convention, so validation is comparing one formula across execution modes, not two separate derivations.
02

Named RNG Streams

Six independent RNG streams (circuit, data, theta, kernel, estimation, qiskit) eliminate implicit randomness coupling. Each can be frozen independently for debugging, and rerun reproducibility is tested by asserting identical JSONL outputs across identical config + seed pairs.
03

Anti-Concentration as a Separate Diagnostic

AC is tracked alongside training, not inferred from loss. Every trajectory row carries ac_scaled_second_moment, target AC, and per-order marginal TV, so the gap between low loss and learned distribution shape is measured explicitly at every step.
04

Qiskit Cross-Validation

Classical statevector expectations are cross-checked against Qiskit Aer statevector, shot-based, and noise-model modes for every circuit family and n in the validation grid. QASM exports and transpilation metadata are persisted alongside numerical comparisons.
05

Config-Driven Reproducibility

Every run writes a manifest.json and config.json before any records are emitted. JSONL records carry dataset metadata, model provenance, and RNG seed labels so any result traces to a single concrete config+seed coordinate.

Depth

Technical Depth

Exact Small-n Engine

Walsh-Hadamard probability extraction paired with exact MMD² path. Enables ground-truth validation at n ≤ ~16 without approximation, confirmed against brute-force toy distributions.

JAX Autodiff Gradients

Analytic gradient estimator cross-validated against JAX value_and_grad and finite differences. Gradient summaries include IQR, MAD, p95/p50 tail ratio, and median-of-means for barren plateau diagnosis.

Hypothesis Property Tests

Strategies for all four primary families. Tests enforce exact lattice and ER structural invariants (open-boundary nearest-neighbor ZZ, bounded-degree sparse ER) at the generator-matrix level.

Forge Formal Modeling

Structural searches in Forge (Brown's relational model finder) over IQP generator graphs. Overlap-graph facts, degree constraints, and anti-concentration threshold predicates are exported as machine-readable instances.

Batched Streaming Expectation

Memory-bounded IQP expectation engine with online mean/variance accumulation. Large num_z_samples runs over bounded chunks without materializing all cosine samples at once.

Grid5000 HPC Experiments

Bandwidth and marginal sweeps scaled to n ∈ [9, 20+] across 512 nodes. Grid5000 payload bundle encodes experiment configs for reproducible remote submission.

Data

Supported Datasets

DatasetQubits (n)SourceNotes
2D Ising lattice9–16MCMC samplingSquare-grid nearest-neighbor spin model
Scale-free Ising10–1000Barabási–Albert + MCMCFor large-n sampled experiments
Spin blobs16SyntheticBinary classification baseline
MNIST (binarized)784torchvisionHigh-dimensional transfer target
D-Wave484ZenodoReal quantum annealer samples
Genomic SNP805 / 10KINRIA 1000 Genomes16-SNP projection validated exactly

Authorship

Role

Team project for the Advanced Quantum Information course at Sorbonne Université, with Koshik Seeburrun and Mohamed Yaqub Alameen, supervised by Hela Mhiri. I owned the anti-concentration and marginal-agreement diagnostics, the Grid5000 distributed scaling experiments, the Qiskit statevector/shot/noise validation layer, and the Forge formal modeling of generator graphs. Koshik led the circuit family design (lattice, Erdős-Rényi, product, complete graph); Yaqub led the core training pipeline and initialization strategy experiments. Built on top of Xanadu AI's arXiv:2503.02934.

Future

What I'd Do Next

Run native n=805 genomic training on Grid5000 with reduced hyperparameters to test whether the AC gap persists at genomics-scale spin counts.

Implement a per-order loss decomposition that weights marginal agreement by spectral order explicitly, moving beyond the scalar MMD² to a multi-objective training signal.

Extend the Qiskit noise sweep to realistic IBM backend error rates and compare AC trajectories between simulated and emulated hardware executions.

Add a formal Forge check for anti-concentration sufficiency: whether the generator graph's overlap structure guarantees output-probability spreading at the circuit level.

Benchmark IQP training against the paper's RBM and DeepEBM baselines on the same datasets, using the same MMD² and marginal metrics.