---
title: 'CTQWformer: Quantum Walk Transformer'
url: https://www.emergentmind.com/topics/ctqwformer
type: topic
---

# CTQWformer: Quantum Walk Transformer

Searching arXiv for the CTQWformer paper and closely related references to ground the article.
Search query: CTQWformer continuous-time quantum walks transformer graph classification arXiv 2605.09486
CTQWformer is a graph classification architecture that combines continuous-time quantum walks (CTQW) with Transformer and recurrent neural components in an end-to-end trainable framework. It is defined for a dataset of graphs $\mathcal{G}=\{G_1,\dots,G_N\}$, where each $G_i=(V_i,E_i)$ has node features $X_i\in\mathbb{R}^{n_i\times d}$ and graph label $y_i$, and the learning objective is to map each graph $G_i$ to its label $y_i$. The model is motivated by the observation that message-passing GNNs are inherently local and that Graph Transformers, while global, often rely on simple structural encodings and usually treat graph structure statically. CTQWformer addresses both issues by making CTQW trainable and feature-aware, then using CTQW-derived signals both as a static structural bias for self-attention and as a dynamic temporal signal for recurrent modeling [2605.09486].

## 1. Problem setting and conceptual motivation

CTQWformer is situated in graph representation learning, specifically in supervised graph classification. The stated motivation is that existing methods have complementary but incomplete strengths. Message-passing GNNs can aggregate local neighborhood information, but increasing depth to capture long-range dependencies causes over-smoothing and optimization issues. Graph Transformers provide global attention, but they often encode structure only via simple positional or structural encodings, tend to emphasize feature similarity in attention while underusing richer structural priors, and usually lack a principled mechanism for modeling dynamic propagation on graphs [2605.09486].

Continuous-time quantum walks supply the missing inductive bias. In the formulation used by CTQWformer, CTQW is a physically grounded dynamic process governed by the Schrödinger equation, with constructive and destructive interference patterns that encode both local and global structure. This gives a natural mechanism for nonlocal propagation beyond small neighborhoods. The framework therefore aims to make CTQW trainable and feature-aware through a learnable Hamiltonian, then to deploy the resulting quantum-walk statistics in two complementary ways: final-time propagation probabilities become structural biases in a Graph Transformer, while time-evolving probabilities become sequential inputs for a recurrent module [2605.09486].

The paper explicitly frames these design choices as a hybridization of quantum dynamics with deep graph learning. It also states that CTQWformer is, to the authors’ knowledge, the first hybrid CTQW-based Transformer integrating CTQW-derived structural bias with temporal evolution modeling for graph learning [2605.09486].

## 2. Continuous-time quantum walk foundations and the trainable Hamiltonian

For a graph $G=(V,E)$ with $n=|V|$, the Hilbert space is
$$
\mathcal{H}=\mathrm{span}\{|1\rangle,|2\rangle,\dots,|n\rangle\},
$$
where $|i\rangle$ corresponds to node $i$. A quantum state at time $t$ is written as
$$
|\psi(t)\rangle=\sum_{v\in V}\alpha_v(t)|v\rangle,
$$
with normalization
$$
\sum_{v\in V}\alpha_v(t)\,\alpha_v^*(t)=1.
$$
Its evolution is governed by
$$
i\frac{d}{dt}|\psi(t)\rangle=H|\psi(t)\rangle,
$$
with solution
$$
|\psi(t)\rangle=U(t)|\psi(0)\rangle=e^{-iHt}|\psi(0)\rangle.
$$
The probability of finding the walker at node $i$ at time $t$ is
$$
p_i(t)=|\langle i|\psi(t)\rangle|^2.
$$
CTQWformer departs from classical CTQW choices such as the adjacency matrix $A$ or Laplacian $L=D-A$ by learning a feature-aware Laplacian Hamiltonian $H_\theta$ [2605.09486].

The construction begins at the edge level. For each edge $(i,j)\in E$, node features are concatenated:
$$
e_{ij}=[x_i\|\;x_j]\in\mathbb{R}^{2d}.
$$
An edge-weight MLP then defines
$$
W_{ij}=\sigma\big(W_2\cdot \phi(W_1 e_{ij})\big),
$$
where $\phi(\cdot)$ is ReLU and $\sigma(\cdot)$ is sigmoid, ensuring $W_{ij}\in(0,1)$. These weights form a weighted adjacency matrix $W_\theta$. To guarantee Hermiticity, CTQWformer symmetrizes the matrix as
$$
A_{\mathrm{sym}}=\frac{1}{2}(W_\theta+W_\theta^\top),
$$
and defines the Hamiltonian as the Laplacian
$$
H_\theta=D'-A_{\mathrm{sym}},
$$
where $D'$ is the degree matrix of $A_{\mathrm{sym}}$ with $D'_{ii}=\sum_j (A_{\mathrm{sym}})_{ij}$ [2605.09486].

