Linear Attention via Orthogonal Memory

Jun Zhang, Shuyang Jiang, Jiangtao Feng, Lin Zheng, Lingpeng Kong · DOI

Introduction

Standard Transformer models rely on "vanilla" attention, which has a computational cost that grows quadratically ($O(n^2)$) with the sequence length. While many "linear attention" alternatives exist, they often suffer from efficiency degradation when applied to causal (autoregressive) modeling—the kind used in GPT-style models. This creates a bottleneck for processing extremely long documents or maintaining long-term memory in AI agents.

The LAVO Framework

To address these challenges, the authors introduce LAVO (Linear Attention Via Orthogonal memory), which achieves linear complexity through three primary innovations:

  1. Context Compression via Orthogonal Decomposition (CODE): Instead of keeping every token in memory, LAVO projects the context into a fixed-size "orthogonal memory." By using orthogonal bases, the model ensures that the stored information is as distinguishable as possible, minimizing redundancy and maximizing the information entropy of the compressed state.
LAVO Architecture: Context compression via orthogonal decomposition.
  1. Context Dissecting: Recognizing that a global summary can miss fine-grained details, LAVO divides the context into multiple windows. It combines the global orthogonal memory with a "local attention" mechanism that focuses on the immediate neighborhood of a query.
  2. Embedded Position Encoding: To help the model understand the order of tokens across massive distances, relative position encodings are embedded directly into the local attention windows. This is crucial for extrapolation—the ability of a model to perform well on sequences much longer than those it saw during training.

Key Results and Scaling

LAVO was evaluated across a diverse range of tasks, including language modeling (PG-19), text-to-speech, and time-series forecasting.

Massive Scaling and Extrapolation

One of the most significant findings is LAVO's ability to handle a 128K context length on a single 80GB A100 GPU. Most models see their performance (perplexity) explode when they encounter sequences longer than their training window. However, as shown in the figure below, LAVO’s perplexity remains stable or even decreases as the context length grows from 8K to 128K, suggesting it effectively utilizes the extra information.

LAVO demonstrates stable perplexity even when scaling to 128K context lengths.

Performance Benchmarks

  • Speedups: In autoregressive generation tests at a 16K sequence length, LAVO achieved a 20.81x speedup over vanilla attention, surpassing FlashAttention (15.01x) in causal decoding.
  • Accuracy: On the Long Range Arena (LRA) benchmark, LAVO achieved the highest average score (59.74), outperforming specialized models like BigBird and Performer.
  • Language Modeling: On the PG-19 dataset, LAVO achieved a perplexity of 19.40 at a 16K test length, significantly lower than other linear models like ABC (147.43).

Conclusion

LAVO represents a significant step forward in efficient attention mechanisms. By using orthogonality as a compression principle, it packs more unique information into a smaller footprint than previous linear methods. While future work remains in optimizing IO-aware kernels and fine-tuning for short sequences, LAVO's ability to scale to 128K contexts makes it a powerful tool for long-form content generation and complex AI reasoning tasks.

Summary updated

BibTeX
@misc{zhang2023linear,
  author = {Jun Zhang and Shuyang Jiang and Jiangtao Feng and Lin Zheng and Lingpeng Kong},
  title = {{Linear Attention via Orthogonal Memory}},
  year = {2023},
  eprint = {2312.11135},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.11135},
}
Figure