---
title: Bayesian Sheaf Neural Networks
url: https://www.emergentmind.com/topics/bayesian-sheaf-neural-networks
type: topic
---

# Bayesian Sheaf Neural Networks

Bayesian Sheaf Neural Networks (BSNNs) are variational Bayesian extensions of sheaf-based graph neural networks in which the sheaf Laplacian, or equivalently the restriction maps defining a cellular sheaf on a graph, is treated as latent random structure rather than as a deterministic point estimate. In this formulation, the network retains sheaf-diffusion message passing while replacing deterministic sheaf learning with variational inference over sheaves, with the stated aim of improving robustness on heterophilic graph data, especially when labeled data are limited [2410.09590]. Within the broader sheaf-neural literature, deterministic Sheaf Neural Networks provide the mathematical substrate—stalks, restriction maps, global sections, and sheaf Laplacians—on top of which a Bayesian treatment can be built, but not every sheaf neural network is Bayesian in the technical sense [2602.00159].

## 1. Conceptual position within graph representation learning

BSNNs are motivated by the limitations of ordinary message passing on heterophilic graphs. Standard GNNs and many higher-order extensions work best on homophilic graphs, where neighboring nodes tend to share labels. On heterophilic graphs, adjacent nodes often belong to different classes, and ordinary message passing can oversmooth features and destroy class-separating information. Sheaf neural networks address this by replacing the graph Laplacian with a sheaf Laplacian \(L_F\) or its normalized variant \(\Delta_F\), so that neighboring nodes need not be aggregated through a single uniform averaging geometry [2410.09590].

The immediate precursor is deterministic Neural Sheaf Diffusion. In that setting, the sheaf is learned as a function of node features, which is expressive but also potentially overly sensitive to limited labeled data, random initialization, hyperparameter choices, and noise in the input features. BSNNs replace that point-estimate view by treating the sheaf itself as a latent random variable and learning a distribution over sheaves rather than a single sheaf. The resulting model is framed as a Bayesian counter-measure to brittle sheaf learning, not as a replacement for sheaf diffusion as such.

A recurring misconception is to equate any sheaf-based graph network with a Bayesian model. That is incorrect. Deterministic sheaf architectures may learn restriction maps, normalized sheaf Laplacians, and sheaf-aware diffusion operators without introducing priors, posteriors, variational objectives, or explicit uncertainty quantification. In the technical sense used by the BSNN literature, the defining Bayesian step is the introduction of a variational posterior \(q_\phi(F\mid X,y)\) over sheaf structure.

## 2. Sheaf-theoretic and diffusion foundations

The sheaf-neural framework begins with an undirected graph \(G=(V,E)\). In the deterministic SNN presentation, the graph is viewed as a finite topological space via the Alexandrov topology. Each vertex \(v\) has an associated open star \(U_v\), each edge \(e\) has \(U_e=\{e\}\), and a sheaf \(F\) of vector spaces is specified by assigning a vector space \(F(U_v)\) to each vertex, a vector space \(F(U_e)\) to each edge, and linear restriction maps
\[
F_{v\leq e}:F(U_v)\rightarrow F(U_e)
\]
whenever \(v\) is a vertex of \(e\) [2602.00159].

If a graph with features is denoted \((G,h_G)\), each node \(v\) carries a feature vector \(h_v\in\mathbb{R}^n\). The collection \(\{h_v\}\) can be regarded as sections of a constant sheaf \(\underline{\mathbb{R}^n}\). The essential sheaf-theoretic departure from ordinary GNNs is that node-to-edge relations need not be identity maps: the restriction maps encode structured local compatibility. The usual sheaf principle then applies: local data can be “glued” into global data when the local pieces are consistent.

This consistency is measured through the sheaf Laplacian. With chain spaces
\[
C_1(G,F):=\bigoplus_{e\in E}F(e), \qquad C_0(G,F):=\bigoplus_{v\in V}F(v),
\]
and a coboundary operator \(\delta:C_0(G,F)\to C_1(G,F)\) defined for an oriented edge \(e\) connecting \(u\) and \(v\) by
\[
(\delta x)_e := F_{u \leq e}(x_u) - F_{v \leq e}(x_v),
\]
the sheaf Laplacian is
\[
\mathcal{L}_F=\delta^\top\delta.
\]
It is positive semidefinite, and its kernel corresponds to global sections. When all stalks are \(\mathbb{R}\) and all restriction maps are identities, the construction reduces to the ordinary graph Laplacian \(L=D-A\), so the sheaf model is a strict generalization of Laplacian-based GNNs [2602.00159].

