GPA: General Principled Framework for Linearizing Softmax Attention via KV Cache Approximation

wang ning, Zekun Li, Tongxin Bai, Man Yao, Chunlei Men, Guoqi LiNeurIPS 2026

TL;DR

Standard Transformers keep a perfect diary of every word they’ve ever read, which eventually blows up your GPU memory and slows generation to a crawl. This paper maps out a rigorous five-step mathematical bridge from full Softmax attention to fixed-memory linear attention—viewing linear models simply as systematically compressed KV caches. Better yet, it gives us GPA, a recipe to retrofit existing massive LLMs into fast, constant-memory models using a fraction of the usual retraining budget.

What Problem Does This Paper Address?

If you’ve ever watched an LLM choke on a massive PDF, you’ve met the twin curses of Softmax attention: quadratic compute scaling and an unbounded KV (Key-Value) cache—the rolling memory buffer that grows with every generated token.

Researchers have tried two main escape routes:

  1. KV-cache compression, which prunes or squishes tokens, though a fixed compression ratio still grows infinitely as sequences get longer.
  2. Linear attention (like Mamba or RWKV), which folds all past history into a fixed-size recurrent state, making per-token generation cost completely independent of prompt length.

The catch? Training linear models from scratch costs a fortune, and existing linear designs often feel like a bag of clever heuristics that struggle with exact recall. Converting pretrained Transformers into linear models (weight inheritance) is much cheaper, yet until now we lacked a clear theoretical map showing what Softmax information linear attention actually throws away, how approximation errors stack up across layers, and how to systematically close the accuracy gap.

Methods

Instead of inventing another isolated recurrent trick, the authors treat linearizing an LLM as a five-step, composable KV-cache compression pipeline. Together, these form GPA (General Principled Framework for Linearizing Softmax Attention):

  1. Deduplication & Counting: Identical (or highly similar) key-value pairs don't need duplicate slots. Merging them and tracking an explicit occurrence count is mathematically lossless for exact matches.
  2. Content–Position Decoupling: In the first layer, unique token embeddings are bounded by vocabulary size (e.g., 128K), until positional encodings (like RoPE) entangle them into unique vectors at every step. GPA separates pure content from position.
  3. Positional Compression: Rather than storing exact positions for every historical token, GPA compresses accumulated RoPE angles into a linear superposition, using a Taylor-style approximation whose error shrinks when the RoPE base frequency is large.
  4. Inter-layer State Propagation: Deeper layers mix tokens, threatening to explode the number of unique states again. By exploiting residual connections—where adjacent layers remain geometrically similar—GPA bounds how much state capacity deeper layers need.
  5. Multi-level Residual Decomposition: Even vocabulary-sized states are too big in practice. GPA uses a compact hierarchy of memory states (defaulting to two levels of 64 slots each): level one captures the main vector, and level two catches the leftover residual error, linked by a topological relation matrix.

To turn a pretrained Transformer into GPA, the authors swap out the attention mechanism, add practical readout refinements (learned sigmoid routing and multi-channel reading), and fine-tune the projection weights using standard LoRA.

Datasets

No new benchmarks are introduced. Instead, the authors convert pretrained backbones using established corpora and test them across a gauntlet of standard evaluations:

  • Continued Fine-Tuning: SlimPajama (for Mistral-7B) and FineWeb-edu (for Qwen2.5 and LLaMA-3).
  • Commonsense & General Knowledge: ARC-easy/challenge, HellaSwag, PIQA, WinoGrande, and MMLU.
  • Long-Context & Retrieval Stress Tests: LongBench, Passkey Retrieval, S-NIAH (Single-Needle-in-a-Haystack), BABILong, and information extraction tasks (SWDE, SQuAD, FDA).

