Neural Sheaf Diffusion: Heterophily and Oversmoothing Are the Same Problem

15 minute read

Published:

TL;DR: A GNN assumes every node's features live in one shared vector space with identity maps between them — in sheaf language, a trivial sheaf. Bodnar et al. show that this single assumption produces both oversmoothing and heterophilic failure, then work out a hierarchy of increasingly general sheaves and prove, at each level, exactly which classification problems the resulting diffusion can solve in the infinite-time limit. The punchline is a staircase: symmetric scalar maps cannot separate a balanced bipartite graph at all; signed scalar maps separate two classes; \(d\)-dimensional diagonal maps handle \(C \le d\) classes; orthogonal maps handle \(C \le 2d\). Then they learn the sheaf from data.
Paper: Neural Sheaf Diffusion: A Topological Perspective on Heterophily and Oversmoothing in GNNs
Authors: Cristian Bodnar, Francesco Di Giovanni, Benjamin P. Chamberlain, Pietro Liò, Michael Bronstein
Venue: NeurIPS 2022 · arXiv:2202.04579 · code

Two complaints, one cause

The two standard complaints about GNNs are usually filed separately. Oversmoothing: stack enough layers and every node’s representation converges to the same thing. Heterophily: models built on the assumption that neighbours are similar do badly when neighbours are systematically dissimilar.

The paper’s claim is that both follow from the geometry the graph is implicitly given — and that nobody chose that geometry deliberately.

Start from heat diffusion with the normalised Laplacian \(\Delta_0 = I - D^{-1/2}AD^{-1/2}\):

\[ \dot{X}(t) = -\Delta_0 X(t) \qquad\leadsto\qquad X(t+1) = (I - \Delta_0)X(t), \]

and compare with GCN, which is that Euler step plus a weight matrix and a nonlinearity:

\[ \mathrm{GCN}(X, A) := \sigma\big(D^{-1/2}AD^{-1/2}XW\big) = \sigma\big((I - \Delta_0)XW\big). \]

Read that way, GCN is an augmented heat equation. Heat flow makes neighbouring values agree. Of course it oversmooths; of course it struggles when agreement is the wrong objective.

The sheaf

Definition. A cellular sheaf \((G,\mathcal{F})\) on an undirected graph assigns a vector space \(\mathcal{F}(v)\) to each node, a vector space \(\mathcal{F}(e)\) to each edge, and for every incident node–edge pair \(v \trianglelefteq e\) a linear map \(\mathcal{F}_{v \trianglelefteq e} : \mathcal{F}(v) \to \mathcal{F}(e)\). The spaces are stalks; the maps are restriction maps.

Hansen and Ghrist’s opinion-dynamics reading makes this concrete, and the whole paper runs on it. A node’s feature \(x_v \in \mathcal{F}(v)\) is its private opinion. The edge stalk \(\mathcal{F}(e)\) is a discourse space — what gets said publicly on that edge — and \(\mathcal{F}_{v \trianglelefteq e}x_v\) is how \(v\)’s private opinion manifests there.

Two nodes agree on an edge when their public expressions coincide. Collect the assignments where everyone agrees everywhere and you get the global sections

\[ H^0(G;\mathcal{F}) := \{ x \in C^0(G;\mathcal{F}) : \mathcal{F}_{v \trianglelefteq e}x_v = \mathcal{F}_{u \trianglelefteq e}x_u \}, \]

where \(C^0(G;\mathcal{F}) = \bigoplus_{v \in V} \mathcal{F}(v)\) is the space of 0-cochains. The sheaf Laplacian measures aggregated disagreement at each node:

\[ L_{\mathcal{F}}(x)_v := \sum_{v,u \trianglelefteq e} \mathcal{F}_{v \trianglelefteq e}^{\top}\big(\mathcal{F}_{v \trianglelefteq e}x_v - \mathcal{F}_{u \trianglelefteq e}x_u\big), \]

a positive semi-definite \(nd \times nd\) block matrix with diagonal blocks \(\sum_{v \trianglelefteq e}\mathcal{F}_{v\trianglelefteq e}^{\top}\mathcal{F}_{v \trianglelefteq e}\) and off-diagonal blocks \(-\mathcal{F}_{v\trianglelefteq e}^{\top}\mathcal{F}_{u\trianglelefteq e}\). Normalising by its block diagonal \(D\) gives \(\Delta_{\mathcal{F}} := D^{-1/2}L_{\mathcal{F}}D^{-1/2}\), preferred in practice for its bounded spectrum.