The same structure underlies sheaf diffusion. In Neural Sheaf Diffusion, node features evolve under
\[
\dot{\mathbf{X}}(t)=-\Delta_{\mathcal{F}}\mathbf{X}(t),
\]
where \(\Delta_{\mathcal{F}}=\delta_{\mathcal{F}}^\ast\delta_{\mathcal{F}}\). The harmonic space is
\[
H^0(G;\mathcal{F})=\ker(\delta_{\mathcal{F}})=\ker(\Delta_{\mathcal{F}}),
\]
and the diffusion limit satisfies
\[
\mathbf{X}(t)\to \Pi_{H^0(G;\mathcal{F})}\mathbf{X}(0)
\quad \text{as } t\to\infty.
\]
Accordingly, sheaf diffusion learns a task-adapted local consistency geometry whose limiting space need not be the constant-signal subspace of the ordinary graph Laplacian [2605.11178].

## 3. Variational Bayesian formulation

The BSNN formulation is given for semi-supervised node classification on a graph \(G=(V,E)\) with node features \(X\), observed labels \(y\), and unobserved labels \(y^\ast\). The predictive model is \(p_\theta(y\mid X)\), implemented by a sheaf neural network whose layers use sampled sheaves \(F\). The paper’s graphical model is summarized by
\[
X, A, \phi \rightarrow F,\qquad X, F, \theta \rightarrow y,
\]
where \(A\) is the adjacency matrix, \(\phi\) parameterizes the variational sheaf learner, and \(\theta\) parameterizes the classifier and sheaf-network weights [2410.09590].

The sheaf diffusion layer is based on the discretized process
\[
X(t+1)=X(t)-\Delta_F X(t),
\]
and the layer update used in the paper is
\[
X_{t+1}=X_t-\sigma\big(\Delta_{F(t)}(I_n\otimes W_{t,1})X_tW_{t,2}\big),
\]
with \(W_{t,1}\in\mathbb{R}^{d\times d}\), \(W_{t,2}\in\mathbb{R}^{f\times f}\), stalk dimension \(d\), feature-channel count \(f\), and nonlinearity \(\sigma\). A stack of such layers is used, and each layer can have its own sampled sheaf \(F_t\).

The Bayesian step is to promote the sheaf to a latent variable. The intractable posterior \(p_\theta(F\mid X,y)\) is approximated by a variational family \(q_\phi(F\mid X,y)\). The evidence lower bound is written as
\[
\log p_\theta(X,y)
=
KL\!\left(q_\phi(F\mid X,y)\,\|\,p_\theta(F\mid X,y)\right)
+
L(\theta,\phi;X,y),
\]
with
\[
L(\theta,\phi;X,y)
=
\mathbb{E}_{q_\phi(F\mid X,y)}\big[\log p_\theta(X,y\mid F)\big]
-
KL\!\left(q_\phi(F\mid X,y)\,\|\,p_\theta(F)\right).
\]
This is the objective optimized during training.

