NearFormer: Linear-Size Sparse Attention via Randomized Near Neighbors
Ali Parviz, Alex Cloninger, Gal Mishne
Key points
From the paper's conclusion- We use these edges as sparse global-attention supports, with optional learned attention biases, while preserving the original graph for local message passing.
Abstract
Graph transformers can capture long-range interactions, but their quadratic attention cost limits their use on large graphs. We introduce \emph{NearFormer}, a graph transformer whose global attention is restricted to a randomized near-neighbor (NN) graph. NearFormer uses an efficient randomized construction to connect each node to a small number of near neighbors from a broader neighborhood defined by a label-independent feature or spectral geometry. For a fixed retained budget \(k\), the resulting attention support has linear size \(\mathcal{O}(|E|+nk)\). The NN graph is built once by within-bin search and then held fixed. We use these edges as sparse global-attention supports, with optional learned attention biases, while preserving the original graph for local message passing. Experiments on long-range graph benchmarks and synthetic structural tasks show that NearFormer provides a favorable accuracy--scalability trade-off relative to local message passing, dense and sparse attention.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Near-Far Attention: Region-Aware Sparse Retrieval for Long-Context LLM DecodingarXiv · 2026
- Adaptive Depth Aggregation in Graph Transformers for Long-Range Graph ReasoningarXiv · 2026
- Looped GNNs Beyond Fixed Depth: Graph Size Generalization and Parameter-Efficient AdaptationarXiv · 2026
- Learning Functional Subspaces for Neural Network CompressionarXiv · 2026
- ClusterAttention: A training-free speedup of bidirectional attentionarXiv · 2026
- Not All Dimensions Are Equal: Outlier-Aware Attention Linearization with Grouped Quadratic KernelsarXiv · 2026