LIP6 · QC Ware · University of Edinburgh · Fujitsu Research of Europe · Terra Quantum · Technology Innovation Institute
Graphs provide a natural language for relational data in chemistry, biology, and optimisation. Graph neural networks have driven much of the recent progress in learning from such data through message passing, a single primitive that generalises convolution and attention. Quantum counterparts have been proposed, but with limited connection to message passing and few guarantees on performance or scalability. For a quantum model to be useful, it must offer expressivity guarantees together with demonstrable scalability. We show how a quantum graph neural network can be built to perform message passing, to be permutation equivariant, and to sit at a chosen level of the Weisfeiler–Leman hierarchy, the standard measure of how finely a model can tell graphs apart. As for classical graph networks, training can be carried out first on small graph instances, a pre-training that mitigates the usual training difficulties, and the output is read out at a cost that stays low as the graph grows. We validate the framework in large-scale simulations of up to 56 qubits: on synthetic graphs that ordinary message passing cannot separate, on molecular property prediction, and on the travelling salesman problem.
graph learningA graph neural network operates on relational data, such as molecules in drug discovery, interactions in biology, or the road maps behind route optimisation. Almost all such models are built on a single operation, message passing: each node gathers information from its neighbours and updates its own state, and after a few rounds a node’s state summarises its local neighbourhood. For an insightful introduction to graph neural networks, we recommend the Distill primer, A Gentle Introduction to Graph Neural Networks. Three properties make these models effective, and our quantum construction is built to carry all three.
The Weisfeiler–Leman ceiling has an exact form. Message passing separates two graphs only as well as the first level of the hierarchy, the 1-dimensional test (1-WL): if 1-WL assigns two graphs the same final colours, no message-passing network can distinguish them (Xu et al.), and adding layers or widening the hidden dimension does not change this. The limitation has concrete consequences. Two molecules can be genuinely distinct, with different properties, yet present the same colours to 1-WL, so the network returns the same prediction. The same blindness appears in counting: a 1-WL network cannot count cycles, and so cannot distinguish a benzene ring from an open chain of the same atoms.
Expressivity is addressed through the -WL hierarchy, which lifts the test from single nodes to -node subsets, so that a colour describes a group of nodes rather than one. Larger resolves edges, triangles, and higher groups, and separates strictly more graphs. In the set-based convention used by the architecture here, the model reaches past the first level at .
Quantum graph models also inherit the trainability difficulty common to variational circuits: as the circuit grows, gradients can vanish across parameter space, the barren plateau. It is therefore important to show that a quantum graph model can be both trained and scaled to large graphs. The sections that follow construct a quantum graph network that sits at a chosen level of this hierarchy and remains trainable as it grows.
The 1-WL test colours nodes by refinement. Every node begins with the same colour. At each step a node is recoloured by combining its own colour with the collection of its neighbours’ colours, keeping repeats but discarding order. Once the colours stabilise, two graphs are declared different only if their colour histograms differ. Message passing is the learned form of this loop, and it inherits the same limitations.
The -WL hierarchy applies the same refinement to -element subsets rather than single nodes. Each subset carries a colour, refined over its one-swap neighbours, the subsets obtained by replacing a single node. A single node at , an edge at , a triangle at : larger resolves larger structure and separates strictly more graphs. In the set-based convention used here, the model reaches past the first level at .
The model divides the qubits into two registers. A node register of qubits at particle number holds the graph, spanning a subspace of dimension , where the weight fixes the meaning of a basis state, a single node at , an edge at , a triangle at , and a group of nodes in general. An embedding register of qubits at particle number holds the features, of dimension , which sets the model’s capacity and does not grow with the graph. The joint state lies in
One layer, repeated times, applies four blocks, each with a single role.
The state the circuit prepares is
Each circuit layer performs one round of set-based -WL refinement, and for the model separates graphs that 1-WL, and hence every message-passing network, cannot.
Message passing is carried out on the quantum state rather than by a classical post-processing step. In most prior quantum constructions the circuit topology mirrors the graph and the aggregation that defines a graph network is left to a classical readout; the constructions that do aggregate coherently obtain their distinguishing power from random node labels rather than from the aggregation itself. Here the adjacency routes each node’s amplitude along the edges and the evolution updates the per-node features within the circuit, and the classical head only maps the final 1-RDM to node and edge features.
Two properties follow from this structure. Because and order their gates by the graph rather than the labels, and the evolution acts identically on every node’s embedding, relabelling the nodes reorders the same gates without changing their combined action. This construction is therefore exactly permutation equivariant, with no parameters tied. Because every gate preserves particle number, the dynamics remain in the structured subspace above rather than spreading across the full space, which, on the instances we tested, prevents the gradients from vanishing.
Each qubit may be read as a slot that is empty () or filled (). “Hamming weight ” means exactly slots are filled, and a Givens rotation moves a filled slot to an empty one without changing the count. While a gate acts inside a single register, that register remains on its shell, the conservation a physicist calls fixed particle number.
The mixing layer couples the registers and conserves only the total weight , so the state enters the larger joint subspace of qubits at weight , of dimension , still polynomial in at fixed and far below , which does not make its classical simulation cheap. The trainability argument rests on the embedding register’s small subspace, whose Lie algebra is polynomial rather than exponential. This is a heuristic supported by numerics, not a confinement theorem. Across the sizes we tested, the measured per-parameter gradient variance remains roughly flat as the joint-subspace dimension grows, rather than decaying as as a random initialisation does.
Each gate of the circuit is block-diagonal in the Hamming-weight basis: the full 2ⁿ × 2ⁿ unitary decomposes into one block per particle number, block w having size C(n,w). The coloured block is the subspace in which the model operates. Adjusting N, j, D, k updates the active subspace. Amplitude never leaves the coloured block, so the dynamics stay within this structured subspace. On the instances we test, this keeps the gradients from vanishing as the model grows. The subspace is a small fraction of the full 2ⁿ space, but a small subspace does not make a large instance cheap to simulate classically; that cost grows steeply with size.
We evaluate the framework on three datasets, each over several random seeds. The travelling salesman problem and QM9 carry the main evaluation, and the Cai–Fürer–Immerman graphs test the -WL ascent directly. The largest run is the travelling salesman problem with 50 cities, which uses 56 qubits, 50 node qubits and 6 embedding qubits.
experimentThe Euclidean travelling salesman problem provides an end-to-end test of the framework. The task is to find the shortest closed tour through cities in the plane, which is NP-hard. The relevant structure is captured at , so we run the model end to end as a instantiation: load the cities, predict which edges belong to the optimal tour, and decode the predictions into a route by beam search of width .
Tour quality is measured by the ratio of the produced tour length to the optimal, where is optimal. The mean ratio is , , and at , and rises to and at and , so the quality declines steadily as the graph grows at the fixed embedding. The largest instance, , is a 56-qubit simulation.
On the three sizes where a quantum baseline can also be simulated, these ratios lie at or below the reinforcement-learning equivariant circuit of Skolik et al., which reaches , , at . We run beyond , where simulating their -qubit state becomes infeasible. The two pipelines optimise different objectives, so this is a comparison of quality rather than a controlled head-to-head.
At matched parameter counts (about , with the same training set), a classical graph convolutional network achieves a lower edge-prediction loss, test BCE against , roughly lower. The instantiation is therefore a demonstration that the framework runs end to end and exercises equivariance, trainability, and redeployment, rather than a claim of improved performance over classical networks; this comparison is taken up in the Discussion.
experimentQM9 is a standard chemistry benchmark of 130,831 small organic molecules, each with up to nine heavy atoms and a set of properties computed by density-functional theory. We predict the HOMO–LUMO gap, the energy difference between a molecule’s highest occupied and lowest unoccupied orbitals, which governs much of its reactivity and is a common target for learned property prediction.
Here we ask whether raising the node-register particle number , which raises the model’s -WL level, lowers the error on a real task. Between runs we change only ; the embedding, the circuit depth, the readout head, and the optimiser are held fixed.
The test error decreases as increases: eV at , eV at , and eV at . The value is a validation estimate and the other two are test errors. The parameter count changes little across the sweep, from to , so the improvement follows from the added node-register resolution rather than from a larger model.
A classical message-passing network reaches a lower error of eV on the same task, but with about more parameters ( against roughly ). The relevant observation is that the same particle number that raises the Weisfeiler–Leman level on synthetic graphs also reduces the chemical-property error on a real dataset, at near-constant parameter count.
experimentThe Cai–Fürer–Immerman graphs are a direct test of the -WL ascent: pairs of non-isomorphic graphs built so that 1-WL, and every message-passing network with it, cannot tell them apart, so separating a pair requires going beyond 1-WL. We use two families, CFI() on vertices, separable at , and CFI() on vertices, separable at .
We train the model end to end as a binary classifier on random relabellings of each graph, so success requires a permutation-invariant rule rather than memorised vertex labels. On both families the test accuracy jumps from chance to exactly at the predicted particle number, for CFI() and for CFI(), and stays at chance below it. A 1-WL graph isomorphism network (GIN) stays at chance on both families, while a 3-WL network (PPGN) separates both, which places the model’s distinguishing power at the level the ascent predicts.
The nodes of a graph carry no intrinsic order, and relabelling them yields the same graph. The model must therefore commute with relabelling: permuting the input nodes permutes the output node and edge features in the same way. Building this symmetry into the architecture, rather than learning it from data, excludes functions that disagree under relabelling, which lowers sample complexity and improves generalisation from limited data.
The standard route to permutation symmetry in quantum graph models ties parameters across the symmetric group, for example a fixed number of angles per layer independent of graph size, which contracts the function class more than the symmetry requires and costs expressivity within the equivariant subspace. The architecture here takes a different route, obtaining exact equivariance from the two-register structure with no parameters tied. The adjacency block and the mixer order their gates by a canonical ordering fixed by the graph’s edge weights rather than by the node labels, and the trainable evolution acts identically on every node’s embedding register, so a relabelling reorders the same gates without changing their combined action, at every parameter value.
We measure the effect on TSP-5 edge prediction. The model scores each edge for membership in the optimal tour, graded by validation loss (lower is better). The equivariant model is compared against a matched-parameter variant that replaces the canonical edge ordering with a fixed-lexicographic one and is otherwise identical. The equivariant model attains a lower validation loss at every training-set size, by , , and at , , and (three seeds each); at it reaches against . The direction is that expected from a smaller hypothesis class.
Two properties determine whether the framework scales: training must retain a usable gradient as the model grows, and the trained model must admit a cheap readout. Both rest on the same particle-number-preserving Givens gates, and we establish them numerically.
Trainability. A subspace-preserving circuit is expected to avoid the barren plateau, and the measurements confirm this. We measure the per-parameter gradient variance at random initialisation across a range of graph and embedding sizes. At fixed the variance is flat in , and across the three operating points it remains well above the exponential decay characteristic of a barren plateau, following an inverse-polynomial trend out to qubits.
Transferred initialisation improves the signal further. Because the trainable weights act on the embedding register, whose size does not grow with the graph, parameters fitted on a small instance can initialise a larger one. Transferring from a single TSP-5-trained model keeps the gradient one to two orders of magnitude above a random start across sizes, which supports a train-small, deploy-large procedure. Chaining the transfer step by step from to performs less well, and is shown for comparison.
Reaching these sizes in classical simulation is itself demanding. The subspace constraint gives only a polynomial overhead, yet the cost grows steeply with the graph. On our cluster a single configuration takes roughly five minutes at (26 qubits), about a day at (36 qubits), and weeks at (56 qubits). We pushed the simulations to the largest sizes the cluster allowed, in order to follow the trend; a structured subspace does not make a large instance cheap to simulate.
| graph size | qubits (N+D) | classical simulation |
|---|---|---|
| N = 20 | 26 | ~5 minutes |
| N = 30 | 36 | ~1 day |
| N = 50 | 56 | ~weeks |
Readout. Deployment requires a feature that is inexpensive to measure. That feature is the embedding-register one-particle reduced density matrix , a matrix per node, with trace and eigenvalues in . It is read in two steps: projecting the node register onto a single node, then measuring the embedding register of the conditional state. The matrix is estimable to accuracy in shots, either by a deterministic Hartree–Fock readout or by a matchgate shadow. The cost is set by the -qubit feature register, so it is polynomial in rather than the of full tomography, and it does not grow with the number of nodes. The choice of readout shows up on the task: a computational-basis readout recovers only the diagonal of and stalls at tour ratio on the travelling-salesman task, while the Hartree–Fock and matchgate-shadow readouts recover the full matrix and reach at the same shot budget. This readout is intended for hardware deployment; it is defined and benchmarked here, and not run on hardware in this work.
codeThe loader writes the graph into the circuit. It is a controlled-Givens particle-number encoder: each city’s coordinate embedding is placed into a fixed-particle-number subspace and retained there, and it is re-uploaded at every layer, so that later layers act on a richer function of the coordinates. We provide two back-ends for the same map: a PennyLane circuit defined gate by gate, and a vectorised PyTorch implementation that performs the same algebra without constructing a state vector.
Each register block encodes data into the weight- subspace with . At
that subspace has basis states, so the loader needs
exactly Givens rotations to traverse them. The traversal follows an Ehrlich
Gray sequence: consecutive basis strings differ in exactly two bit positions, so a
single qml.SingleExcitation rotates between them.
def hierarchical_loader_ops_batched(bottom_weights, top_data, n, D, is_initial_load=True):
k_top = D // 2
# --- bottom register: unary city index in the HW=1 subspace ---
bottom_strings, bottom_path = get_ehrlich_paths(n, 1)
bottom_angles = generate_angles(preprocess_data(bottom_weights, n))
if is_initial_load: # HW-init X gate ONLY on the first layer
qml.X(n - 1)
for idx, (tgt, _) in enumerate(bottom_path):
qml.SingleExcitation(bottom_angles[idx], wires=[tgt[0], tgt[1]])
# --- top register: embedding in the HW=k subspace, controlled on the city ---
_, top_path = get_ehrlich_paths(D, k_top)
for i, bottom_string in enumerate(bottom_strings):
ctrl = bottom_string.find('1') # which city this branch encodes
angles = generate_angles(preprocess_data(top_data[i], comb(D, k_top)))
if is_initial_load: # set HW=k, once
for j in range(k_top):
qml.ctrl(qml.X(n + D - 1 - j), control=ctrl)
for idx, (tgt, c) in enumerate(top_path):
qml.ctrl(qml.SingleExcitation(angles[idx], wires=[n+tgt[0], n+tgt[1]]),
[ctrl, *[n+x for x in c]])Two features of this construction are essential. First, SingleExcitation is a
particle-number-conserving rotation: and mix, and
are fixed, so the Hamming weight is unchanged. Second, is_initial_load
gates the X gates, which run on the first layer to prepare the subspace and are
skipped on every re-upload, since the state is already in the subspace.
HierarchicalLoader precomputes, for each Ehrlich gate, the index pair it
acts on, then applies every rotation as gather / rotate / scatter on a
tensor. The cities and the embedding amplitudes are separate axes, so no
vector is allocated.
for gate_idx in range(num_gates):
idx_i, idx_j = basis.gate_indices_i[gate_idx], basis.gate_indices_j[gate_idx]
theta = angles[:, :, gate_idx] # [B, N]
c, s = torch.cos(theta/2).unsqueeze(-1), torch.sin(theta/2).unsqueeze(-1)
vi, vj = X[:, :, idx_i], X[:, :, idx_j] # gather the two amplitudes
X = X.scatter(2, idx_i_exp, c*vi - s*vj) # rotate, write back; no .clone()
X = X.scatter(2, idx_j_exp, s*vi + c*vj)A Givens rotation that mixes only equal-weight basis states cannot leak amplitude out of the subspace, so a norm check on the reconstructed state confirms the invariant: at , , an initial load followed by a re-upload keeps the total Hamming weight fixed, with a double-precision residual at machine epsilon.
codeThree further blocks turn the loaded state into a graph-aware prediction. Each reuses the loader’s pattern, gathering a few amplitudes by precomputed index, rotating them in a plane, and scattering them back. Each is described briefly, with the code that implements it.
Equivariant adjacency, . The graph enters as Givens rotations on node-qubit pairs. A rotation between qubits and couples the node subsets that differ by exchanging for , which is one round of -WL refinement on the state. The ordering of these rotations is essential, since rotations in different planes do not commute and the order changes the result. If the layer ordered edges lexicographically by qubit index, relabelling the nodes would reorder the gates and change the circuit’s output, breaking equivariance. The layer instead sorts edges by a key derived from the edge weights (descending in weight, lexicographic only to break ties). Under a relabelling of the nodes the same gates are applied in the same order, so the output is the relabelled output of the original.
# EquivariantAdjacencyLayer.forward (condensed)
sorted_i, sorted_j = self.orient_and_sort_edges(coords) # canonical edge order
angles = self.compute_angles(coords, sorted_i, sorted_j) # per-edge MLP, tanh*pi/2
for e in range(self.num_edges):
i, j, th = sorted_i[:, e], sorted_j[:, e], angles[:, e]
c, s = torch.cos(th/2)[:, None], torch.sin(th/2)[:, None]
Xi, Xj = X[arange, i], X[arange, j] # gather two node rows
X = X.scatter(1, i_exp, (c*Xi - s*Xj)[:, None]) # rotate, functional scatter
X = X.scatter(1, j_exp, (s*Xi + c*Xj)[:, None])Trainable evolution, . This block updates the features and acts on the embedding register only, so it is independent of the node labels. Each block is a single rotation , built from a skew-symmetric matrix by the Cayley map . On the weight- subspace it acts as a orthogonal transform built from the minors of , a compound representation. Thus parameters drive the full map: at , parameters drive a transform.
O = cayley(build_skew(self.skew_params)) # SO(D), D(D-1)/2 params
C = compound(O, k) # C(D,k) x C(D,k), minors of O
return X @ C.T # apply to weight-k stateThis restriction is deliberate. At the block generates , of dimension , whereas an unconstrained layer on the same -dimensional subspace would reach , of dimension . We retain the smaller algebra: it is less expressive, but its gradients are substantially larger, which preserves trainability as the model grows.
Readout, the 1-RDM. The feature read out for hardware is the one-body reduced density matrix , a matrix per node, with trace and eigenvalues in . It can be estimated from a Hartree–Fock state or a matchgate shadow in shots, polynomial in rather than the of full tomography. It is defined and benchmarked here, and not run on hardware in this work.
# embedding-register 1-RDM per node, gamma[p,q] = <psi| a_p^dag a_q |psi>
# deterministic Hartree-Fock / matchgate-shadow readout (see matchgate_shadows.py)
gamma = CovarianceComputer(D, k).compute(psi) # D x D, trace = k, eigvals in [0,1]
node_feats = gamma.reshape(B, N, D * D) # per-node feature for the readout MLPdiscussionThe framework adapts the structure and theoretical guarantees of graph neural networks from the classical literature to quantum circuits. It represents and processes graphs in a similar way, and recovers the properties that the classical literature identifies as the ones a graph neural network should have: message passing, in which each node gathers information from its neighbours and updates its state; permutation equivariance, in which relabelling the nodes relabels the output the same way; and Weisfeiler–Leman expressivity, the standard measure of how finely a model distinguishes graphs.
We give several constructions, based on subspace-preserving gates, that prove these properties hold for a quantum graph network. The circuit performs message passing within the quantum state: the adjacency layer routes node amplitudes along the edges, the trainable evolution updates the per-node features, and re-uploading the graph at each layer makes the map nonlinear, with one circuit iteration corresponding to one round of set-based refinement. The construction is exactly permutation equivariant at every value of the parameters, without tying or sharing weights, which is how earlier equivariant models impose the symmetry. To our knowledge it is the first quantum graph model proven to exceed the 1-WL ceiling, and the same approach can be carried to other subspace-preserving architectures.
We validated these properties numerically on three datasets, two of them with real-world applications, with good results on large models of up to 56 qubits. On the Cai–Fürer–Immerman graphs, constructed so that no 1-WL network can separate them, the model distinguished the pairs at exactly the level the ascent predicts. On QM9, where the task is to predict the HOMO–LUMO gap, the error decreased as we raised the particle number at a fixed parameter budget. On the Euclidean travelling salesman problem, the model produced near-optimal tours up to the largest instances we were able to simulate. Together with the theoretical motivation, these results show how the framework can provide quantum methods that scale beyond small proofs of concept.
Finally, the approach is motivated by its scalability. Across every configuration we trained, the per-parameter gradient did not vanish as the subspace dimension grew. The barren-plateau results in the literature characterise broad families of variational circuits, typically generic or randomly initialised ansätze; our model is not of that kind, since its graph information enters through a fixed initialisation and its trainable dynamics stay within a small structured register. The trainability we observe therefore sits alongside those results rather than against them: the general theory bounds what happens across a class, but it does not settle what a specific, structured instantiation does in practice, and the favourable behaviour we find is of that practical kind. The graph-style pre-training used here, where parameters fitted on small instances seed larger ones, is one way to preserve this behaviour as the graph grows, and it invites a theoretical treatment aimed at structured, pre-trained circuits rather than generic ones.
references@article{raj2026qgnn,
title = {Scalable Message-Passing Quantum Graph Neural Networks in the
Weisfeiler--Leman Hierarchy},
author = {Raj, Snehal and Coyle, Brian and Monbroussou, L{\'e}o and
Ferreira-Martins, Andr{\'e} J. and Farias, Renato M. S. and
Kashefi, Elham},
year = {2026},
eprint = {2606.26873},
archivePrefix = {arXiv},
primaryClass = {quant-ph}
}The travelling-salesman instances are taken from the equivariant quantum circuit benchmark of Skolik et al. QM9 is loaded from the standard PyTorch Geometric distribution. The CFI families are generated programmatically from the Cai–Fürer–Immerman construction, and the BREC pairs are taken from the BREC benchmark. The framework (a vectorised PyTorch back-end for and a PennyLane reference for ) and the readout protocols are released under the MIT licence at github.com/SnehalRaj/mp-qgnns, with scripts to reproduce each reported result.