Higher-order Linear Attention

Yifan Zhang, Zhen Qin, Quanquan GuarXiv 2025 · DOI

Introduction

The rapid advancement of Large Language Models (LLMs) has been primarily driven by the Transformer architecture. However, the Transformer's core mechanism—Softmax Attention—suffers from a "quadratic bottleneck," where computational costs grow at $O(n^2)$ relative to sequence length. While Linear Attention and State Space Models (SSMs) offer $O(n)$ alternatives, they often struggle with an "expressivity gap," failing to capture the complex, high-order interactions that make standard Transformers so effective.

This paper introduces Higher-order Linear Attention (HLA), a novel architectural framework designed to provide the expressivity of quadratic attention with the efficiency of a Recurrent Neural Network (RNN). HLA enables constant-time inference and linear-time training while maintaining strict causality, offering a principled path toward scaling models for long-context applications.

The Challenge of Linear Efficiency

Traditional linear attention models are typically "first-order," meaning they simplify relationships between tokens into basic summaries. This simplification often results in a loss of nuance, particularly in tasks requiring complex reasoning or long-term memory. The fundamental challenge addressed by HLA is how to incorporate higher-order interactions—such as the relationships between pairs of keys and queries—without re-introducing quadratic complexity.

Methodology: Higher-order Interactions

The core innovation of HLA lies in its move beyond simple weighted sums. By incorporating higher-order interactions into the model’s internal state, HLA captures a richer representation of the data.

1. Prefix Sufficient Statistics

Rather than storing a full $n \times n$ attention matrix, HLA utilizes "moments" or compact summaries of the data. For a second-order HLA model, this involves maintaining sums of outer products ($kk^\top$). This approach allows the model to factorize complex operators into manageable "running totals."

2. Causal Masking via Extended Summaries

Maintaining strict causality—ensuring that a model cannot "see" future tokens during training—is mathematically complex in higher-order settings. The authors resolve this through the derivation of "extended summaries" ($G_t$ and $h_t$). This "Masked Streaming Identity" (Theorem 3.1) allows the model to algebraically subtract future influences, ensuring the computation remains strictly causal and efficient.

3. Parallel Training via Associative Scans

To ensure high performance on modern hardware, HLA is formulated as an "associative scan." This mathematical property allows the model to be trained in parallel across data chunks, achieving the speed of Transformers during training while behaving like a serial recurrence during inference.

Theoretical Insights and Complexity

HLA occupies a unique position in the memory-expressivity trade-off. While it requires more memory than basic linear attention—$O(d^2)$ versus $O(d)$—it remains significantly more efficient than standard Transformers for long sequences.

  • Constant State Size: In second-order HLA, the state size is $O(d^2)$ per head, which is independent of the sequence length ($n$).
  • Linear Complexity: The per-token computational cost is $O(d^2 + d \cdot d_v)$, facilitating high scalability.
  • Exact Equivalence: The authors provide a mathematical proof that the parallel training scheme produces outputs identical to the serial inference version.

Discussion and Limitations

As a purely theoretical and algorithmic contribution, this paper focuses on the mathematical derivation and complexity analysis of the HLA mechanism. Consequently, it does not provide empirical benchmarks on standard datasets (e.g., Pile or WikiText).

Future work is required to bridge the gap between theory and practice. Key areas for development include:

  • Empirical Validation: Testing HLA against established models like Mamba or standard Transformers in real-world language modeling tasks.
  • Hardware Optimization: Developing custom CUDA kernels to translate theoretical linear complexity into actual wall-clock speedups.
  • Memory Management: Exploring "multi-query" setups to mitigate the $O(d^2)$ memory overhead.

Conclusion

Higher-order Linear Attention represents a significant step forward in the design of efficient sequence models. By providing a mathematically rigorous way to incorporate higher-order interactions into a linear-time framework, HLA offers a promising alternative to the quadratic bottleneck of traditional Transformers.

Summary updated

BibTeX
@misc{zhang2025higher,
  author = {Yifan Zhang and Zhen Qin and Quanquan Gu},
  title = {{Higher-order Linear Attention}},
  year = {2025},
  eprint = {2510.27258},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.27258},
}
Figure