Introduction
Spectral Graph Neural Networks (GNNs) have long been favored for their ability to capture complex patterns in the frequency domain. However, a significant limitation persists: most spectral models employ node-unified filters, applying the same polynomial coefficients across the entire graph. This "one-size-fits-all" approach struggles with heterophilic graphs, where neighboring nodes often belong to different classes and require distinct filtering behaviors.
While node-wise filtering methods exist, they typically rely on computationally expensive operations like Laplacian eigendecomposition, which scales at $O(N^3)$. This makes them impractical for large-scale datasets. PolyFormer addresses this gap by introducing a scalable Graph Transformer that learns unique spectral filters for every node without the heavy computational overhead.
The PolyFormer Architecture
The core innovation of PolyFormer is PolyAttn (Polynomial Attention), which shifts the focus from inter-node interactions to intra-node spectral components.
Polynomial Tokens
Instead of treating nodes as tokens, PolyFormer decomposes each node's neighborhood into $K+1$ "polynomial tokens." These tokens represent information across different frequency bands or hops, precomputed using bases such as Monomial, Chebyshev, or Bernstein.
Intra-node Attention
PolyAttn calculates attention within each node across its own set of polynomial tokens. This allows the model to adaptively weight different spectral components for each node individually. By using a tanh activation instead of the standard softmax, PolyFormer can learn both positive and negative coefficients, enabling the representation of arbitrary filter shapes, including high-pass and band-pass filters.
Scalability and Efficiency
Standard Graph Transformers suffer from quadratic complexity relative to the number of nodes ($O(N^2)$). In contrast, PolyFormer's attention mechanism operates on a fixed, small number of tokens ($K+1$) per node. This reduces complexity to $O(N \cdot K^2)$, where $K$ is typically between 10 and 14. This linear scaling allows PolyFormer to handle massive graphs, such as the ogbn-papers100M dataset, which contains over 111 million nodes and 1.6 billion edges.
Experimental Results
PolyFormer was evaluated across a diverse set of benchmarks, including homophilic, heterophilic, and large-scale graphs.
Filter Expressiveness
On synthetic datasets, PolyFormer demonstrated its ability to recover complex ground-truth filters. Unlike models restricted to low-pass filters, PolyFormer successfully learned distinct centroids for low-pass, high-pass, and band-pass signals.
Performance on Real-World Graphs
PolyFormer consistently achieved state-of-the-art results, particularly on heterophilic datasets like Questions and Roman-empire. On the massive ogbn-papers100M benchmark, it reached a test accuracy of 67.11%, outperforming other scalable baselines like SGFormer while maintaining a superior balance of training time and memory efficiency.
Conclusion
PolyFormer represents a significant step forward in spectral GNN design. By rethinking the attention mechanism as an intra-node polynomial weighting process, it achieves the expressiveness of node-wise filtering with the scalability required for real-world, massive-scale graph applications. Its ability to learn diverse filter shapes makes it uniquely suited for the complexities of heterophilic graph data.
Summary updated