Case Study · Updated September 10, 2026

MerLin Photonic Generative Modeling

A photonic generative-modeling study spanning a simulated two-ring generator, corrected IQP trainability and loss experiments, and an additive classical-training pipeline with bounded photonic deployment checks.

MerLinNumPyPercevalPyTorchIQPMMDJuliaForge
Scroll to explore

v4.0

Closed bounded release

What the release establishes

v4.0 is merged and closed for its selected bounded scope. It adds classical IQP training, matched comparisons with my sibling project, and separate small-circuit optical simulations. Several target fits remain poor, and postselection makes expected sampling costs large. No hardware experiment or quantum advantage is demonstrated. The original broader scientific program remains incomplete.

Classical ring training

6–8 qubits

Exact NumPy main runs. two kernels

Ring comparisons

22 cells

20 main artifacts and two smoke cells

Sibling comparisons

8 cells

Matched available source experiments

Direct optical simulation

2–4 qubits

Registered controls and ring smoke only

The release report and requirement ledger record the evidence and remaining qualifications.

History

Three different experimental questions

StageImplementationSupported conclusion
v1.0 generatorLatent-input QuantumLayer.simple. 462 outcomes mapped to a spatial gridClassical simulator training improves MMD, but the two-ring shape criterion is unmet.
v2–v3 and v3.1 correctionExplicit IQP encoding, gate checks, trainability and loss sweepsSmall-circuit checks survive. The two headline trainability/hardness interpretations were withdrawn.
v4.0Separate NumPy IQP trainer, spatial/Hamming objectives, matched deployment referencesBounded implementation and comparison evidence. Broader realistic-noise research remains open.

The v1 latent-input model and the later IQP circuit are different ansatzes. V1 already trained through classical simulation. V4 adds IQP expectation mathematics that avoids an optical simulator during training. It does not replace the earlier pipeline.

v1.0

A lower loss did not recover the full ring shape

Historical benchmarkRecorded valueInterpretation
Trained held-out MMD²0.0125 ± 0.0003Reported over 20 fresh latent draws. not an optical-shot confidence interval.
Untrained MMD²0.0360 ± 0.0048Same historical benchmark protocol.
Real-versus-real MMD²0.0114Finite-data reference, not a mathematical floor.
Probability on target rings0.68–0.69GEN-07: recognizably forming two rings remains unmet.

The generator outputs a probability vector, mapped to 2D bin centers and compared with the target using a Gaussian spatial kernel. The reported ring mass increased from 0.609 to 0.691 after changing both outcome grouping and the output-to-center mapping. Because those changed together, the result does not isolate a causal benefit from radius ordering. Neighboring Fock-state indices have no established spatial smoothness that guarantees this effect.

The spatial kernel is a different objective from the sibling project's Hamming kernel. A weak classifier baseline does not rule out the loss function as a contributor to poor generative fit. See the mapping correction and historical benchmark.

v3.1 correction

What the original sweeps actually measured

The original v3 write-up interpreted small-n gradient-variance fits as trainability findings. Classical null models reproduce the headline curves for the tested scopes. At n≤4 the chosen Euclidean kernel is numerically close to the identity. At n=5,6 its off-diagonal entries matter, but the null still reproduces the curve. These results do not establish an asymptotic barren plateau or an additional photonic trainability effect.

The loss sweep used classically sampleable families: independent single-qubit factors, or one fixed correlated pair with independent remaining qubits. There was no established sampling hardness to preserve. A half-L1 comparison involving subnormalized surviving mass was also interpreted too strongly. If the accepted mass is m=sq for normalized q, half-L1 against q is (1−s)/2. Conditional TVD is zero when the shape is unchanged. These answer different questions.

Under fixed photon number, uniform independent loss and acceptance requiring all n photons, loss contributes ηⁿ to success while preserving the conditional shape. Real ancilla photons in a heralded-CZ construction add transmission cost. Vacuum-ancilla CP gates avoid that extra photon-loss exponent but still incur postselection cost. Neither statement extends automatically to multiphoton sources or nonuniform loss.

The dated correction record preserves the original evidence. The earlier portfolio conclusions about transferred plateaus and the promise of photonic IQP are superseded by this account.

v4 methods

Train classically, compare the deployed model

IQP parity expectations can be expressed as classical cosine averages. This implementation enumerates finite bitstrings exactly and differentiates those expectations in NumPy. Enumeration still grows exponentially. This is not a demonstration of the literature's thousand-qubit sampled training method. Cheap expectation estimation also does not guarantee successful optimization.

The Hamming objective uses K(x,y)=exp(−H(x,y)/(2σ²)), where H counts differing bits, with σ=0.5√n for the ring profile. Its Walsh spectrum is diagonal. The spatial objective has a finite Walsh representation too, generally with off-diagonal terms. Kernel geometry, normalization and bandwidth must match before comparing losses.

Frozen parameters pass through an unquantized compiler control, catalog-angle quantization, and analytic trace-decreasing CP maps. Maps retain absolute success mass and normalize once at the end. Analytic tomography is synthetic reference data. Separate Perceval checks provide the bounded direct optical evidence. A product of gate maps does not itself prove final-only full-Fock equivalence.

See kernel definitions and deployment assumptions.

v4 results

Ring fit and expected sampling cost

