Linear attention replaces the softmax in a Transformer with a feature map, so that each head keeps a fixed-size running summary of the past instead of a cache that grows with every token. The best-performing versions use a second-order (quadratic) feature map, which approximates the exponential inside softmax well enough to recover the ability to look up a specific earlier token. That ability is called associative recall. The catch is that second-order features multiply every pair of feature coordinates, so each head's memory grows with the square of its width. The field currently has two options. One is to pay the full $d^2$ cost, as the BASED language model and Higher-order Linear Attention do. The other is to keep only the squared diagonal terms and discard every cross-feature product, as QT-ViT does. Nobody has measured what is lost in between, at a fixed memory budget.
We propose a third option that makes the memory budget an explicit knob. Each head learns $m$ directions, projects queries and keys onto them, and squares the projections. This gives a feature map whose size is $m$ rather than $d^2$. Its attention scores are always non-negative, and it still mixes all $d$ input coordinates. The core claim is empirical and falsifiable. At equal recurrent-state size, squared-projection features should beat diagonal-only features and randomized polynomial sketches on multi-query associative recall. They should also match the full second-order expansion at several times less state. We will test the claim against the obvious cheaper fix, which is to shrink the input width before taking the full expansion.
Core Claim
Write $q, k \in \mathbb{R}^d$ for a head's query and key, and $A \in \mathbb{R}^{m \times d}$ for a learned matrix with rows $a_j$. The proposed feature map and the attention kernel it induces are
$$\phi(x) = \big[(a_1^\top x)^2, \dots, (a_m^\top x)^2\big], \qquad \phi(q)^\top \phi(k) = \sum_{j=1}^m (a_j^\top q)^2 (a_j^\top k)^2 .$$
The kernel is a sum of products of squares, so it is never negative. The row-wise normalizer of linear attention therefore stays positive by construction.
If the rows of $A$ are random Gaussian vectors, the expected kernel works out to
$$\mathbb{E}\,\phi(q)^\top\phi(k) = m\left(\|q\|^2\|k\|^2 + 2\,(q^\top k)^2\right).$$
This follows from Isserlis' theorem for fourth moments of Gaussians. So the map carries the $(q^\top k)^2$ term that the second-order expansion of $\exp(q^\top k)$ needs, plus a norm term that normalizes away when keys have controlled norm. With learned rows, the map instead chooses which second-order interactions to keep.
The recurrent state is $m \times d_v$ rather than $d^2 \times d_v$, where $d_v$ is the value width. Constant and linear features can be appended at cost $1 + d$ to complete the Taylor structure.
The difference from prior work is where the budget goes. The diagonal map of QT-ViT is the special case in which $A$ is the identity. It keeps each $x_i^2$ and nothing else, and its authors say they had no principled way to choose which Kronecker terms to keep. The full expansions in BASED and Higher-order Linear Attention keep all $d^2$ products. HLA explicitly names this $O(d^2)$ state as an open bottleneck. Our map interpolates between the two with a learned, budget-controlled choice of interactions.
Relation to Prior Work
Three papers motivate the gap. Zoology attributes 82% of the perplexity gap between gated-convolution models and Transformers to associative-recall errors. Context-dependent sparse attention (HAX) proves that fixed-state recurrent models need state that grows with context to solve multi-query joint recall. Together these tell us that recall is the capacity that matters, and that state size is the resource being spent. BASED shows that a second-order Taylor kernel plus a 64–128 token sliding window recovers much of that recall. It does not ask how much of its quadratic state is actually used.
Two lines of work supply candidate methods and constrain our design. Tensor Sketch compresses polynomial kernels with Count Sketch and fast Fourier transforms. It is the natural randomized competitor, but its estimator is signed and its variance grows with degree. In attention, a signed estimate can drive the normalizer toward zero or below. That is the reason we insist on squared features and treat Tensor Sketch as a baseline rather than the method. Coordinated sampling shows that dense random projections lose sparsity and ignore the softmax normalizer. Our design keeps the normalizer well-defined, although it does not exploit sparsity.
Degrees of Freedom for Linear Attention finds that the useful feature dimension varies strongly across layers, but it studies only first-order maps distilled from a softmax teacher. Its finding suggests that $m$ should vary by layer. We will measure the effective dimension of the learned second-order features without a teacher.
Lightning Attention supplies the execution scheme: tiled intra-block parallel products combined with an inter-block recurrence. Our map is a pointwise feature transform, so it drops into that scheme and into the BASED kernels unchanged. MetaLA argues that keys are redundant given decay and queries. It works only with first-order maps, and we do not adopt its key removal.
Research Program
The first step is to build the layer. The squared-projection map, with optional constant and linear terms, will sit inside the BASED architecture so that the sliding window, decay, and kernels are held fixed. We will run three initializations of $A$: identity-padded (starting from the QT-ViT diagonal), random Gaussian, and random Fourier/sign structured. Training is from scratch with no teacher.
The second step is to define a single accounting unit: floats in the recurrent state per head. Every method will be compared on a sweep of this unit. The full Taylor map at input width $d$ costs roughly $d(d+1)/2$ features. The diagonal map costs $2d+1$. Projected Taylor at width $r$ costs roughly $r(r+1)/2$. Tensor Sketch and squared projection each cost $m$.
The third step is analysis. For trained models we will measure three quantities per layer: the spectrum of the learned $m$-dimensional features, the fraction of kernel mass carried by cross-coordinate interactions, and the minimum normalizer value along sequences. These test whether the method's gains actually come from cross-feature terms and from positivity. If the effective dimension varies across layers, a follow-up experiment will reallocate $m$ per layer at a fixed total budget.
Baselines
The naive reference is first-order linear attention with the same sliding window, in the style of Lightning Attention. It shows what second-order features buy at all.
The strongest existing method is full second-order Taylor linear attention with a short exact sliding window, which is BASED. It is the strongest competitor because it is the published system that already closes most of the recall gap at linear cost. The file reports that at 1.3B parameters BASED beats Mamba by 10.36 accuracy points on recall-intensive tasks (MQAR, SWDE, FDA). We found no reported MQAR accuracy for BASED at a specific state size on Lacuna. We will therefore rerun it ourselves with identical data, token count, window size, optimizer, and a matched hyperparameter search. Beating it means matching its recall and perplexity with at most one quarter of its state, or exceeding its recall at equal state.
The diagonal-only map of QT-ViT is run at its natural size $2d+1$ and, by widening $d$, at larger matched budgets. Signed Tensor Sketch features are run at each budget $m$ with the same normalizer. Beating the diagonal map at equal state is the minimum bar. Beating the Tensor Sketch at equal state, while also showing fewer normalizer failures, tests our argument that positivity matters.
Three ablations isolate the key ingredients. The first freezes $A$ at random initialization, which separates the benefit of learning which interactions to keep from the benefit of random mixing alone. The second replaces squares with signed products $(a_j^\top q)(b_j^\top k)$, removing positivity while keeping learned mixing. The third is projected Taylor, which shrinks the width to $r$ and then takes the full expansion. It is the most dangerous competitor and is discussed below.
Exact softmax attention with FlashAttention-2 serves as the quality ceiling.
Why not just…?
Why not just project the head down to a small width $r$ and take the full Taylor expansion there? This is the serious threat. It uses the same parameter budget and is trivially easy to implement. Its limitation is structural: every second-order interaction it keeps lives inside one $r$-dimensional subspace of the key space. Squared projection can place its $m$ directions anywhere across all $d$ coordinates. Nothing in the file shows which constraint matters more for recall, so this proposal settles the question directly by running projected Taylor at every matched budget on MQAR and The Pile. If projected Taylor matches squared projection, we will report that the simple compression suffices. The contribution then reduces to the budget-matched characterization, which is still useful because it quantifies how much of BASED's quadratic state is wasted.
Why not just keep the head dimension small? Zoology and HAX tie multi-query recall to state size, so shrinking $d$ spends the same resource we are trying to conserve. It is also dominated by the projected-Taylor baseline, which shrinks width only for the second-order part. Our state sweep contains this option as its low-budget points.
Why not just use the diagonal terms, as QT-ViT does? QT-ViT reports 84.7% ImageNet top-1 at 5.26G FLOPs, so the diagonal map works for vision. However, it was never tested on causal recall, and its authors acknowledge the subset was chosen heuristically. Its diagonal map is the identity-initialized special case of our method. If learning $A$ never moves far from the identity and recall is unchanged, the diagonal map is sufficient, and the measurements would show exactly that.
Why not just add more exact attention (sliding windows or sparse layers)? Hybrids work: Zoology's hybrids close 97.4% of the perplexity gap. But a 64–128 token window cannot help once the needed key-value pair lies outside it, and at that point the recurrent state carries recall alone. We therefore hold the window fixed across all methods and evaluate recall at key-query distances beyond the window.
Proposed Experiments
The primary testbed is synthetic multi-query associative recall following the Zoology protocol. We will sweep sequence length, number of key-value pairs, and state floats per head, and record accuracy only for queries whose matching key lies beyond the sliding window. The decisive plot shows accuracy against state size for all methods. The claim holds if the squared-projection curve dominates the diagonal, Tensor Sketch, and projected-Taylor curves and reaches the full-Taylor plateau at no more than a quarter of its state. For context, HAX reports 74.3% on multi-query joint recall against 36.6% for Mamba2. We will include that task to place our models relative to a sparse-attention hybrid.
Second, we will pretrain 360M-parameter models on 10B tokens of The Pile, matching the Zoology and BASED setups. Evaluation covers perplexity, the LM Eval Harness tasks, and the recall-heavy SWDE, FDA, and SQuAD tasks used by BASED. The comparison is at two state budgets, and a 1.3B-parameter confirmation run follows only if the 360M results separate the methods.
Third, we will measure prefill and generation throughput and memory against the BASED kernels. The goal is to confirm that smaller state converts into wall-clock gains rather than mere FLOP savings. For reference, BASED reports 24x generation throughput over FlashAttention-2.
Finally, a small transfer check will replace QT-ViT's diagonal map with squared projection in the same EfficientViT backbone on ImageNet-1k. This tests whether cross-feature terms help where the diagonal map is already known to work.
Two outcomes would falsify the proposal. One is projected Taylor matching squared projection across budgets. The other is frozen random $A$ matching learned $A$, which would mean learning which interactions to keep adds nothing.
References
- QT-ViT: Improving Linear Attention in ViT with Quadratic Taylor Expansion
- Simple linear attention language models balance the recall-throughput tradeoff
- Higher-order Linear Attention
- Zoology: Measuring and Improving Recall in Efficient Language Models
- Overcoming Long Context Limitations of State Space Models via Context Dependent Sparse Attention
- Tensor Sketch: Fast and Scalable Polynomial Kernel Approximation
- Matrix Product Sketching via Coordinated Sampling
- Degrees of Freedom for Linear Attention: Distilling Softmax Attention with Optimal Feature Efficiency
- Various Lengths, Constant Speed: Efficient Language Modeling with Lightning Attention
- MetaLA: Unified Optimal Linear Approximation to Softmax Attention Map