A trained model · A checkable answer

Quantum features.
Graph reasoning.

Run the quantum ToricGT research model. Follow a token through its circuit, graph attention and experts, then inspect the path it proposes.

Loading the checked model and four held-out examples…

01 · Weighted tokenization

A prediction proposes.
A certificate proves.

Vertices mark positions in a string. Each edge is a permitted token with an integer cost. The model predicts remaining costs and proposes a path; an independent dynamic program checks the optimum.

For every edge, cost = base cost + u × slope. Changing u recomputes the circuit inputs, model output, and exact path certificate. The finite vocabulary is held fixed.

Learned proposalCertified path All displayed costs use integer benchmark units.
String
—
Learned proposal cost
—
Exact minimum cost
—
Proposal regret
—

Initial learned proposal

A learned integer potential is made dual-feasible by a backward pass. Equality of path cost and lower bound proves optimality. A gap can remain even when the proposed path happens to be optimal.

Final certified answer

When needed, exact dynamic programming supplies a path and matching potential. Its correctness is reported separately from the model’s prediction accuracy.

Inspect every predicted node value
Remaining costs, in integer benchmark units
VertexRaw neural predictionExact dynamic programDifference

02 · The token feature map

Eight amplitudes.
Six Weyl features.

Each graph token becomes six data angles. Two layers of RY and RZ rotations, followed by controlled-NOT gates, prepare a three-qubit state. The real and imaginary parts of ⟨U⟩, ⟨V⟩ and ⟨UV⟩ become model features.

Qubit 0 is the most-significant basis bit. Time increases left to right.

State probabilities

Complex amplitudes
BasisRealImaginaryProbability

Final features and exact shift derivative

The derivative applies to each observable feature. The nonlinear model loss requires the chain rule; shifting the whole loss is generally incorrect.

Final token features and derivatives with respect to the selected circuit offset
FeatureValueDerivative

U|j⟩ = exp(2πij/8)|j⟩ and V|j⟩ = |j−1 mod 8⟩. Their real and imaginary expectations are expectations of (W+W†)/2 and (W−W†)/(2i). Statevector expectations here are exact up to floating-point error; physical measurements would require shots.

03 · The rest of the trained model

Attention, incidence,
and learned experts.

Node and edge tokens share an encoder. Their endpoint incidences enter attention scores. A learned mixture combines softmax attention with a max-plus context; four experts each provide two routing slots.

Softmax attention

Rows are queries; columns are keys. Every softmax row sums to one. Hover a cell for its numerical value.

Expert combination for the selected token

Combination weights sum to one across slots for each output token. Dispatch weights instead normalize across tokens for each slot; they are different matrices. Attention weights describe an internal calculation and do not by themselves establish a causal explanation.

Numerical attention and routing data
Key tokenAttention from selected query
Expert slotCombineDispatch

04 · Three seeds, three comparisons

Measured performance.
Visible uncertainty.

The trainable quantum model is compared with a matched classical trigonometric feature map and a frozen quantum-feature ablation. All models use the same graph encoder and data splits. Checkpoints are selected using validation error.

Optimal learned proposals: mean ± sample standard deviation across seeds 17, 29 and 43
Feature modelOrdinary test splitLonger graphs, length 9–12

These small experiments establish that the circuit can be trained within the graph model. They do not establish a quantum advantage or a statistically reliable superiority over the classical control. Exact dynamic-programming repair is excluded from the learned-proposal scores above.

All nine runs and resource measurements
Actual RTX 4090 training records; inference time is for a batch of 32 graphs
Mode / seedSelected epochTest optimalLonger optimalOffset change ‖Δθ‖Batch msPeak allocated MiB

How this connects to the larger project

Weyl clock and shift operators represent a finite noncommutative torus. Toric and semigroup geometry describe separate algebraic constructions in the manuscript. Token-DAG optimization supplies an exact, small benchmark. The surface-code companion contains the actual toric and higher-genus quantum circuits.

The paper specifies how a typed graph model could propose tensor rewrites or cosmological detection statistics. Those applications need their own data, physical models and evaluations; this token benchmark does not establish them.

Explore the 18-qubit surface encoder and GPU experiments →

Inspect the implementation

The full browser forward pass is checked against the saved CUDA model on two test and two longer-graph examples. The source archive contains training code, all nine run records, the exact path oracle and independent circuit checks.

Inspect sound tensor rewrites and neural language constructions →