Each main profile ran 300 Adam updates on the frozen 320/80 split of the 400-point circles dataset. Five seed IDs per profile produce identical parameters under deterministic parity initialization: the 20 main artifacts represent four unique runs, not 20 independent replications. Two n=4 three-update smoke cells complete the 22 comparisons.

Total variation distance (TVD) ranges from zero for agreement to one for maximal disagreement. Support validity is probability on states with supplied training-target probability above 10⁻⁶. It does not certify the unknown population support. The fit/support columns below use raw models. Cost uses the quantized analytic deployment at η=1, which still includes gate postselection.

ProfileTrain TVDHeld-out TVDSupport validityAttempts for 20,000 accepted outcomes
Hamming, n=60.55390.56730.54382.65 billion
Spatial, n=60.51180.54930.62691.53 billion
Hamming, n=80.60520.73480.4399360.97 billion
Spatial, n=80.58090.68690.513386.27 billion

These fits remain imperfect. The n=6/n=8 deployment estimates are analytic references, not direct optical simulations. The nominal 20,000 outcomes are a cost calculation, not collected shots. no hardware attempt rate or sampling confidence interval is established.

Matched evidence

Sibling-to-substrate comparisons

Eight available experiments were retrained with the pinned sibling trainer and compared using matched generators, parameters, target data, kernels and bit order. The arms are sibling IQP, equivalent local IQP, unquantized compilation, quantized compilation and an analytic fixed-photon deployment at η=0.9. This is stronger than replaying a checkpoint, but it covers only the registered available experiments. Other source experiments remain qualified or blocked.

CellAnalytic deployed TVDSupport validityAttempts for 20,000 accepted outcomes
n=6 training smoke0.93511.000037,634
n=9 bandwidth, σ=10.98830.01182.59 × 10¹⁶
n=9 bandwidth, σ=30.91570.09651.28 × 10¹⁶
n=9 bandwidth, σ=90.99080.01707.89 × 10¹⁵
n=9 bandwidth, σ=270.97330.03151.44 × 10¹⁵
n=9 Ghosh–Kim, σ=10.85090.29331.02 × 10¹⁶
n=9 Ghosh–Kim, σ=30.97660.02347.02 × 10¹⁶
n=9 Ghosh–Kim, σ=90.91380.16266.17 × 10¹⁶

The n=6 target has full support, so support validity of one coexists with poor fit. The n=9 targets have only 7–19 supported states out of 512. Their analytic acceptance probabilities are about 2.85×10⁻¹³ to 1.39×10⁻¹¹: roughly 72 billion to 3.51 trillion independent source attempts per accepted outcome. Matching implementations does not make these target fits good or the sampling costs practical.

Expected attempts are N/s for N accepted outcomes and independent attempts with success probability s. All eight deployed arms are analytic references, not n=9 optical or hardware experiments. The comparison report links the frozen artifacts and controls.

Verification

What was checked, and at what scale

CheckEvidenceLimit
Direct Perceval simulationRegistered n=2/n=3 no-gate, bystander and shared-gate controls. two n=4 ring smoke evaluationsFixed-photon model. No general multiphoton or larger-n validation.
Final-only projectionShared-gate fixture conditional TVD ≈1.94×10⁻¹⁶ with unchanged accepted massOne registered fixture is not a general projection theorem.
NAT continuationDiscrete pair-angle keys, continuous singles and matched arms from one warm startOptimizer mechanics and controls pass. Realistic-noise efficacy is not established.
Resource pilotAnalytic path at n=4/6/8/10. n=10 peak RSS growth ≈110 MiBNot full-Fock scaling or a hardware runtime prediction.
Clean-checkout software checks726 tests passed, one default-suite skip. 37 explicit sibling integration tests passedImplementation validation is not full scientific acceptance.
Julia and Forge historySeparate small-circuit numerical checks. bounded ancilla mapping/allocation/lifecycle modelsShared assumptions can survive cross-checks. Formal bookkeeping is not an optical correctness proof.

Literature

An implementation study within established research

KLM established linear-optical quantum computation. This project does not claim a new proof that qubit IQP circuits can be realized optically. Recio-Armengol, Ahmed and Bowles provide the classical-training approach motivating v4. Salavrakos et al. demonstrate a related photonic Born machine with loss mitigation, using a different model and experimental route.

IQP sampling-hardness results concern specified families and complexity assumptions. They do not certify these trained instances. Bandwidth and trainability theorems likewise require matching the cost, initialization ensemble and notation. The literature scope and baseline state those boundaries. No exhaustive novelty claim is made.

Open research

What remains beyond the closed release

The original frontier question was whether a classically trained model remains useful under realistic photonic source imperfections, and whether noise-aware training or mitigation closes the deployment gap. The bounded release supplies infrastructure and baselines for that question. It does not answer it.

Remaining work includes validated distinguishability and multiphoton source models, broader full-Fock checks, direct larger-n deployment, matched sampled uncertainty, and a scientific test of NAT efficacy. The owner's source-gap hypothesis is recorded, but its source-mutation experiment is unperformed. A gate-based versus graph-state IQP comparison was not implemented. No general gate-count scaling law or photonic advantage follows from this release.

Authorship

Implementation, interpretation and correction

This is a solo project developed with AI assistance. I own the research choices, interpretation and published claims. The correction history records where earlier explanations exceeded the evidence. Software checks alone did not prevent those mistakes. The repository retains owner explanations, dated audits and reproducible artifacts so readers can distinguish measurements from interpretations.

Documentation reconciliation · Owner explanation · Source repository