Abstract: Designing effective positional encodings for graphs is key to building powerful graph transformers and enhancing message-passing graph neural networks. Although widespread, using Laplacian eigenvectors as positional encodings faces two fundamental challenges: (1) Non-uniqueness: there are many different eigendecompositions of the same Laplacian, and (2) Instability: small perturbations to the Laplacian could result in completely different eigenspaces, leading to unpredictable changes in positional encoding. Despite many attempts to address non-uniqueness, most methods overlook stability, leading to poor generalization on unseen graph structures. We identify the cause of instability to be a “hard partition” of eigenspaces. Hence, we introduce Stable and Expressive Positional Encodings (SPE), an architecture for processing eigenvectors that uses eigenvalues to “softly partition” eigenspaces. SPE is the first architecture that is (1) provably stable, and (2) universally expressive for basis invariant functions whilst respecting all symmetries of eigenvectors. Besides guaranteed stability, we prove that SPE is at least as expressive as existing methods, and highly capable of counting graph structures. Finally, we evaluate the effectiveness of our method on molecular property prediction, and out-of-distribution generalization tasks, finding improved generalization compared to existing positional encoding methods.
Introduction
To provide Graph Neural Networks (GNNs) with structural context, researchers frequently employ the eigenvectors of the graph Laplacian as positional encodings (PE). While this approach has become a standard in Graph Transformers, it is plagued by two significant issues: basis ambiguity and structural instability.
- Non-uniqueness (Basis Ambiguity): Eigenvectors are not unique. Arbitrary sign flips or rotations within eigenspaces (for repeated eigenvalues) can occur without changing the graph. Models must be "basis invariant" to remain robust to these arbitrary choices.
- Instability: This is a more subtle but critical flaw. If two eigenvalues are nearly identical, a minor change in the graph's topology can cause their corresponding eigenvectors to swap or change drastically.
Existing solutions like SignNet or BasisNet address basis ambiguity but fail to ensure stability. They utilize "hard partitioning," treating each eigenspace as a discrete, isolated channel. When eigenvalues shift slightly, these rigid boundaries cause the model's output to diverge, resulting in poor generalization on noisy or unseen graph structures.
The SPE Framework
The proposed Stable and Expressive Positional Encodings (SPE) framework addresses these issues by replacing "hard partitioning" with "soft partitioning" driven by eigenvalues.
As shown in Figure 1, the SPE process involves two main steps:
- Step 1: Equivariant Eigenvalue Processing. Instead of treating eigenvectors independently, SPE uses a learnable, permutation-equivariant function $\phi_\ell(\lambda)$ (such as an MLP or DeepSet) to process the eigenvalues and produce weights.
- Step 2: Spectral Signal Aggregation. The model computes a series of spectral terms: $SPE(V, \lambda) = \rho(V \text{diag}(\phi_1(\lambda))V^\top, \dots, V \text{diag}(\phi_m(\lambda))V^\top)$. Because $\phi$ is continuous, if two eigenvalues converge, their contributions to the sum become identical, preventing the discontinuous "jumps" characteristic of hard-partitioned models.
By ensuring that both $\phi$ and the aggregation network $\rho$ are Lipschitz continuous, the authors prove that the resulting encoding remains stable even under Laplacian perturbations.
Experimental Evaluation
SPE was evaluated across several rigorous benchmarks, including molecular property regression (ZINC, Alchemy) and out-of-distribution (OOD) generalization (DrugOOD).
As detailed in Figure 2, SPE achieves state-of-the-art results on the ZINC dataset with a Test MAE of 0.0693, significantly outperforming unstable alternatives like SignNet (0.0853) and BasisNet (0.1555). Beyond standard benchmarks, SPE demonstrated superior robustness in OOD scenarios. For instance, on the DrugOOD "Scaffold" shift task, SPE maintained a high AUC of 69.64, whereas SignNet's performance dropped to 66.43.
In synthetic tasks, SPE proved highly capable of counting graph substructures (cycles of length 3-6), outperforming previous baselines by orders of magnitude in accuracy. Furthermore, SPE is computationally efficient, avoiding the irregular batching complexities required by methods like BasisNet.
Discussion and Insights
A key takeaway from this work is the Stability-Expressivity Trade-off. While strictly enforcing stability (via lower Lipschitz constants) might slightly limit a model's ability to overfit training data, it dramatically improves generalization on test sets. SPE successfully navigates this trade-off: despite its stability constraints, it is proven to be a universal approximator for any continuous basis-invariant function.
However, some limitations remain. The stability guarantee still depends on the "eigengap" between the included and excluded eigenvalues when using a subset of the spectrum. Additionally, while SPE is more efficient than some specialized architectures, the initial cost of full eigendecomposition remains a challenge for scaling to massive graphs with millions of nodes. Future research may extend this "soft partitioning" logic to other spectral graph learning tasks where stability is currently overlooked.
Summary updated