Horocyclic Feature Maps for Linear Attention: Testing Whether Negative Curvature Reduces Memory Crosstalk

Linear attention makes Transformers cheap on long inputs. Instead of comparing every token with every other token, it folds the whole history into one fixed-size matrix, and each new query reads from that matrix. The price is a well-documented performance gap: when the model must pull a specific fact back out of that compressed matrix, the facts bleed into one another. This note asks whether the geometry in which keys are compared can reduce that bleeding, specifically the curved, tree-like geometry of hyperbolic space (a space whose volume grows exponentially with radius, so branching hierarchies fit in few dimensions). We propose a linear-attention feature map built from the Poisson kernel of the hyperbolic ball. The feature map is positive, needs one matrix multiply plus elementwise operations, and induces a kernel that decays with hyperbolic rather than Euclidean distance.

The central bet is narrow and falsifiable. At a fixed memory budget, hyperbolic features should cut retrieval interference when the stored keys are hierarchically related, for example entities that share attributes or concepts that share ancestors. They should give no gain when keys are unstructured. If the gain shows up on hierarchical recall but vanishes on flat recall, we have identified a specific, cheap inductive bias for linear attention. If it shows up on both, or neither, the "hyperbolic memory capacity" story in the literature is overstated, and we will say so.

Core Claim

A linear-attention memory stores pairs as $S=\sum_i \phi(k_i)v_i^\top$, where $k_i$ are keys, $v_i$ values and $\phi$ a feature map of dimension $D$. Reading with key $k_j$ returns

$$\hat v_j=\phi(k_j)^\top S=\kappa(k_j,k_j)\,v_j+\sum_{i\neq j}\kappa(k_j,k_i)\,v_i ,$$

where $\kappa(x,y)=\phi(x)^\top\phi(y)$ is the kernel the feature map implies. The second term is crosstalk. The quality of recall depends on two things: how fast $\kappa$ decays between different stored keys, and how accurately a finite $D$ realizes $\kappa$.

Hierarchically related keys create a specific problem in low dimensions. A tree cannot be embedded into low-dimensional Euclidean space without distortion, so keys that are far apart in the tree are forced close together, and their kernel values stay large. This is the volume argument of Poincaré Embeddings for Learning Hierarchical Representations. In hyperbolic space the same keys can sit at distances roughly proportional to tree distance. If the kernel decays exponentially in hyperbolic distance, the crosstalk sum over the roughly $b^h$ keys at tree distance $2h$ (for branching factor $b$) converges once the decay rate beats $\ln b$.

Our claim is not that hyperbolic geometry enlarges the memory matrix. It does not: $S$ is still a $D\times d$ Euclidean matrix, and random-feature approximation error still sets a noise floor that shrinks only with $D$. The claim is that, for tree-structured keys, the exact-kernel part of the crosstalk is much smaller. The benefit should therefore appear precisely in the regime where that part dominates: small key dimension, moderate numbers of stored pairs, and deep hierarchies.

The feature map uses $D$ random boundary points $b_m$, drawn uniformly on the unit sphere. Each key is mapped into the Poincaré ball (the open unit ball with hyperbolic metric) by $x=\tanh(\|k\|)\,k/\|k\|$. The features are

$$\phi_m(x)=\left(\frac{1-\|x\|^2}{1+\|x\|^2-2\,b_m^\top x}\right)^{\alpha},$$

which is the hyperbolic Poisson kernel $P(x,b_m)$ raised to a learned power $\alpha>0$. Each feature is a horocyclic "plane wave": it is constant on horospheres, the hyperbolic analogue of flat wavefronts. The features are strictly positive, so linear-attention normalization works unchanged. The induced kernel is an inner product of features and is therefore automatically positive definite. This sidesteps the "geodesic trap" identified by Kernel Methods in Hyperbolic Spaces, which showed that plugging geodesic distance into an RBF kernel gives an indefinite kernel.

The only coupling between keys and boundary points is the dot product $b_m^\top x$. Computing all features is therefore one GEMM (a dense matrix multiply) plus elementwise log and exp. That is the same cost class as Performer-style random features, which avoids the transcendental-heavy Möbius arithmetic the hyperbolic literature flags as a wall-clock problem. We compute $\log\phi$ in log space, using $1-\|x\|^2=\mathrm{sech}^2\|k\|$, to stay away from the boundary overflow that plagues Poincaré models.

Relation to Prior Work