Set \(d = 1\) and every restriction map to the identity and you recover the ordinary graph Laplacian. That is the trivial sheaf, and it is what every standard GNN silently assumes. The paper’s programme is to ask what happens when you stop assuming it.

Sheaf diffusion \(\dot{X}(t) = -\Delta_{\mathcal{F}}X(t)\) projects each feature channel into \(\ker(\Delta_{\mathcal{F}})\), which is isomorphic to \(H^0(G;\mathcal{F})\). So diffusion is a synchronisation process: private opinions move until every public expression agrees. Whether the classes end up separated depends entirely on how rich that space of agreements is.

Transport, holonomy, and the size of the kernel

When the restriction maps are orthogonal, \(\mathcal{F}_{v \trianglelefteq e} \in O(d)\), the sheaf is a discrete \(O(d)\)-bundle and \(L_{\mathcal{F}}\) is the connection Laplacian. Composing maps along a path \(\gamma_{v \to u}\) gives a transport operator

\[ \mathbf{P}^{\gamma}_{v \to u} := \big(\mathcal{F}_{u \trianglelefteq e}^{\top}\mathcal{F}_{v_{\ell} \trianglelefteq e}\big)\cdots\big(\mathcal{F}_{v_1 \trianglelefteq e}^{\top}\mathcal{F}_{v \trianglelefteq e}\big) : \mathcal{F}(v) \to \mathcal{F}(u), \]

and in general transport is path dependent — send a vector round a loop and it comes back changed. Three results pin down what that costs:

  • Proposition 3. With \(r := \max_{\gamma, \gamma'}\lVert \mathbf{P}^{\gamma}_{v\to u} - \mathbf{P}^{\gamma'}_{v\to u}\rVert\), the spectral gap satisfies \(\lambda^{\mathcal{F}}_0 \le r^2/2\). Path-independent transport (\(r = 0\)) therefore forces a non-trivial harmonic space.
  • Proposition 5 (Cheeger-type, other direction). If \(\lVert(\mathbf{P}^{\gamma}_{v\to v} - I)x_v\rVert \ge \epsilon\lVert x_v\rVert\) for every cycle at \(v\), then \(\lambda^{\mathcal{F}}_0 \ge \epsilon^2(2\,\mathrm{diam}(G)\,n\,d_{\max})^{-1}\).
  • Lemma 6. \(\dim(H^0) \le d\), with equality iff transport is path-independent.

Lemma 6 is the load-bearing one: the dimension of the space diffusion converges into is capped by the stalk dimension. That single inequality drives everything below.

The gauge-theory connection is not an analogy. Restriction maps are transports between local frames, path-dependence is holonomy, and non-trivial holonomy is curvature. This is exactly the gauge row of the geometric deep learning blueprint, discretised onto a graph. Proposition 4 makes it explicit: for \(x \in H^0\) and any cycle \(\gamma\) at \(v\), we need \(x_v \in \ker(\mathbf{P}^{\gamma}_{v\to v} - I)\) — global sections must be fixed points of every holonomy.

The hierarchy

Now the payoff. A class of sheaves has linear separation power over a family of graphs if, for any labelled graph in the family, some sheaf in the class linearly separates the classes as \(t \to \infty\), for almost all initial conditions. (The “almost all” is needed because diffusion acts as a projection, and degenerate starts — the zero matrix, say — project to zero.) Then climb:

ClassRestriction mapsWhat it can separate
\(\mathcal{H}^1_{\text{sym}}\)symmetric, scalar2 classes under a homophily condition (Prop. 8); nothing on balanced bipartite graphs (Prop. 9)
\(\mathcal{H}^1\)any invertible scalar2 classes on any connected graph (Prop. 10); never \(C \ge 3\) (Prop. 11)
\(\mathcal{H}^d_{\text{diag}}\)invertible diagonal\(C\) classes whenever \(d \ge C\) (Prop. 12)
\(\mathcal{H}^d_{\text{orth}}\)orthogonal, \(O(d)\)\(C \le 2d\) classes, for \(d \in \{2,4\}\) (Prop. 13)

Three things deserve emphasis.

Proposition 9 is an impossibility result about GCN. For \(d=1\), symmetric invertible maps give exactly the weighted graph Laplacians with strictly positive weights — the class GCN and ChebNet live in. So “no sheaf in \(\mathcal{H}^1_{\text{sym}}\) separates the two sides of a balanced connected bipartite graph, for any initial conditions” is a statement about that entire family of models. Not “does it badly”. Cannot.

