Linear Attention as Learned Hyperedges: Spectral Filtering for Heterophilic Hypergraphs

A hypergraph is a network in which one link, called a hyperedge, can join any number of nodes: a shopping basket joining many products, or a committee joining many legislators. The standard way to spread information over a hypergraph is a two-step random walk. You go from a node to one of its hyperedges, then to a random member of that hyperedge. Linear attention is the cheap variant of Transformer attention that avoids building the full token-by-token score matrix. It first summarizes all keys into a small table, then lets each query read from that table. This note starts from a simple observation: these two operations have the same algebraic form. Degree-normalized linear attention with $m$ feature dimensions is exactly the hypergraph random-walk operator of Zhou et al. applied to $m$ soft, learned hyperedges, where each feature coordinate says how strongly a token belongs to one hyperedge. We propose to use this identity rather than just note it. A single operator can then hold both the observed hyperedges and learned ones. Spectral graph theory then gives three things at linear cost: the exact spectrum of the attention operator, spectral filters that can be low-pass or high-pass, and a principled normalization that current linear attention omits.

The target application is heterophilic hypergraphs, where members of a hyperedge often belong to different classes (Walmart baskets, House and Senate committees). There, the usual smoothing diffusion washes out the labels. Existing fixes either pay quadratic cost to learn a new structure or anchor attention to the fixed observed structure. If the identity holds up in practice, one model could learn new group structure in linear time and learn whether to smooth or sharpen over it. That would address a known weakness of each field: hypergraph diffusion oversmooths under heterophily, and linear attention produces "blurry" maps that spread weight too evenly.

Core Claim

Let $\Phi(X) \in \mathbb{R}_{\ge 0}^{N \times m}$ be a nonnegative feature map applied to the $N$ node tokens. Treat its columns as $m$ soft hyperedges and concatenate them with the observed incidence matrix $H$, giving $\tilde H = [H \mid \Phi(X)]$. The operator we build is Zhou's normalized propagation on this combined incidence:

$$\Theta = D_v^{-1/2}\,\tilde H\, W\, D_e^{-1}\,\tilde H^{\top}\, D_v^{-1/2},$$

The symbols are defined as follows. $W$ is a diagonal matrix of hyperedge weights, which we learn separately for the observed block and the learned block. $D_e$ is the diagonal matrix of hyperedge sizes, meaning the column sums of $\tilde H$. $D_v$ is the diagonal matrix of weighted node degrees. Restricted to the learned block, this is linear attention between queries and keys that share one map $\Phi$. It computes $\Phi(\Phi^\top X)$ right-to-left in $O(Nmd)$ time, where $d$ is the feature width. The observed block costs $O(\mathrm{nnz}(H)\,d)$, where nnz is the number of nonzero incidence entries.

Two ingredients follow from the identity. Neither appears in current hypergraph Transformers.

The first is hyperedge-size normalization. Ordinary linear attention normalizes only by the query's total score, which plays the role of $D_v$. It has no counterpart to $D_e^{-1}$, which divides each feature coordinate by its total mass across all keys. This down-weights coordinates that fire on nearly every token, much like inverse document frequency in text retrieval. We hypothesize that this reduces the blurriness of linear attention maps documented by Zhi Jin et al., and we test it directly.

The second is exact, cheap spectral filtering of the learned part. The nonzero eigenvalues of the learned block $\Theta_\Phi$ equal those of the $m \times m$ matrix $M = W^{1/2}D_e^{-1/2}\Phi^\top D_v^{-1}\Phi D_e^{-1/2}W^{1/2}$, which can be formed in $O(Nm^2)$. Any spectral filter $g$ can then be applied exactly as $g(\Theta_\Phi)X = g(0)X + U\,(g(\Lambda)-g(0))\,U^\top X$. Here $\Lambda$ holds the $m$ eigenvalues of $M$, $V$ holds its eigenvectors, and $U = D_v^{-1/2}\Phi W^{1/2} D_e^{-1/2} V \Lambda^{-1/2}$ is the corresponding set of $N$-dimensional eigenvectors. The total cost is $O(Nmd + m^3)$. The "attention" can therefore be high-pass: it can push a node away from the average of its learned group instead of toward it, which is what heterophily calls for. On the combined operator, where the observed block may have tens of thousands of hyperedges, we use learnable Chebyshev polynomial filters of order $K$ as in HGNN. The coefficients are unconstrained in sign, so the filter can be high-pass.

