TL;DR
Polynormer is a novel Graph Transformer (GT) architecture that achieves linear complexity ($O(N)$) while maintaining high expressivity by explicitly learning high-degree polynomials of input features. By using attention scores to control polynomial coefficients, it bridges the performance gap between scalable linear transformers and powerful message-passing GNNs, outperforming both on datasets with millions of nodes.
The Trade-off: Expressivity vs. Scalability
Graph Neural Networks (GNNs) are the standard for graph data but often suffer from "over-smoothing" (features becoming indistinguishable) and "over-squashing" (information bottlenecks). Graph Transformers (GTs) solve this by allowing every node to attend to every other node, capturing long-range dependencies effectively. However, they typically have quadratic complexity ($O(N^2)$), making them unusable for large-scale graphs.
While "Linear Transformers" exist, they often perform worse than standard GNNs in practice. This creates a tension between expressivity (how complex a function the model can learn) and scalability (how large a graph it can handle). Polynormer aims to break this trade-off by leveraging the mathematical power of polynomials.
Methods: The Polynomial-Expressive Base Model
The core innovation of Polynormer is its Polynomial-Expressive Base Model. Instead of standard attention mechanisms, it uses a recursive Hadamard (element-wise) product:
$$X^{(l)} = (W^{(l)}X^{(l-1)}) \odot (X^{(l-1)} + B^{(l)})$$
This structure ensures that an $L$-layer model can represent a polynomial of degree $2^L$.
To make this work on graphs while remaining efficient and permutation equivariant, the authors introduce a specialized architecture:
- Equivariant Local Attention: This uses sparse attention (similar to Graph Attention Networks) to incorporate graph topology, ensuring the model respects local neighborhood structures.
- Equivariant Global Attention: To capture long-range dependencies, they use a "kernel trick" to linearize global attention. Crucially, they use a Sigmoid function rather than ReLU to ensure training stability on massive graphs, preventing numerical overflow.
- Local-to-Global Scheme: Unlike previous models that process local and global information in parallel, Polynormer stacks local layers followed by global layers. This sequential approach prevents "noisy" non-local interactions from interfering with local feature learning early in the network.
Key Insights and Ideas
- Polynomials as Universal Approximators: Motivated by the Weierstrass approximation theorem, the authors argue that learning high-degree polynomials is a robust way to approximate any smooth function on a graph.
- Attention as Coefficients: In Polynormer, attention scores aren't just weights for a weighted sum; they act as the coefficients of the learned polynomial, giving the model a much finer-grained control over feature interactions.
- The Stability of Sigmoid: A major practical discovery is that standard linear attention (like cosFormer) often fails on large graphs due to ReLU-based denominators exploding. Switching to Sigmoid maps features to a $(0, 1)$ range, ensuring the model can scale to millions of nodes without $NaN$ losses.
- Non-linearity is Optional: Remarkably, the polynomial structure is so expressive that Polynormer outperforms many state-of-the-art models even without non-linear activation functions like ReLU.
Datasets and Key Results
The model was rigorously tested on 13 datasets covering different graph properties, including homophilic graphs (where similar nodes connect), heterophilic graphs (where dissimilar nodes connect), and large-scale benchmarks like ogbn-products (2.4M nodes) and pokec (1.6M nodes).
- Superior Accuracy: Polynormer outperformed 22 competitive GNN and GT baselines on most datasets. For example, it achieved a 1.65% accuracy gain on the "Computer" dataset over finely-tuned SOTA models.
- Heterophily Champ: It showed significant gains on heterophilic datasets (e.g., +3.55% on minesweeper), where capturing global context is often more critical than local neighborhood averaging.
- Linear Scaling & Efficiency: Empirical profiling confirmed that memory usage grows linearly with the number of nodes. On large graphs where quadratic GTs would crash due to Out of Memory errors, Polynormer runs efficiently. In training time benchmarks, it consistently ranked among the top 3 fastest models.
Limitations and Future Work
While highly effective, Polynormer has room for expansion. The authors primarily used GAT for the local module; exploring other sparse attention mechanisms or more advanced structural encodings could further boost performance. Additionally, the polynomial degree is currently tied to the number of layers ($2^L$). Future iterations might explore ways to adaptively learn the required polynomial degree for different parts of a graph. Finally, a deeper theoretical analysis of its place in the Weisfeiler-Lehman hierarchy compared to other high-order GNNs remains an open area for exploration.
Summary updated