The variational sheaf learner is defined per incident node-edge pair \(ue\). Both posterior and prior are factorized:
\[
q_\phi(F\mid X,y)=\prod_{ue} q_\phi(F_{ue}\mid X,y),
\qquad
p_\theta(F)=\prod_{ue} p_\theta(F_{ue}).
\]
Their distributional parameters are produced by an MLP:
\[
[\,\mu_{ue}\,\|\,\sigma_{ue}\,] = \mathrm{MLP}_\phi([x_u\|x_{u'}]),
\]
where \(u'\) is the other endpoint of edge \(e\). This is an amortized posterior over restriction maps: the network infers local sheaf geometry from endpoint features rather than storing a single deterministic map for each incidence.

## 4. Restriction-map families and the Cayley-distribution construction

The paper treats three families of restriction maps. For general linear restriction maps, \(F_{ue}\) is a \(d\times d\) matrix, with \(\mu_{ue},\sigma_{ue}\in\mathbb{R}^{d^2}\). A latent Gaussian sample
\[
z \sim \mathcal{N}_{d^2}\!\left(\mu_{ue},\operatorname{diag}(\sigma_{ue})\right)
\]
is reshaped into a \(d\times d\) matrix, with reparameterization
\[
z=\mu_{ue}+\operatorname{diag}(\sigma_{ue})\,\epsilon,\qquad \epsilon\sim\mathcal{N}(0,I_{d^2}),
\]
and prior
\[
p_\theta(F_{ue})=\mathcal{N}_{d^2}(0,I_{d^2}).
\]

For invertible diagonal restriction maps, \(\mu_{ue},\sigma_{ue}\in\mathbb{R}^{d}\), a Gaussian sample is drawn in \(\mathbb{R}^d\), and the matrix is set to
\[
F_{ue}=\operatorname{diag}(\mu_{ue}+\sigma_{ue}\epsilon),\qquad \epsilon\sim\mathcal{N}(0,I_d),
\]
with standard normal prior on the diagonal vector.

The special orthogonal case is the paper’s distinctive probabilistic contribution. Here \(F_{ue}\in SO(d)\), \(\mu_{ue}\in SO(d)\) is a mean rotation, \(\sigma_{ue}\in[0,1)\) is a concentration parameter, and the posterior family is
\[
q_\phi(F_{ue}\mid X,y)=C_d(\mu_{ue},\sigma_{ue}),
\]
with prior equal to the uniform distribution \(U_{SO(d)}\). The family \(C_d\) is defined through the Cayley transform
\[
C(A)=(I-A)^{-1}(I+A)=2(I-A)^{-1}-I,
\]
whose inverse, for \(P\in SO(n)\) with \(-1\) not an eigenvalue, is
\[
C^{-1}(P)=(P-I)(I+P)^{-1}=I-2(I+P)^{-1}.
\]
This yields a reparameterizable probability distribution on \(SO(n)\), which is essential for gradient-based variational optimization [2410.09590].

The density with respect to normalized Haar measure is given in closed form:
\[
f_n(P;M,\kappa)
=
(1-\kappa^2)^{\frac{n(n-1)}{2}}
\det(PM^T-\kappa I)^{1-n}.
\]
For \(n=2\), the paper identifies \(C_2(M,\kappa)\) with a wrapped Cauchy distribution on the circle \(SO(2)\cong S^1\). For \(n=3\), it relates \(C_3(M,\kappa)\) to an angular central Gaussian distribution on \(S^3\), pushed forward through the standard two-fold cover \(\Phi:S^3\to SO(3)\).

The same paper also strengthens an expressivity claim for special orthogonal sheaves. It proves that for any \(d\ge 1\), if \(\mathcal{G}\) denotes the class of connected graphs with \(C\le 7\lfloor d/4\rfloor\) classes, then \(\mathcal{H}_{so}^d\) has linear separation power over \(\mathcal{G}\). This supports the use of \(SO(d)\)-valued restriction maps not only as a probabilistic convenience but also as an expressive sheaf family.

## 5. Optimization, inference, and empirical behavior

Training optimizes a Monte Carlo estimate of the ELBO. When the KL term is tractable, the objective is
\[
\widetilde{L}_\lambda(\theta,\phi;X,y)
=
\frac{1}{K}\sum_{k=1}^{K} \log p_\theta(X,y\mid F^{(k)})
-
\lambda\,KL\!\left(q_\phi(F\mid X,y)\,\|\,p_\theta(F)\right),
\]
and when it is not, the paper uses
\[
\widetilde{L}_\lambda(\theta,\phi;X,y)
=
\frac{1}{K}\sum_{k=1}^{K}
\left(
\log p_\theta(X,y\mid F^{(k)})
-
\lambda\log\frac{q_\phi(F^{(k)}\mid X,y)}{p_\theta(F^{(k)})}
\right).
\]
A KL weight \(\lambda\) is cyclically annealed to prevent KL vanishing. For Gaussian posteriors against standard normal priors, analytic KL expressions are used; for Cayley versus uniform on \(SO(n)\), analytic KL formulas are given for \(n=2,3\), while for \(d\ge 4\) the KL is estimated by sampling [2410.09590].

The implementation pipeline is explicit. The variational sheaf learner first applies a linear layer to resize node features to dimension \(k=df\), concatenates endpoints of each edge to build \(2e\) incident-pair inputs, uses an MLP to produce \(\mu_{ue},\sigma_{ue}\), samples sheaf restriction maps \(F_1,\dots,F_L\), propagates features through \(L\) sheaf layers, applies a final linear classifier, and optimizes the ELBO estimator with backpropagation. At test time, prediction is performed by ensembling over multiple sampled sheaves so that uncertainty in the learned variational posterior is integrated out in the predictive point estimate.

The reported experiments are on the WebKB datasets Texas, Wisconsin, and Cornell. Node features are 1703-dimensional bag-of-words vectors, classes are five—student, project, course, staff, and faculty—and the graph sizes are 183 nodes and 325 edges for Texas, 183 nodes and 298 edges for Cornell, and 251 nodes and 515 edges for Wisconsin. The evaluation protocol uses 10 fixed splits of the data with \(32\%/20\%/48\%\) train/validation/test proportions, hyperparameter grid search, retraining and evaluation with 30 random seeds for the best setting, and a Wilcoxon signed-rank test at \(p=0.05\). The grid includes hidden channels \(\{8,32\}\), stalk dimensions \(\{2,3,4,5\}\), layers \(\{2,3,4,5\}\), dropout \(\{0.0,0.3,0.6\}\), learning rate \(0.01\), ELU activation, weight decay \(5\times 10^{-4}\), patience \(200\), max epochs \(500\), Adam optimization, and ensemble size \(3\) for BSNN.

Empirically, the paper reports that on each dataset the best test accuracy among the compared models is achieved by one of the BSNN variants; \(SO(d)\)-BSNN outperforms the corresponding deterministic \(O(d)\)-NSD on all three datasets; Gen-BSNN significantly outperforms Gen-NSD on all three datasets; and diagonal results are mixed but still competitive. The standard deviation across 30 seeds is generally lower for BSNN than NSD, and when performance is averaged over all hyperparameter settings, BSNN consistently dominates the corresponding deterministic model. The stated interpretation is that Bayesian averaging over plausible sheaves is especially helpful when the sheaf family is expressive and training data are limited.

## 6. Deterministic sheaf neural networks and the non-Bayesian biomedical case

A separate sheaf-neural development presents Sheaf Neural Networks as a deterministic generalization of graph neural networks and applies them to a biomedical classification problem. That model uses a sheaf-aware diffusion operator in place of a standard graph convolution, with learned sheaves at each layer and general, unconstrained restriction maps. When the sheaf in every layer is the constant sheaf \(\underline{\mathbb{R}}\), the architecture reduces to the ordinary Laplacian-based GNN case. Training is standard supervised node classification in a transductive setting, using Adam with a learning-rate scheduler for 400 epochs, no mini-batching, and regularization through dropout, batch normalization, layer normalization, and weight decay. Hyperparameters are selected by exhaustive grid search within each cross-validation fold, with the best setting chosen by mean validation accuracy across repeated 10-fold stratified cross-validation runs [2602.00159].

The biomedical application is osteosarcoma classification. The dataset contains 224 XANES spectra from bone tissue samples, each spectrum having 501 data points. The binary labels are 147 tumor samples and 77 control samples. Samples are reduced to 50 dimensions by PCA before graph construction; the graph is built by computing cosine similarity between every pair of samples in PCA space, sorting similarities, and adding edges from the most similar pairs until the graph becomes connected. Each node is therefore a patient tissue sample with a 50-dimensional feature vector, and the task is tumor-versus-healthy node classification.

Evaluation uses 10-fold stratified cross-validation repeated 5 times with different shuffles. The main metrics are fold accuracy and majority-vote accuracy; the appendix additionally reports precision, recall, F1, and AUC. The best-performing model is SheafGeneral, with fold accuracy
\[
0.9779 \pm 0.033
\]
and majority-vote accuracy
\[
0.9866 \; (0.961\text{--}0.995).
\]
For comparison, GraphSAGE achieves \(0.9187 \pm 0.061\) fold accuracy and \(0.9286\) majority-vote accuracy, while GAT and GCN are much lower, around \(0.77\) and \(0.76\), respectively. In the appendix, SheafGeneral also achieves precision \(1.0000\), recall \(0.9796\), F1 \(0.9897\), and AUC \(0.9969\).

This result is directly relevant to BSNNs because it demonstrates that the underlying deterministic sheaf architecture can outperform standard GNN baselines on a concrete biomedical task. It is not, however, a Bayesian sheaf neural network in the explicit sense of Bayesian inference, variational learning, priors, posteriors, or uncertainty quantification. The paper itself states that a Bayesian treatment could be built later on top of the deterministic sheaf-Laplacian framework.

## 7. Oversmoothing, representation geometry, and limitations

A later theoretical development reinterprets Neural Sheaf Diffusion through incidence-quiver representations. For an undirected graph \(G=(V,E)\), the incidence quiver \(Q_G\) has vertices \(Q_0=V\sqcup E\) and arrows \(v\to e\) for every incidence \(v\trianglelefteq e\). Under the paper’s correspondence, finite-dimensional cellular sheaves on \(G\) are equivalent to finite-dimensional representations of \(Q_G\), with fixed stalk dimensions giving a representation space
\[
\operatorname{Rep}(Q_G,\mathbf d)
=
\prod_{v\trianglelefteq e}\operatorname{Hom}(k^{d_v},k^{d_e}),
\]
and gauge group
\[
G_{\mathbf d}
=
\prod_{v\in V}GL(d_v)\times \prod_{e\in E}GL(d_e)
\]
acting by base change
\[
\mathcal{F}_{v\trianglelefteq e}\mapsto g_e\mathcal{F}_{v\trianglelefteq e}g_v^{-1}.
\]
On this view, oversmoothing is not only spectral collapse but representation degeneration: direct-sum decompositions of the learned sheaf induce decompositions of the harmonic space
\[
H^0(G;\mathcal{F})
\cong
\bigoplus_{k=1}^K H^0(G;\mathcal{F}^{(k)}),
\]
so collapse toward low-complexity summands can destroy discriminative information in the diffusion limit [2605.11178].

The same work studies the trivial subrepresentation \(\mathcal{F}_{\mathrm{triv}}\), in which all stalks align so that restriction maps act as identities on a one-dimensional subspace. On this summand, the Dirichlet energy reduces to ordinary graph Laplacian energy, and for a connected graph the corresponding global sections are constant. To bias training away from such collapse, the paper introduces the moment-map-inspired regularizers CentMM and ThetaMM:
\[
\mathcal{R}_{\mathrm{cent}}(\mathcal{F})
=
\sum_i
\left\|
\mu_i(\mathcal{F})
-
\frac{\operatorname{tr}(\mu_i(\mathcal{F}))}{d_i}I_{d_i}
\right\|_F^2,
\]
\[
\mathcal{R}_{\theta\text{-}\mu}(\mathcal{F};\theta)
=
\sum_i \|\mu_i(\mathcal{F})-\theta_i I_{d_i}\|_F^2.
\]
It also identifies an equal-stalk obstruction: when \(d_v=d_e\), admissibility for learnable stability parameters forces the trivial all-object summand onto a stability wall, whereas non-uniform stalk dimensions such as \(d_v=3,d_e=2\) remove this obstruction. On heterophilic benchmarks, the reported results are consistent with this mechanism: rectangular architectures can reduce variance or improve validation behavior, and on Wisconsin the rectangular ThetaMM model reaches \(81.76\pm 4.81\), while both rectangular and square models remain resilient up to \(L=128\) before numerical instability appears at \(L=256\) [2605.11178].

For Bayesian sheaf models, these results do not constitute a formal Bayesian derivation, but they sharpen the geometry of what a posterior over sheaves is implicitly ranging over. This suggests that priors over restriction maps should respect representation geometry rather than treat matrix entries as naive isotropic parameters; a plausible implication is that CentMM and ThetaMM can be read as soft geometric priors or MAP regularizers; and the equal-stalk obstruction suggests that the choice \(d_v\neq d_e\) functions as a structural prior over feasible stability behavior, not merely as a capacity choice.

The current BSNN formulation also has explicit limitations. The variational posterior is factorized over incident node-edge pairs and therefore ignores posterior correlations between restriction maps; the Cayley family is exploited analytically most conveniently for \(d=2,3\), while for \(d\ge 4\) KL terms are sampled rather than closed form; experiments are limited to WebKB node classification in a low-data regime; prediction cost is higher because inference uses ensembling over sampled sheaves; and the empirical study focuses on accuracy, standard deviation, and hyperparameter robustness rather than on calibration curves, predictive entropy, or out-of-distribution uncertainty analysis [2410.09590].

Source: https://www.emergentmind.com/topics/bayesian-sheaf-neural-networks