Proposition 10 explains signed edges. Take \(\mathcal{F}_{v\trianglelefteq e} = -\alpha_e\) for \(v \in A\) and \(+\alpha_e\) for \(u \in B\), with \(\alpha_e > 0\). Then \(\mathcal{F}_{v\trianglelefteq e}^{\top}\mathcal{F}_{u\trianglelefteq e} = \pm\alpha_e^2\): transport is \(-1\) across class boundaries and \(+1\) within classes. That transport is path-independent, so by Proposition 3 the harmonic space is non-trivial, and the limit polarises the two classes to opposite signs. Negatively-weighted edges had been a heterophily heuristic for years; here they fall out of the geometry.

Stalk width is not feature width. Proposition 11 says \(C \ge 3\) classes are unreachable at \(d=1\) no matter how many feature channels \(f\) you use, because \(\dim\ker(\Delta_{\mathcal{F}}) \le 1\) by Lemma 6. Channels do not help; stalk dimensions do. Confusing the two is the easiest way to misread the paper.

Note how the last two rows trade off. Diagonal maps behave like \(d\) independent copies of the \(d=1\) case stacked on the diagonal, so they need \(d \ge C\). Orthogonal maps mix the stalk dimensions, and that mixing is what lets them reach \(2d\) classes at the same width.

Escaping the kernel

Section 4 asks a different question. The sheaf will be learned, so it will often be the wrong sheaf. Can the network compensate?

Define the sheaf Dirichlet energy \(E_{\mathcal{F}}(x) := x^{\top}\Delta_{\mathcal{F}}x\), which vanishes exactly on \(\ker(\Delta_{\mathcal{F}})\), and set \(\lambda_* := \max_{i>0}(\lambda^{\mathcal{F}}_i - 1)^2 \le 1\).

  • Theorems 15 and 16. For sheaves with positive scalar transport, and for orthogonal-symmetric sheaves, with \(\sigma\) a (Leaky)ReLU, one layer satisfies \(E_{\mathcal{F}}(Y) \le \lambda_*\lVert W_1\rVert_2^2\lVert W_2^{\top}\rVert_2^2 E_{\mathcal{F}}(X)\). With small enough weights the energy contracts exponentially and the representation is trapped in the kernel — and if it starts there it can never leave.
  • Proposition 17. Outside \(\mathcal{H}^d_{\text{sym}}\), for any \(\varepsilon > 0\) there exist a sheaf and a \(W_1\) with \(\lVert W_1\rVert_2 < \varepsilon\) that increase the energy.

The asymmetry is the point. A GCN-like model cannot help but smooth when its weights are small; a sheaf convolution with non-symmetric maps can raise energy using an arbitrarily small transformation. It is not obliged to converge into the kernel — so a wrong learned sheaf is recoverable.

Learning the sheaf

The model discretises to

\[ X_{t+1} = X_t - \sigma\!\left(\Delta_{\mathcal{F}(t)}\big(I_n \otimes W^t_1\big)X_t W^t_2\right), \]

with the sheaf itself time-varying and learned: \(\mathcal{F}_{v \trianglelefteq e:=(v,u)} = \Phi(x_v, x_u)\), implemented as \(\sigma(V[x_v \Vert x_u])\) reshaped into a \(d \times d\) block. \(\Phi\) must be non-symmetric in its arguments, or the model cannot express the asymmetric transports Proposition 10 needs. Setting \(W_1, W_2\) to identity and \(\sigma = \mathrm{id}\) recovers plain sheaf diffusion, so the model inherits every guarantee above.

Proposition 18: if all edge feature-pairs are distinct and \(\Phi\) has enough capacity, it can learn any sheaf on the graph. That is the stated justification for re-learning the sheaf at every layer — aggregation makes more nodes distinguishable, so later layers can express sheaves earlier ones could not.

Three parameterisations, with real trade-offs:

ParameterisationComplexityCharacter
Diagonal\(O(nc^2 + mdc)\)fewest parameters, sparse blocks; stalk dimensions interact only through the left multiplication by \(W_1\)
Orthogonal\(O(n(c^2+d^3) + m(cd^2+d^3))\)built from Householder reflections; mixes stalk dimensions, constrains overfitting, and the diagonal blocks are just node degrees so normalisation is numerically easy
Generalsame as orthogonalmaximally flexible; \(D^{-1/2}\) needs an SVD whose gradients can be infinite when \(D\) has repeated eigenvalues, so it is the hardest to train

Here \(c = d \times f\) is the total representation size, against GCN’s \(O(nc^2 + mc)\). With \(1 \le d \le 5\) in practice the overhead is effectively a constant factor.