This construction has three explicit properties. First, $H_\theta$ is Hermitian, which guarantees unitary evolution $U(t)=e^{-iH_\theta t}$. Second, it is trainable, because the parameters in the edge MLPs and the initial node embedding MLP are learned jointly with the rest of the architecture. Third, it is feature-aware, because node attributes directly modulate the effective graph operator. A plausible implication is that the induced CTQW dynamics need not coincide with purely topological propagation, but can instead encode task-relevant structural variation conditioned on attributes.

## 3. Architecture and data flow

CTQWformer consists of three core components: a Quantum Walk Encoder (QWE), a Quantum Walk–Graph Transformer (QWGT), and a Quantum Walk–Graph Recurrent module (QWGR). The QWE builds the trainable Hamiltonian and simulates CTQW over multiple time steps; the QWGT injects final-time CTQW propagation probabilities into self-attention as structural bias; the QWGR models temporal evolution patterns from CTQW-derived sequences with a BiGRU [2605.09486].

| Component | Input | Function |
|---|---|---|
| QWE | Graph $G=(V,E)$, node features $X$ | Builds $H_\theta$ and produces $P\in\mathbb{R}^{T\times n\times n}$ |
| QWGT | Node embeddings, $P^T=P(T)$ | Adds CTQW structural bias to Transformer attention |
| QWGR | Time series derived from $P$ | Encodes temporal evolution with a BiGRU |

The forward pipeline is specified step by step. The input graph and node features are first passed to the QWE, which constructs $H_\theta$. For time steps $t=1,\dots,T$, it computes the unitary
$$
U(t)=e^{-iH_\theta t},
$$
derives the corresponding probability matrices $P(t)$, and stacks them into an evolution tensor
$$
P=\{P(t)\}_{t=1}^T\in\mathbb{R}^{T\times n\times n}.
$$
The QWGT uses the final-time matrix $P^T=P(T)$ to build a bias matrix $B$ for attention. The QWGR extracts node-specific sequences from the diagonal of $P(t)$ over time and processes them with a bidirectional GRU. The outputs of QWGT and QWGR are concatenated in a fusion layer, passed through a fusion MLP, and the resulting graph-level representation is broadcast back to nodes. Several CTQWformer layers are stacked. Final node embeddings are then globally mean pooled and sent to a classifier to predict the graph label [2605.09486].

The layerwise design is notable because it couples node-level refinement with graph-level fusion. This suggests that the model does not merely append an auxiliary CTQW statistic to a standard architecture, but instead uses CTQW information to mediate iterative interaction between structural bias, dynamic evolution, and learned node embeddings.

## 4. CTQW-derived representations: static bias and temporal evolution

The QWE simulates CTQW for multiple initial states and multiple times. Initial states are all basis states, encoded as the columns of the identity matrix $I_n$, so the $i$-th column is the delta state $|i\rangle$ concentrated at node $i$. For each time $t$, the evolved state from initial state $|i\rangle$ is
$$
|\psi_i(t)\rangle=U(t)|i\rangle,
$$
and the node-wise propagation probabilities are
$$
p_{ij}(t)=|\langle j|\psi_i(t)\rangle|^2=|(U(t))_{ji}|^2.
$$
For a fixed $t$, this yields a probability matrix $P(t)\in\mathbb{R}^{n\times n}$. Across all $T$ time steps, these form the evolution tensor $P\in\mathbb{R}^{T\times n\times n}$, which encodes both static connectivity and dynamic patterns such as oscillations and interference [2605.09486].

The QWGT uses only the final-time CTQW matrix. It first takes
$$
P^T=P(T)\in\mathbb{R}^{n\times n},
$$
normalizes each column to make it stochastic, and applies the element-wise transform
$$
B=\log(1+P^T).
$$
This matrix $B$ is the structural bias. Standard self-attention is
$$
\mathrm{Attention}(Q,K,V)=\mathrm{softmax}\left(\frac{QK^\top}{\sqrt{d}}\right)V,
$$
where $Q,K,V\in\mathbb{R}^{n\times d}$ are obtained from node representations. In QWGT, attention scores are modified by $B$ before softmax. The paper notes a minor typesetting issue in the printed formula and states that the intended operation is to add $B$ to the score matrix before softmax. Here, $B_{ij}$ reflects how strongly a walker starting at node $j$ ends at node $i$ at final time $T$. The result is that attention is biased toward node pairs with strong CTQW connectivity, thereby fusing feature similarity through $QK^\top$ with physically grounded structural relations through $B$ [2605.09486].

