Sheaf-MPNN: A Library for Sheaf Neural Networks as Message Passing
Organizations: Department of Computer Science and Technology, University of Cambridge, Cambridge, UK · Department of Computer, Control and Management Engineering, Sapienza University of Rome, Rome, Italy · Department of Information Engineering and Computer Science, University of Trento, Trento, Italy · KTH Royal Institute of Technology, Stockholm, Sweden ·
Abstract
Standard Graph Neural Networks (GNNs) implicitly assume that neighboring nodes share the same feature space, which contributes to oversmoothing and poor performance on heterophilic graphs. Sheaf Neural Networks (SNNs) remove this assumption by giving each node and edge its own vector space and learning restriction maps that transform features as they move between neighbors. These maps define a sheaf Laplacian that drives diffusion over the graph, but existing implementations often assemble it explicitly as a global sparse block matrix, which adds memory and computational overhead and can hinder scalability. In this paper, we introduce Sheaf-MPNN, a PyTorch Geometric library that reformulates sheaf diffusion as local incidence-wise transport and aggregation, eliminating the need to construct the global Laplacian. Sheaf-MPNN implements fifteen families of SNNs under a unified message-passing framework, each supporting both homogeneous and heterogeneous graphs, and directed and undirected settings, with diagonal, general, orthogonal, and low-rank restriction maps and attention-based predictors. We further provide a unified benchmarking suite covering node- and graph-level tasks, heterogeneous graph learning, and computational efficiency, enabling systematic and reproducible comparisons across architectures. We establish theoretical equivalence between these message-passing formulations and their original counterparts and identify the architectural mechanisms needed to preserve their propagation dynamics. This unified perspective provides a principled foundation for implementing, comparing, and extending sheaf-based architectures within standard graph learning frameworks. Source code is available at https://github.com/alessioborgi/sheaf-mpnn.
Figures & tables
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Module | Responsibility |
| sheaf_mpnn.base_conv | Shared stalk transforms, map-predictor inputs, and propagation interfaces. |
| sheaf_mpnn.<family> | Architecture-specific convolutions and end-to-end models. |
| sheaf_mpnn.utils | Normalization, orthogonal parameterizations, connection maps, and training utilities. |
| sheaf_mpnn.sheaf_pool | Graph-level pooling of stalk-valued representations. |
| hetsheaf_mpnn | Type-conditioned layers and model wrappers. |
| exp.config , exp.registries | Typed experiment settings and factories for models, datasets, and presets. |
| Family | Model type | Map and model options |
| Neural Sheaf Diffusion | nsd | Six |
| Polynomial NSD | poly_nsd | Six |
| Connection-Laplacian NSD | conn_nsd | Precomputed maps |
| Deep NSD | dnsd | Six |
| Neural Sheaf Propagation | nsp | Six |
| Sheaf adjacency | sheaf_adj | Six |
| Variant | Restriction parameterization | Outputs |
| DIAGONAL | , with | |
| GENERAL | Dense matrix with entries in | |
| GENERAL_ATTENTION | , with row-wise softmax | |
| ORTHOGONAL | Cayley or Householder construction | or |
| ORTHOGONAL_ATTENTION | Cayley transform of the skew part of | |
| LOW_RANK | , with |
| Option | Effect |
| variant , rank , orth_strategy | Select the restriction-map variant and its parameterization. |
| alpha , learn_alpha , add_eps | Set the diffusion step and enable the learnable skip scaling. |
| use_edge_weights | Enable learned symmetric edge weights for orthogonal maps. |
| add_lp , add_hp | Append a fixed channel with signless ( ) or standard ( ) graph-Laplacian blocks, respectively. |
| sparse_learner | Sum the paired contexts over the stalk axis, reducing the predictor width from to for flattened stalk inputs. |
| second_linear | Add a second encoder layer. |
Sheaf Neural Networks
Sheaf neural networks generalize graph learning with local vector spaces and edge maps that model how information is compared and transported.
See all 30 papers