Two hyperbolic papers supply the method. Random Laplacian Features for Learning with Hyperbolic Space (HyLa) builds random features from hyperbolic plane waves, the eigenfunctions of the Laplace–Beltrami operator. It uses them as a one-time input transform for graph nodes feeding shallow Euclidean models. We reuse the plane-wave idea, but in a positive real-exponent form and inside every attention layer as the key/query feature map, which HyLa never considers. Hyperbolic Associative Memory Networks motivates the capacity question. It proves that separated-pattern capacity grows exponentially with hyperbolic radius and reports 47.25% WordNet hypernym accuracy against roughly 20–25% for Euclidean Hopfield networks. However, its retrieval is iterative Riemannian optimization, not a single-pass causal memory. We test whether any of that advantage survives when the memory is the fixed linear-attention matrix.

The closest existing systems constrain the design and also show the obvious idea is partly taken. Hypformer already runs linear attention fully in the Lorentz model and scales to Papers100M. Its focusing step, though, is the Euclidean power function from FLatten Transformer applied to the space-like coordinates, and it is evaluated on node and document classification, never on recall. HyLiFormer uses softmax-type similarity over Poincaré-projected skeleton features. HMamba puts a state-space recurrence in hyperbolic space for recommendation. THG keeps quadratic attention over hyperbolic queries and keys. None of these derives the linear-attention kernel from hyperbolic harmonic analysis, and none measures the retrieval crosstalk that defines the performance gap. Our contribution is that measurement together with a kernel designed for it, not "a hyperbolic linear Transformer" as such.

On the linear-attention side, three papers motivate the problem by documenting the gap as lossy compression into a fixed state: Simple linear attention language models balance the recall-throughput tradeoff, Fast weight programming and linear transformers, and Mamba with Hierarchical Memory. The last of these names "semantic aliasing," where distinct histories become indistinguishable on a bounded state manifold. Our crosstalk term is a concrete version of that aliasing. Two further papers show that Euclidean fixes can work: SLAY reaches validation loss 4.6760 against softmax's 4.6417 on GPT-2 small with spherical kernels, and Scaling Linear Attention Capacity with Sparse State Expansion partitions the state into 16 sub-matrices. Both define the bar we must clear. Revisiting Associative Recall in Modern Recurrent Models constrains how we evaluate. It shows that recall failures in recurrent models are often learning-rate brittleness rather than capacity, so every comparison here must use a learning-rate sweep.

Research Program

The work has three parts. The first is a kernel study, done before any training. For keys drawn from synthetic $b$-ary trees embedded in the ball at several depths, we measure two things. One is how close the induced kernel $\kappa$ is to a function of hyperbolic distance, since the real-exponent features are not guaranteed to be exactly isometry-invariant; we compare against the complex-exponent HyLa construction, which is. The other is the crosstalk-to-signal ratio as a function of $D$, $\alpha$, curvature, number of stored pairs and tree depth, compared with Gaussian positive random features in Euclidean space and with FLatten's power map. This study should predict where trained models can and cannot benefit.

The second part trains small linear-attention models on recall tasks. Every model shares one codebase, and the only difference between arms is the feature map. The tasks are standard multi-query associative recall (MQAR, a synthetic test in which many key–value pairs appear in context and several are queried later) and a hierarchical variant we construct, in which keys are compositional paths in a random tree. We also include in-context ancestor retrieval over WordNet noun pairs: (child, parent) facts appear in context, and the model is asked for an ancestor one or more hops up. This last task also probes the multi-hop routing ceiling described by Transformers, parallel computation, and logarithmic depth.

The third part checks that the feature map does not damage ordinary language modeling. We use the GPT-2 small, 2.5B-token setting from SLAY, so our numbers sit next to reported ones.

Baselines

The naive reference point is plain linear attention with an elementwise positive feature map such as ELU+1, run through the same code. It establishes how large the gap is in our setup, and any method failing to beat it on hierarchical MQAR is uninteresting.

The key ablation is Performer-style Gaussian positive random features at identical $D$, identical key dimension and identical training. This isolates the one ingredient we change: curvature of the kernel versus a flat kernel of the same functional form and cost. We also run the curvature-to-zero limit of our own map, by scaling keys toward the origin. A gain counts only if it disappears as curvature goes to zero.

The strongest Euclidean competitors are three. The first is the second-order Taylor feature map of BASED, with and without its 64–128 token sliding window. The second is FLatten's power map with $p=3$. The third is SLAY's spherical kernel. Each gets the same tokens and model size and the same learning-rate sweep width. That sweep width matters given Revisiting Associative Recall in Modern Recurrent Models.

