arXiv:2609.35620cs.LGSep 2026

Manuscript Offprint

arXiv:2609.35620

Attention Graphons: A Graph Limit Perspective on Graph Transformers

Caio F. Deberaldini Netto, Moshe Eliasof, Luana Ruiz

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Graph Transformers produce, for each attention head, a dense n×nn \times n matrix of learned pairwise interactions. We ask a fundamental question: do these attention-induced graphs converge to a stable limit object as n grows, or does the learned interaction pattern remain unstructured and size-dependent? We answer this using dense graph limit theory, treating each attention matrix as a finite sample from an underlying kernel—an attention graphon—and studying concentration around this limit under the cut-distance. We derive a worst-case variance bound requiring no assumptions on the graphon, and a sharper regularity-aware bound based on nonparametric estimation theory. To operationalize the theory, we propose a canonicalize-then-block-average pipeline for estimating dataset-level attention graphons, and a variance-based diagnostic for testing whether attention admits a stable continuum description. Experiments across multiple graph benchmarks show that learned attention stabilizes to dataset-specific graphon structure on several datasets; that empirical cut-distance and cut-norm variance decreases with n consistent with our bounds; and that attention graphons transfer to larger graph sizes with error decreasing in n.

1 INTRODUCTION

Graph Transformers (GTs) (Dwivedi & Bresson, 2021; Ying et al., 2021; Rampášek et al., 2022) adapt the self-attention mechanism of the Transformer architecture (Vaswani et al., 2017) to graph-structured inputs. For an input graph with n nodes, each attention head produces an n×nn \times n matrix of learned pairwise interactions, which can be thought of as a dense weighted graph on the node set. This paper answers a fundamental question:

Do attention-induced graphs converge to a stable limit object as n grows, or does the learned interaction pattern remain unstructured and size-dependent?

This question matters because if attention-induced graphs admit a stable limit, the interaction patterns learned by GTs can be compressed into a single, dataset-level low-dimensional object that simultaneously encodes inductive bias, supports size-agnostic comparison across graphs, and provides a theoretical basis for transferability across graph sizes.

We study these questions using dense graph limit theory. For dense graphs, convergent sequences admit limit objects given by graphons—symmetric measurable kernels on [0,1]2[0, 1]^{2}—where convergence is characterized by the alignment of subgraph density profiles and, equivalently, by the vanishing of cut-norm discrepancies across all node bipartitions (Borgs et al., 2008; Lovász, 2012). Graphons also serve as generative models for graphs of any size, making them well-suited for comparing attention patterns across different scales. More specifically, graphon estimation provides practical tools for recovering and comparing latent kernels from finite samples (Chan & Airoldi, 2014; Gao et al., 2015).

Equipped with the graphon toolkit, we formalize and study the question of whether attention matrices concentrate around a dataset-specific attention graphon as graph size grows. Our contributions are:

(C1) Graphon viewpoint for attention. We formalize pre-softmax attention matrices as finite samples from an underlying kernel, and propose a canonicalize-then-block-average pipeline that produces a dataset-level attention graphon estimate. A paramount consequence of such perspective is transferability. In graph machine learning (GML), graphon theory explains why GML models (e.g., graph neural networks) trained on moderate-size graphs can be transferred to a larger graph sampled from the same graphon, with a performance gap vanishing as both graphs grow Ruiz et al. (2020). Thus, an attention layer trained on small graph samples approximates its behavior on larger ones, with an error decaying with size. That gives a principled account of size generalization, suggesting that long-context behavior can be probed using small samples.

(C2) Variance bounds. We derive a worst-case variance bound for the deviation of attention graphs from their underlying graphon, and a sharper regularity-aware bound based on nonparametric graphon estimation. Together, these results ground cut-distance and cut-norm variance curves as principled diagnostics for whether attention admits a stable continuous description.

(C3) Empirical validation. We evaluate on multiple graph benchmarks and synthetic graphon families, showing that, for several of them, estimated attention graphons stabilize with graph size and that empirical variance decreases with n, consistent with the theory. For datasets admitting an attention graphon, we further show that the estimated kernel can be used to approximate attention on larger graphs, yielding transfer error curves that decrease with n relative to the exactly computed attention matrices.

Notation. We denote a simple undirected graph with n=∣V∣n = |V| nodes G=(V,E)G = (V, E), and its adjacency matrix AG∈{0,1}n×nA_G \in \{0,1\}^{n \times n}, where (AG)ij=1(A_G)_{ij} = 1 iff (i,j)∈E(i,j) \in E and (AG)ii=0(A_G)_{ii} = 0. We also consider weighted graphs with adjacency matrix A∈[0,1]n×nA \in [0,1]^{n \times n}. Nodes are labeled as [n]={1,…,n}[n] = \{1, \ldots, n\}, and their node features denoted X∈Rn×dX \in \mathbb{R}^{n \times d}. We use π\pi to express a permutation of [n][n] with associated permutation matrix MπM_\pi.

References (81)