Key Insights and Ideas

  • Linear attention is disguised vector quantization: Merging similar KV states while keeping an occurrence count turns out to be mathematically equivalent to the "Delta Rule" used in modern recurrent architectures.
  • Blame the data shift (partly) for MMLU drops: Linearized models notoriously tank on MMLU. By running controlled experiments, the authors show two culprits: fixed-state compression hurts, yes, but simply continuing to pretrain a dense Qwen2.5-7B model on FineWeb for 20B tokens drops its MMLU from 74.2 to 60.9—without any linearization at all!
  • Pure linear and hybrid attention are friends, not rivals: GPA isn't an all-or-nothing ideology. Dropping GPA into hybrid setups—either routing salient tokens to sparse Softmax within a layer (STILL) or keeping just 12.5% of full Softmax layers—rescues brutal multi-needle retrieval tasks where all purely linear models fail.

Key Results

GPA consistently beats prior converted linear baselines while needing equal or fewer training tokens:

  • Data-Efficient Conversion: On 7B models, GPA reaches a 61.3 average across commonsense/MMLU benchmarks using just 8B fine-tuning tokens, outperforming MVA (60.3), GSA (57.7), and GLA (56.5), which each burned 20B tokens.
Table 1: Comprehensive evaluation of GPA against state-of-the-art methods
  • Scaling Up: Converting LLaMA-3-70B with 10B tokens recovers nearly 95% of the original dense model's score (75.95 vs. 80.00 average), crushing the converted GSA baseline (60.18).
Table 2: Zero-shot and few-shot evaluation results on common language understanding benchmarks. ARC-c/e, HellaSwag, PIQA, and WinoGrande are evaluated in zero-shot setting, while MMLU uses 5-shot. AVG denotes the average accuracy across all tasks. A “+” token count denotes continued- training tokens.
  • Needle Retrieval: Converted GSA drops to 30% passkey accuracy at 4K context and 10% at 32K. GPA nails 100% through 4K and holds 80% at 32K. On S-NIAH-1 at 32K, GPA scores 91.2 vs. 8.2 for GSA.
  • Constant-Memory Speed: In Triton kernel benchmarks from 16K to 128K context, dense attention's single-layer KV cache swells from 258 MiB to 2050 MiB while latency climbs from 1.78 ms to 13.15 ms. GPA stays flat at ~5 MiB of state and ~2.33 ms per step, overtaking dense attention right past 16K tokens.

Limitations and Future Work

  • Hard recall hits a wall: On harder needle-in-a-haystack variants (S-NIAH-2 and 3), purely fixed-state GPA still struggles (e.g., 10.4% at 32K) unless paired with a small fraction of full Softmax layers (which jumps it to 99.8%).
  • Conversion gap & serial overhead: A noticeable accuracy gap on knowledge-heavy tasks like MMLU remains compared to untouched dense teachers. Furthermore, adding more residual memory levels shrinks approximation error exponentially in theory, but slows down execution due to serial computation.
  • Benchmark scope: The reported memory and latency numbers measure isolated attention kernels (equivalent to one layer) rather than end-to-end, 32-layer whole-model serving, and GPA requires extra workspace memory during the initial prompt prefill phase.

Summary updated

Abstract

Transformers excel at sequence modeling, yet Softmax attention incurs quadratic complexity and unbounded KV cache growth. While linear attention offers a promising alternative, existing approaches lack systematic functional comparison with Softmax attention, rigorous error analysis, and a theoretically grounded improvement roadmap. We address this gap by framing linearization as KV cache approximation and establishing a principled pathway from Softmax attention to linear models. Our analysis identifies five critical components—redundancy elimination, token-level quantization with positional separation, positional compression, inter-layer similarity, and multi-state decomposition—each accompanied by theoretical justification and error bounds, with explicit connections to existing mechanisms. Building upon this framework, we introduce GPA, a linearized attention model that inherits pretrained weights and achieves state-of-the-art results. GPA outperforms strong baselines including MVA and GSA across multiple benchmarks, while requiring less fine-tuning resources. Our work provides both theoretical clarity and practical guidance for advancing linear attention, charting a principled course toward efficient, scalable alternatives to Softmax attention.
BibTeX
@inproceedings{ning2026gpa,
  author = {wang ning and Zekun Li and Tongxin Bai and Man Yao and Chunlei Men and Guoqi Li},
  title = {{GPA: General Principled Framework for Linearizing Softmax Attention via KV Cache Approximation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ROPnDwfm3N},
}
Figure