Results

The synthetic experiment is the cleanest evidence in the paper. On a connected bipartite graph with features from two overlapping isotropic Gaussians — deliberately not separable at \(t = 0\) — two \(d=1\) diffusions are compared: one with general maps, one constrained to \(\mathcal{F}_{v\trianglelefteq e} = \mathcal{F}_{u \trianglelefteq e}\) (i.e. a weighted graph Laplacian). The symmetric one cannot fit the data, exactly as Proposition 9 requires. The general one separates the classes as diffusion time grows, and a histogram of the learned transports \(\mathcal{F}_{v\trianglelefteq e}^{\top}\mathcal{F}_{u\trianglelefteq e}\) shows them negative on every edge. The model rediscovers the construction of Proposition 10 on its own.

On the nine real datasets (homophily 0.11 to 0.81, Pei et al.’s 10 fixed 48/32/20 splits):

Dataset\(h\)Diag-NSDO(\(d\))-NSDGen-NSDBest baseline
Texas0.1185.6785.9582.97GGCN 84.86
Wisconsin0.2188.6389.4189.21GGCN 86.86
Film0.2237.7937.8137.80GGCN 37.54
Squirrel0.2254.7856.3453.17GGCN 55.17
Chameleon0.2368.6868.0467.93GGCN 71.14
Cornell0.3086.4984.8685.68GGCN 85.68
Citeseer0.7477.1476.7076.32Geom-GCN 78.02
Pubmed0.8089.4289.4989.33GCNII 90.15
Cora0.8187.1486.9087.30GCNII 88.37

First on five of the six datasets with \(h \le 0.30\), second on Chameleon, and among the top three on eight of nine overall — the exception being Cora, where it lands sixth. The size of the heterophilic gap is worth staring at: on Texas and Wisconsin, GCN and GAT score in the low 50s while an MLP that ignores the graph entirely gets 80.8 and 85.3. The graph is actively harmful to models that assume homophily. NSD is the model that uses it and still wins.

\(O(d)\)-NSD is best overall, consistent with the theory: orthogonal maps get the wider class capacity at fixed \(d\), and the constraint doubles as regularisation. But Diag-NSD is close everywhere and wins outright on Cornell and Citeseer — an early sighting of a pattern later papers keep re-encountering.

What the theory does and does not cover. Every separation result above concerns the infinite-time limit of the linear diffusion, for almost all initial conditions. The trained model has finite depth, learned weights, nonlinearities, and a sheaf that changes each layer. Diffusion converges exponentially, so the finite-depth reading is defensible — but a theorem about \(\Delta_{\mathcal{F}}\) is not automatically a statement about the network. The paper is careful here; secondary accounts often are not. The authors also name the real gap themselves: none of this addresses generalisation.

Where it sits

Two framings from the related work are worth keeping. The layer is a form of GNN-FiLM: each node learns a linear message function conditioned on its neighbour’s features. And relative to GAT the difference is exactly one of type — for a pair \((v,u)\), GAT learns a scalar attention coefficient \(a_{vu}\), while NSD learns the matrix block \((v,u)\) of \(\Delta_{\mathcal{F}}\).

Scalar reweighting versus matrix transformation. Nearly every subsequent sheaf paper is a variation on that one substitution.

✅ Key Takeaways

  • A standard GNN is heat diffusion under a trivial sheaf — \(d=1\), identity restriction maps. Oversmoothing and heterophilic failure are two symptoms of that one unexamined choice.
  • Sheaf diffusion converges into \(\ker(\Delta_{\mathcal{F}}) \cong H^0(G;\mathcal{F})\), and \(\dim H^0 \le d\) (Lemma 6). Stalk width, not feature width, caps what the limit can express.
  • The hierarchy is sharp: symmetric scalar maps provably cannot separate a balanced bipartite graph; signed scalar maps handle 2 classes; diagonal maps handle \(C \le d\); orthogonal maps handle \(C \le 2d\).
  • Negatively-weighted edges for heterophily, previously a heuristic, are derived: transport \(-1\) across class boundaries is path-independent and polarises the classes.
  • Non-symmetric sheaves can increase Dirichlet energy using arbitrarily small weights (Prop. 17), so the model can escape a badly learned kernel — something GCN-like models cannot do.
  • Empirically \(O(d)\)-NSD is strongest, first on 5 of the 6 benchmarks with \(h \le 0.30\); diagonal maps are close behind at a fraction of the parameters.
  • Against GAT the difference is one substitution: a scalar attention weight becomes a matrix-valued transport.

References