arXiv(opens in a new tab)cs.LGOct 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2610.01494

Let the Heads Talk: Beyond Diagonal Graph Attention

Riccardo Ali, Alessio Borgi, Mario Severino, Alessio Gravina, Davide Bacciu, Pietro Liò, Christopher Irwin

ABSTRACT

Sheaf Neural Networks generalize scalar-weighted message passing by replacing scalar edge weights with linear transport maps between local feature spaces. Yet the role of this matrix-valued transport is entangled with the broader sheaf-diffusion construction. We isolate the transport primitive through quiver representations and establish a direct connection with multi-head attention. Treating attention heads as coordinates of a local transport space reveals that standard multi-head attention implements diagonal edge maps: along each directed interaction, a source head can contribute only to the corresponding receiver head. Allowing off-diagonal entries instead enables edge-conditioned communication across heads before neighborhood aggregation. We show that this operation cannot, in general, be absorbed into a single shared linear map applied after aggregation. Building on this characterization, we introduce Topological Attention (Top-A), a multi-head attention that learns edge-dependent off-diagonal routes while preserving the original same-head paths and exactly recovering vanilla attention when the additional routing vanishes. We evaluate Top-A on relational reasoning, heterogeneous graph learning, and algorithmic reasoning, including out-of-distribution generalization, with heterophilic node classification as a contrast setting. The results show that cross-head transport is most useful when the task benefits from interaction-dependent transformations, while heterophily alone provides no systematic advantage. These findings identify edge-conditioned cross-head communication as a distinct computational primitive of matrix-valued transport.

1 INTRODUCTION

Graph Neural Networks (GNNs) (Scarselli et al., 2009; Micheli, 2009; Defferrard et al., 2016; Gilmer et al., 2017; Kipf & Welling, 2017) learn by propagating information along graph edges, with most message-passing architectures using scalar weights to modulate neighboring representations. Sheaf Neural Networks (SNNs) (Hansen & Gebhart, 2020; Bodnar et al., 2022) generalize this paradigm by equipping edges with linear transport operators between local feature spaces, allowing neighboring representations to be transformed rather than merely reweighted. Introduced through cellular sheaf theory (Hansen & Ghrist, 2019), this richer form of local transport was motivated by phenomena such as heterophily (Luan et al., 2024) and oversmoothing (Cai & Wang, 2020; Oono & Suzuki, 2020; Rusch et al., 2023), and has since inspired a growing family of architectures. Yet, the classical sheaf construction couples several components: restriction maps connect node and edge spaces, their compositions induce transport between neighboring nodes, and the resulting transformations are assembled through the sheaf Laplacian. Consequently, the specific computational capability contributed by richer local transport remains unclear. While the original motivation for SNNs is rooted in sheaf diffusion and topology, recent architectures increasingly learn edge-dependent matrix

*Equal contribution. Contacts: Riccardo Ali: rma55@cam.ac.uk; Alessio Borgi: alessio.borgi@uniromal.it, ab3352@cam.ac.uk; Mario Severino: mario.severino@phd.unipd.it; Alessio Gravina: alessio.gravina@di.unipi.it; Christopher Irwin: cli23@cam.ac.uk.

transformations directly (Hajij et al., 2025; Ribeiro et al., 2026). Moreover, recent evidence questions whether gains under heterophily and oversmoothing arise specifically from the learned sheaf structure (Hernandez Caralt et al., 2026; Fiorini et al., 2026). This motivates a more fundamental question: what is actually useful about sheaf transport? We address it by isolating the local transformation induced by learned sheaf structure. Rather than asking when SNNs outperform conventional GNNs, we ask which additional form of message passing matrix-valued transport enables and how it differs from standard graph propagation. This leads us from cellular sheaves to quiver representations (Hajij et al., 2025), where directed interactions are represented directly by linear maps. At this level, transport itself can be studied independently of the restriction-map factorization and diffusion dynamics of classical SNNs, while revealing a direct connection with multi-head attention. If attention heads are treated as coordinates of the local transport space, multi-head attention induces a diagonal map on each directed interaction: each source head contributes only to the corresponding receiver head, even though different heads may assign different weights to the same interaction. Thus, standard attention spans only the diagonal subfamily of matrix-valued head-space transport. Off-diagonal entries extend this mechanism with edge-conditioned communication across heads before neighborhood aggregation. We show that this edge-specific mixing cannot, in general, be absorbed into a shared post-aggregation projection, and therefore constitutes a distinct operation beyond standard multi-head attention. Motivated by this, we introduce Topological Attention (Top-A), which augments standard attention with edge-conditioned off-diagonal routing across heads while preserving the original same-head paths. When the routing vanishes, Top-A reduces exactly to vanilla attention, providing a controlled way to study when cross-head transport is useful independently of other architectural changes. We evaluate this inductive bias on algorithmic reasoning with CLRS (Veličković et al., 2022), relational reasoning with STaR (Khalid & Schockaert, 2025), heterogeneous graph learning (Harper & Konstan, 2015), and, as a contrast setting, classical heterophilic node classification (Platonov et al., 2023). Together, these benchmarks probe edge-specific computation across relational composition, directed heterogeneous interactions, and algorithmic size generalization, while isolating whether heterophily alone is sufficient to make cross-head transport beneficial.

Our main contributions are: (i) We use quiver representations to disentangle matrix-valued edge transport from the broader sheaf-diffusion construction, establishing a direct connection to multi-head attention. (ii) We characterize matrix-valued transport as edge-conditioned communication across attention heads and prove that, in general, it cannot be reduced to a shared post-aggregation projection. (iii) We introduce Top-A, an architectural extension implementing this transport primitive, and evaluate it across relational, heterogeneous, and algorithmic reasoning, including compositional-and size-generalization regimes.

References (32)