The QWGR captures the dynamic side. For each node $i$, it extracts the diagonal sequence
$$
s_i=[P(1)[i,i],P(2)[i,i],\dots,P(T)[i,i]],
$$
which represents the probability that a walker starting at node $i$ is again at node $i$ at each time step. This self-return sequence is first linearly projected and then fed into a bidirectional GRU:
$$
H_{\mathrm{GRU}}=\mathrm{BiGRU}(\mathrm{Linear}(P_i)),
$$
followed by
$$
O_{\mathrm{QWGR}}=\mathrm{FFN}\big(\mathrm{MeanPool}(H_{\mathrm{GRU}})\big).
$$
In the diagonal-signal interpretation, the BiGRU captures forward and backward temporal dependencies in oscillatory CTQW behavior, and mean pooling over nodes yields a graph-level dynamic representation [2605.09486].

The distinction between static and dynamic CTQW features is central. QWGT uses a single final-time slice as a structural prior for attention, whereas QWGR uses the time series itself as a dynamical signature. The ablation results later reported in the paper indicate that temporal modeling is the more decisive component.

## 5. Training, computational profile, and benchmark results

At each CTQWformer layer $l$, the model starts from node embeddings $H^{(l-1)}$, computes a graph-level representation from QWGT, computes another graph-level representation from QWGR, concatenates them, and passes the result through a feed-forward fusion network to obtain a unified graph representation. This representation is then broadcast back to nodes to form $H^{(l)}$. After $L$ layers, global mean pooling produces a graph vector $h$, which is passed through a classifier MLP to produce logits $\hat{y}$. Training uses standard cross-entropy loss,
$$
\mathcal{L}=-\sum_i\sum_c \mathbf{1}[y_i=c]\log p_\theta(y_i=c\mid G_i),
$$
and all parameters, including the Hamiltonian-generating MLPs, Transformer, BiGRU, and classifier, are learned jointly via backpropagation through differentiable matrix exponentials. The paper does not introduce explicit extra regularization terms on $H_\theta$ beyond structural constraints such as symmetry and sigmoid-bounded weights [2605.09486].

The dominant computational burden is CTQW simulation. Constructing the Hamiltonian costs $O(Edh+n^2)$ time and $O(n^2)$ memory. Computing $U(t)=e^{-iH_\theta t}$ typically costs $O(n^3)$, so over $T$ time steps the QWE requires $O(Tn^3)$ time and $O(Tn^2)$ space for the evolution tensor. The Transformer component contributes $O(BL(n^2h+nh^2))$ time and $O(BL(H_{\text{head}}n^2+nh))$ space, while QWGR contributes $O(B(Tnh+nh^2))$ time and $O(BTn+Bnh)$ space. The overall complexity is summarized as
$$
O(Tn^3)+L\cdot O(Bn^2h+Bnh^2)+O(BnTh),
$$
with memory
$$
O(Tn^2)+O(BLH_{\text{head}}n^2)+O(Bnh).
$$
The paper states that for moderate or large graphs the CTQW term $O(Tn^3)$ dominates, and that no special approximation for $e^{-iHt}$ is assumed in the analysis [2605.09486].

The experimental setup uses TU benchmark datasets: MUTAG, PTC(MR), PROTEINS, DD, IMDB-B, and IMDB-M. For IMDB-B and IMDB-M, which have no original node features, normalized log-degree is used as the feature; for the other datasets, normalized log-degree is appended to existing features. Training uses 10-fold cross-validation, typically $L=2$ CTQWformer layers, $T=4$ time steps, hidden dimension $h=64$, dropout $0.3$, Adam with learning rate $0.001$, and 300 epochs with early stopping. Hyperparameters are slightly tuned per dataset, especially $L$ and $T$ [2605.09486].

Against graph kernels, CTQWformer achieves the best performance on 5 of 6 datasets. The reported accuracies are $92.54\pm5.39$ on MUTAG, $69.16\pm5.17$ on PTC(MR), $78.53\pm2.34$ on PROTEINS, $81.24\pm3.43$ on DD, $76.40\pm1.91$ on IMDB-B, and $47.47\pm7.84$ on IMDB-M. The only dataset where a listed kernel is higher is IMDB-M, where HAQJSK reaches $50.08\pm0.20$ [2605.09486].