What is new is the unification. The learned attention operator becomes a genuine hypergraph Laplacian, so hypergraph spectral tools apply to it, both for building the model and for diagnosing it.

Relation to Prior Work

The closest work is HyperGT. It treats nodes and hyperedges as tokens in one sequence, applies a kernelized Gumbel-softmax linear attention, adds positional encodings derived from $H$, and uses a loss that pulls attention toward the star expansion (the bipartite node–hyperedge graph). It reaches 69.83% on Walmart, against 45.67% for a vanilla Transformer. We differ in three ways. Our attention is itself a normalized hypergraph operator, not a free kernel regularized toward $H$. We add hyperedge-size normalization. And we filter spectrally, which allows high-pass behavior. HyperGT's regularizer anchors attention to the static incidence matrix. Under heterophily that anchor is precisely what one may want to escape.

HERALD motivates the proposal. It shows that fixed hypergraph Laplacians are suboptimal and learns a residual Laplacian from node–hyperedge soft assignments. However, it relies on quadratic node self-attention and does not analyze the learned spectrum. Our learned block plays the same residual-Laplacian role at linear cost, and its spectrum is available by construction.

Three works constrain the design. BHyGNN+ and Adaptive Expansion show that standard expansions fail on heterophilic hypergraphs, so a low-pass-only operator is ruled out. CCMamba linearizes higher-order message passing with directional state-space scans (sequence models that read tokens in a fixed order). It is spatial rather than spectral and needs an ordering. Our operator is permutation-equivariant and needs no scan. AllSet uses attention only within each hyperedge, so it cannot form new cross-hyperedge groups the way learned hyperedges can.

On the attention side, the method borrows from BASED the idea of choosing a feature map by polynomial approximation. We consider its second-order Taylor map as one candidate for $\Phi$, since it is nonnegative after the constant term is handled. Sanford et al. prove that sub-quadratic attention cannot match all-to-all routing. That result is a real limit here too: $m$ learned hyperedges give a rank-$m$ operator. We do not claim to escape it. We claim that heterophilic node classification needs a well-shaped low-rank operator, not full routing, and the rank sweep below tests that claim. Gai et al. show that spectral invariants add expressive power beyond one-hop message passing. This is part of why we expect spectral projections of the learned operator to be useful features, but we make no new expressivity claim.

Research Program

The build has three parts.

First, a layer that implements $\Theta$ on $[H \mid \Phi(X)]$ with sparse–dense kernels. It supports two filtering paths: exact eigen-filtering of the learned block via the $m\times m$ matrix $M$, and signed Chebyshev filtering on the combined operator. $\Phi$ is a small MLP followed by a nonnegative map. We compare three choices of that map: softplus, the BASED Taylor map, and a sparse top-$k$ softmax over the $m$ columns. The sparse option gives each node hard membership in few learned hyperedges.

Second, a diagnostic suite that exploits the cheap spectrum. For each trained layer we record the eigenvalues of $M$, the spectral gap, and the effective rank. We also record the learned filter response $g(\lambda)$, and per-node attention entropy as a direct measure of blurriness.

Third, a controlled synthetic study using a hypergraph stochastic block model, in which a planted parameter moves hyperedge membership from same-class to cross-class. This lets us measure how accuracy and the learned filter shape change with heterophily. We do not rely only on the handful of real heterophilic datasets.

We will analyze two predictions. On homophilic data the learned $g$ should be low-pass. On heterophilic data it should put negative or small weight on the top eigenvalues. If the filters stay low-pass on Walmart and Senate while accuracy still improves, the high-pass story is wrong and the gains come from somewhere else. We will report that outcome if it happens. The second prediction is that $D_e^{-1}$ normalization raises effective rank and lowers attention entropy relative to standard linear attention normalization, and that this tracks accuracy.

Baselines

The naive reference points are two. One is a vanilla Transformer over node features, which HyperGT reports at 45.67% on Walmart. The other is plain HGNN, the fixed low-pass Zhou operator with no learned hyperedges. It is reported at 81.6% on Cora and 80.1% on Pubmed. Beating these is necessary but says little.