For language modeling the reported bar is SLAY's validation loss of 4.6760 against 4.6417 for softmax, with Performer at 5.4524 and Cosformer at 5.1983, all from SLAY. Matching or beating 4.6760 there would show the feature map costs nothing on general text. For MQAR, the file records that BASED beats Mamba by 10.36 accuracy points on recall-intensive tasks. It gives no per-configuration MQAR accuracy, so there is no reported result found on Lacuna for BASED on our exact MQAR configurations, and we will rerun it.

The closest hyperbolic competitor is Hypformer's focused hyperbolic linear attention, reimplemented as a drop-in attention module. There is no reported result found on Lacuna for Hypformer on MQAR or language modeling. Beating it would show that a harmonic-analysis kernel matters, not just being in hyperbolic coordinates.

Beating the field means two things. First, higher hierarchical-MQAR and WordNet-ancestor accuracy at matched state size, across the full learning-rate sweep and not just at the best point. Second, a flat-MQAR result statistically indistinguishable from the Gaussian-feature ablation.

Why not just…?

Why not just keep a few softmax layers or a sliding window, as BASED and SSE-H do? This is the real threat for practical recall. Scaling Linear Attention Capacity with Sparse State Expansion reports nearly 100% on 32k RULER with one softmax layer per five linear ones. A hybrid's retained softmax layers still scale quadratically, but in practice that matters only at extreme lengths. We therefore treat hybrids as complementary rather than as rivals. We run our feature map both pure and inside a BASED-style window hybrid. If the window erases all gains on hierarchical recall, the honest conclusion is that curvature buys nothing a window does not, and we will report it that way.

Why not just sharpen the Euclidean kernel with FLatten's power function, a Taylor expansion, or SLAY's spherical kernel? Sharpening makes the kernel decay faster, but it does not remove crowding: if tree-distant keys are embedded close together in low dimensions, a sharper kernel still sees them as close. The flat-versus-hierarchical MQAR contrast settles this directly. Our prediction is that sharpening helps both tasks about equally, while hyperbolic features help only the hierarchical one. If FLatten with a larger power matches us on hierarchical recall, the curvature hypothesis fails.

Why not just make the state bigger, with a larger key dimension or more random features? This is the cheapest alternative, and it may well work: random-feature noise falls with $D$, and crowding eases with dimension. We therefore plot accuracy against state size for every arm. We report the result as an exchange rate, that is, how much Euclidean state matches hyperbolic state at $D$. A factor near 1 means the idea is not worth its complexity. A large factor on deep hierarchies is the result that would justify it.

Why not just apply HyLa once at the input and run ordinary Euclidean linear attention? Random Laplacian Features for Learning with Hyperbolic Space shows this works for static graph features. In attention, however, the keys are recomputed at every layer by learned Euclidean projections. Nothing then forces the compared quantities to retain hierarchical separation. We include exactly this arm: hyperbolic input embeddings, Euclidean feature maps throughout. If it matches us, the per-layer kernel is unnecessary.

Decisive Experiments

The first decisive check is a two-by-two design: feature map (horocyclic versus Gaussian, matched $D$) crossed with key structure (tree-structured versus uniformly random keys). Within it we sweep the number of stored pairs, tree depth and branching factor, with five seeds and a full learning-rate sweep per cell. The hypothesis survives only if three things hold. The hierarchical cell shows an accuracy gap that widens with depth. The flat cell shows none. And the gap shrinks to zero in the curvature-to-zero ablation. The kernel study from the research program should predict at what depth the gap opens. Agreement between that prediction and the trained models would tie the gain to crosstalk rather than to an optimization accident.

The second check is in-context WordNet ancestor retrieval at one, two and four hops, evaluated against all baselines at matched state size. It tests whether the synthetic effect transfers to a real taxonomy and whether it extends past one hop.

The third check is GPT-2 small language modeling on 2.5B tokens, compared with SLAY's reported 4.6760. We also record wall-clock throughput against Performer, to confirm that the one-GEMM construction keeps hyperbolic features at linear-attention cost.

Secondary analyses follow from the same runs. One is the width of the learning-rate window in which each arm reaches high MQAR accuracy, which tests the speculation (from HMamba's faster convergence) that curvature eases the brittleness reported by Revisiting Associative Recall in Modern Recurrent Models. The other is whether learned query norms track hierarchy depth, as norms do in APo-VAE.