Against GNN and Graph Transformer baselines, the picture is mixed but favorable overall. CTQWformer is highest on MUTAG, DD, and IMDB-B; on PTC(MR) it is essentially tied with GRIT, which reports $69.18\pm6.22$ versus CTQWformer’s $69.16\pm5.17$; on PROTEINS it is slightly below Graphormer, which reports $78.98\pm2.55$ versus $78.53\pm2.34$; and on IMDB-M it is below GraphGPS and GCN. The paper characterizes the model as competitive or superior to strong GNN and graph Transformer baselines, especially on bioinformatics datasets and IMDB-B [2605.09486].

Ablation studies on MUTAG, PTC(MR), and PROTEINS show that removing QWGR causes the largest drop: on MUTAG performance falls from $92.54\pm5.39$ to $74.97\pm7.17$, on PTC(MR) from $69.16\pm5.17$ to $57.87\pm3.25$, and on PROTEINS from $78.53\pm2.34$ to $69.00\pm5.49$. Removing QWGT also reduces performance, but less severely. The reported interpretation is that temporal modeling of CTQW evolution is crucial, while CTQW-based structural bias is beneficial but less dominant than temporal patterns. Hyperparameter sensitivity studies further indicate that moderate $T$ and shallow depth work best: on MUTAG accuracy peaks at $T=4$ and $L=2$, while deeper settings tend to reduce performance, likely because of overfitting or over-smoothing [2605.09486].

## 6. Interpretation, limitations, relation to prior work, and terminological ambiguity

The paper’s interpretive claim is that CTQW dynamics encode how probability amplitude propagates globally under interference, thereby revealing multi-path connectivity, spectral properties of the Laplacian-based Hamiltonian, and both local neighborhoods at early times and global structures at later times. Within CTQWformer, the static and dynamic pathways are separated analytically: QWGT uses a final-time bias matrix $B$ that can be viewed as a physically meaningful connectivity prior, while QWGR models node-level temporal oscillations through self-return dynamics. The reported ablations indicate that the temporal component contributes more strongly to classification accuracy, which suggests that the dynamic signature of CTQW contains discriminative information not recoverable from a single structural snapshot [2605.09486].

The architecture also has an interpretability argument. Since CTQW propagation probabilities $P(t)$ are explicit, high values of $P(t)[i,j]$ indicate strong dynamic connectivity at time $t$, and diagonal sequences $P(t)[i,i]$ indicate how “central” or “trapped” a node is across time. The paper does not include visual case studies, but it presents these quantities as inherently interpretable physically meaningful diffusion patterns [2605.09486].

The principal limitations are also explicit. Scalability is constrained by dense CTQW simulation, since the dominant term is $O(Tn^3)$. Performance is sensitive to the number of time steps $T$ and layers $L$, and too-large values can degrade accuracy. The trainable Hamiltonian also depends heavily on node features, and the paper suggests that this contributes to weaker performance on feature-poor datasets such as IMDB-M. Future directions proposed by the authors include more efficient approximations of $e^{-iHt}$, exploiting sparsity or low-rank structure of $H_\theta$, richer integrations of quantum walk dynamics into GNNs and Transformers, and extending the framework to node classification, link prediction, and dynamic or temporal graphs [2605.09486].

In relation to prior work, CTQWformer is positioned against two families. The first is quantum-inspired graph learning based on fixed CTQW kernels such as JTQK, QJSK, HAQJSK, and AERK, which use non-trainable similarity measures or separate quantum components. The second is graph Transformer work such as Graphormer, GraphGPS, and GRIT, which encode structure through shortest paths, centrality, random-walk distributions, or related priors. CTQWformer’s novelty claims are threefold: a trainable Hamiltonian $H_\theta$ that combines topology and features, a hybrid CTQW-based Transformer in which final-time probabilities bias attention and temporal evolution is modeled by a BiGRU, and an end-to-end architecture that jointly learns CTQW dynamics and task-specific graph representations [2605.09486].

A possible source of confusion is the term itself. Another paper, on the “convolutional transformer wave function (CTWF),” states that “CTQWformer” is not a term used in that work, but a natural label for a Convolutional Transformer Quantum Wavefunction. That usage refers to a neural quantum state architecture for lattice quantum many-body problems rather than to the CTQW-based graph-classification model described above [2503.10462]. The overlap is therefore terminological rather than methodological. In current arXiv usage represented by these two papers, CTQWformer properly denotes the CTQW-based Transformer for graph classification, while CTWF denotes the convolutional transformer wave function model for variational quantum Monte Carlo and time-dependent variational simulations [2605.09486].

Source: https://www.emergentmind.com/topics/ctqwformer