The strongest existing method on Walmart is HyperGT, at 69.83% classification accuracy. It is also the most direct competitor because it is the other linear-cost hypergraph Transformer. We will rerun it with the authors' splits and settings, give it the same hyperparameter search budget in trials and GPU-hours as our model, and match parameter counts. Beating it means a mean accuracy gain over the reported and reproduced 69.83% that exceeds the standard deviation across at least five seeds. On House and Senate the strongest reported numbers in the file are from Adaptive Expansion: 81.09% on House at its 0.6 feature-noise setting and 59.82% on Senate at its 1.0 setting. We will reproduce those exact settings and compare there. HyperGT and BHyGNN+ report no exact numbers on these datasets in the file, so we rerun them under the same protocol.

On homophilic Cora, CCMamba reports 89.22% and about 87% at 32 layers. That is the depth-robustness bar. We do not need to beat it on Cora; we need to not collapse with depth and to stay within noise of it. HERALD is run where memory permits. It is the quality reference for a learned Laplacian, and on Walmart we expect it to run out of memory.

Three ablations isolate the key ingredients. The first removes learned hyperedges and keeps signed Chebyshev filtering on $H$ alone. The second keeps learned hyperedges but uses standard linear attention normalization, dropping $D_e^{-1}$. The third keeps everything but forces the filter to be low-pass. A fourth, non-learned control replaces $\Phi(X)$ with $k$-nearest-neighbour feature hyperedges, the construction HGNN uses for visual data.

Why not just…?

Why not just use HyperGT? HyperGT already delivers linear cost and strong Walmart accuracy. However, its attention is pulled toward the observed star expansion and is always a smoothing operation. If heterophily is the bottleneck, a model that can learn high-pass responses over learned groups should gain most on House, Senate, and the high-heterophily end of the synthetic sweep, and least on Cora. A uniform gain across all datasets would instead suggest a capacity or tuning effect. The head-to-head comparison at matched budget, broken down by heterophily level, settles this.

Why not just put a signed polynomial filter on the observed hypergraph and skip learned hyperedges? This is the most serious threat. A learnable high-pass Chebyshev filter on $H$ alone may capture most of the heterophily benefit at lower cost. It is the first ablation. If it matches the full model within noise on Walmart, House, and Senate, we will drop the learned-hyperedge claim and report the result as a filtering result. What the learned block uniquely offers is groupings absent from $H$. The synthetic study will therefore include a regime where the informative groups are deliberately not among the observed hyperedges. That regime shows whether the learned block adds anything at all.

Why not just add ordinary linear attention in parallel with an HGNN layer? This combination gives global mixing plus structure with no new theory. It differs from our model in exactly two ways: it lacks $D_e^{-1}$ normalization, and it keeps the two operators apart instead of normalizing them jointly, so learned and observed hyperedges do not share node degrees. The second ablation and a parallel-sum variant measure this directly. If neither loses accuracy or attention sharpness, the unification is cosmetic and we will say so.

Why not just build extra hyperedges from feature nearest neighbours? Feature-based hyperedges are free to compute and already standard in HGNN. Their weakness is that they are fixed before training and reflect input similarity rather than label structure. Under heterophily they tend to reproduce the homophily assumption in feature space. The $k$-nearest-neighbour control tests whether learning $\Phi$ end-to-end matters.

Proposed Experiments

Node classification uses Walmart, House, Senate, and Congress for heterophily and Cora, Pubmed, and CiteSeer for homophily, with the splits used by AllSet and HyperGT. We report mean and standard deviation over five or more seeds, plus the synthetic heterophily sweep. Beyond accuracy we measure wall-clock time per epoch and peak GPU memory on Walmart. Walmart has roughly 157,000 node-plus-hyperedge tokens, so the quadratic methods are expected to fail there, and we compare cost against HyperGT and CCMamba. We also vary depth from 2 to 32 layers on Cora and Walmart to test oversmoothing, and sweep the number of learned hyperedges $m$ from 16 to 512 to see where the rank limit implied by Sanford et al. starts to bind.

Three checks are decisive. The first is whether the full model beats HyperGT's 69.83% on Walmart and Adaptive Expansion's 81.09% and 59.82% on House and Senate under matched budgets. The second is whether it beats the "signed filter on $H$ only" ablation on the heterophilic sets and on the synthetic regime where informative groups are absent from $H$. If it does not, the core claim fails. The third is whether the learned filter responses turn high-pass as synthetic heterophily increases, and whether $D_e^{-1}$ normalization measurably lowers attention entropy and raises effective rank relative to standard linear attention normalization. Together these checks determine whether reading linear attention as a hypergraph Laplacian yields a better model or only a relabeling.