A surface · A code · An executable state

Circuits on
a surface.

Follow eighteen qubits from a clean dessin to a toric code, then execute and train the circuit that acts on them.

The live laboratory computes complex amplitudes in a browser worker. Every syndrome expectation comes from that state vector. Higher-genus surfaces have checked combinatorial data; larger simulations are reported separately with their recorded evidence.

01 / Topological register

The edges are the qubits.

Insert a white vertex into each edge of the square cellulation. The resulting clean dessin has black vertices at the original lattice sites and one physical qubit at each white vertex. Its cyclic order and face permutation retain the surface topology.

Explicit torus parametrization
Black vertexWhite vertex / qubitSelected qubitSelected check

The 3D torus is an explicit smooth embedding of the periodic coordinates. It illustrates the cellulation, not a computed conformal metric or Belyi function.

Inspect the exact dessin and CSS data

With HX the vertex–edge incidence matrix and HZ the face–edge incidence matrix over 𝔽₂, a closed boundary gives HXHZᵀ = 0. The logical dimension is k = n − rank HX − rank HZ = 2g. The preparation circuit creates the equal-amplitude superposition over row(HX), choosing one encoded basis state.

Download this exact surface and circuit JSON

02 / State-vector laboratory

Step through the preparation.

18-qubit live worker

In the live 18-qubit case, Reset starts at |0⟩⊗18. Its encoder uses eight Hadamard gates and thirty-four controlled-X gates. The checks need not equal +1 until preparation is complete. Insert a gate at the playhead to see how the amplitudes and stabilizers respond.

Waiting for the prepared circuit.

Wire q is bit q of the computational basis index. Basis strings below display the highest-index qubit on the left. A two-qubit vertical line joins the labelled control and target in the circuit.

For a Pauli-error experiment, prepare the code, choose X or Z and a target, then apply it. X errors flip adjacent face checks; Z errors flip incident star checks. General rotations can produce a distribution of syndrome outcomes.

Norm squared—
Overlap with chosen |0L⟩—
Basis support, p > 10⁻¹²—
Basis Shannon entropy—

Syndrome expectations

These are deterministic floating-point sums over the simulated amplitudes, without shot noise. For a ±1 check S, P(S = −1) = (1 − ⟨S⟩)/2. Reading this table does not collapse the state.

Current stabilizer values
Check⟨S⟩P(−1)State

Computational-basis distribution

Probability grouped by the number of 1 bits. This entropy is basis dependent; it is not an entanglement-entropy measurement.
Inspect up to eight largest basis probabilities
Basis stringProbabilityPhase (rad)

03 / A trainable quantum circuit

Learn a local star correlator.

4 trainable angles · 18-qubit state

The variational circuit acts on the four edges of the first star, q₀, q₂, q₉, q₁₅. The other fourteen qubits stay in the full encoded state. Apply Ry(sᵢπ/2 + θᵢ) on each patch qubit, three controlled-X gates into the first qubit, and read its Z expectation.

fθ(s) = ⟨Zq₀⟩   ·   y(s) = ∏ᵢ sᵢ   ·   ℒ = mean (fθ(s) − y(s))²
Choose an input and run its circuit to compute a prediction.Training uses four fixed examples, step size 0.2 and exact parameter-shift derivatives.

Measured training loss

The graph is populated by computations in this session. Stop ends training after the current gradient evaluation.

Training and held-out inputs

Four sign patterns train the four parameters. The other twelve patterns provide a complete held-out check of this small, explicitly defined task.

Actual state-vector predictions
Input sSplitTargetPrediction
Read the ansatz, derivative, and scope

For this encoded state and this star, the analytic reference is fθ(s) = (∏ᵢsᵢ)(∏ᵢcos θᵢ). The worker still applies every gate to all 2¹⁸ amplitudes and computes the readout from those amplitudes. The reference identity provides an independent check; it is not substituted for execution.

Each rotation parameter appears once. Its expectation derivative is [f(θ + πeⱼ/2) − f(θ − πeⱼ/2)]/2. The loss gradient then uses 2(f − y) times that derivative, averaged over the four examples. Shifting the squared loss directly would give a different and generally incorrect gradient.

The initial angles already give the correct prediction signs on all sixteen inputs. Optimization calibrates their magnitudes toward ±1 and improves mean squared error; it does not improve classification accuracy from a lower baseline. These four parameters are not uniquely identifiable from their cosine product.

This is a small variational quantum model on an encoded surface-code state, with a deliberately transparent target. Successful training does not establish a quantum learning advantage, fault tolerance of the ansatz, or general performance on external datasets. The variational gates may leave the code space. No hardware noise model or finite-shot sampling is added.

04 / Reproducible execution records

Separate the run from the drawing.

The live 18-qubit calculation, larger GPU runs, and higher-genus topology are distinct evidence. Backend, precision, allocated representation, checks and elapsed time are reported from the saved records. A surface diagram alone is not an execution result.

Checking for bundled GPU and training records…
Inspect raw execution records
No record loaded yet.

Exact topology and preparation: case manifest · independent NumPy validation · browser kernel · worker and training loop.

What the connection establishes

A clean dessin supplies a finite oriented map. Its vertices, edges and faces define a chain complex over 𝔽₂, and the vanishing boundary composition gives commuting CSS checks. The resulting quantum code carries k = 2g logical qubits on a connected closed orientable surface. The site computes this combinatorial structure and executes the specified circuits. It does not construct an explicit Belyi map, prove a new fault-tolerance threshold, or resolve an analytic Yang–Mills question.

Background: Kitaev, fault-tolerant quantum computation by anyons · Schuld et al., evaluating analytic gradients on quantum hardware · the research monograph and its evidence boundaries.