The Key to Going Linear: Analysis-Driven Transformer Linearization

Anna Kuzina, Paul N. Whatmough, Babak Ehteshami Bejnordi

TL;DR

Post-hoc linearization allows us to convert quadratic-time attention into efficient linear-time mechanisms without retraining a model from scratch. This paper provides a first-order mathematical proof showing that softmax attention naturally operates via key-dependent, rank-1 orthogonal projections—explaining why delta-rule networks inherently outperform pure gated accumulation. By combining this insight with targeted structural interventions like sink tokens and short convolutions, the authors successfully linearize large language models up to 32B parameters with minimal performance loss.

What Problem Does This Paper Address?

As large language models (LLMs) scale to longer contexts, standard causal self-attention becomes a massive computational bottleneck due to its quadratic ($O(T^2)$) time and memory complexity. "Post-hoc linearization"—swapping out the full-attention blocks of a pretrained model for linear recurrent updates—offers a way to achieve subquadratic inference without expensive pretraining from scratch.

However, existing linearization pipelines typically combine a "kitchen sink" of techniques all at once (such as low-rank adaptation, sliding window attention, distillation, and hybrid routing). This makes it impossible to isolate a fundamental architectural question: Which linear state update mechanism actually approximates pretrained softmax attention best?

Methods

To isolate the true capacity of different linear attention mechanisms, the authors introduce a strict frozen-backbone regime. The pretrained model's core weights ($W_q, W_k, W_v$) and RMSNorm layers remain entirely frozen; only the newly introduced parameters specific to the linear replacement mechanism are trained.

The authors evaluate three primary families of linear attention (illustrated in the architecture blocks below):

  1. Kernelized Linear Attention (Hedgehog): Replaces the softmax kernel with learned feature maps.
  2. Gated Linear Attention (GLA): Introduces an input-dependent diagonal forget gate.
  3. Gated Delta Networks (GDN): Augments gated linear attention with a delta-rule update that utilizes a rank-1 operator constructed from keys.
Figure 1: Attention replacement blocks evaluated in our strict frozen-backbone setting. Blue

To bridge the remaining approximation gaps, they progressively reintroduce minimal structural interventions:

  • Disjoint Sliding Window Attention (SWA): Handles local context efficiently.
  • Sink Tokens: Dedicates a tiny fraction of the cache budget to the very first tokens in a sequence.
  • Short Convolutions: Enhances representational capacity right before the linear layers.

Datasets

  • Training: The replacement blocks were trained on the DCLM-Edu dataset using 10M tokens with a sequence length of 4096.
  • Downstream Evaluation: Evaluated on common reasoning benchmarks (PIQA, ARC-Easy, ARC-Challenge, HellaSwag, WinoGrande), 5-shot MMLU, and LAMBADA.
  • Long-Context Evaluation: Tested using S-NIAH (Synthetic Needle-in-a-Haystack) and an extended RULER benchmark.
  • Analysis: Mean squared error (MSE) diagnostics were calculated using a random subset of 8,000 sequences from the Clean Alpaca dataset.

Key Insights and Ideas

  • The Geometry of Softmax: Through a first-order Taylor expansion, the authors prove that softmax attention naturally applies a key-dependent, rank-1 orthogonal projection. It actively suppresses hidden state components that align with previous keys.
  • Why Delta Rules Win: Because Gated Delta Networks (GDN) explicitly use a rank-1 delta update rule $(I - \beta_t k_t k_t^\top)$, they natively implement the exact geometric correction required to mimic softmax. Conversely, pure gated models (like GLA) rely on key-independent decay, missing this vital property.
  • The Early-Sequence Bottleneck: The mathematical derivation reveals a uniform bias term ($1/t$) inherent to softmax that standard linear models omit. When $t$ is small (at the beginning of a sequence), the approximation error spikes dramatically. This explains why allocating just a few slots in the cache budget to "sink tokens" drastically stabilizes the model.

Key Results

  • GDN Outperforms the Rest: In the strict frozen-backbone setting, delta-style updates (GDN) consistently achieved lower layerwise and tokenwise MSE compared to GLA and Hedgehog.
  • Massive Recovery via SWA and Sinks: Introducing a fixed cache budget of 64 tokens—split into 56 sliding-window tokens and 8 sink tokens—dramatically recovered downstream performance. For Llama 3.1 8B, GDN + SWA + Sink boosted MMLU accuracy from 27.55% to 58.88%.
  • Closing the Gap with Short Convolutions: Adding short convolutions allowed the linearized models to nearly match full attention. On Llama 3.1 8B, the final recipe achieved a Common Reasoning average of 73.77% (vs. 73.98% for full attention) and outperformed prior post-hoc baselines like LoLCATs and Liger-GLA on MMLU while using significantly fewer training tokens (0.01B vs 0.04B).
  • Consistent Scaling: The authors successfully scaled this approach up to Qwen3-32B, proving that the linearization performance scales consistently with backbone size.

Limitations and Future Work

  • Theoretical Assumptions: The first-order Taylor approximation relies on the assumption that keys are directionally concentrated around a mean direction, which may not hold uniformly across all layers or during very short prefixes.
  • Multi-Item Retrieval Weakness: While the fixed-budget cache routing strategy excels at question-answering and data aggregation, it is weaker on long-context tasks that require tracking multiple independent memory items in parallel (e.g., multi-query retrieval). The authors note that combining GDN with content-aware, adaptive token retention is a promising direction for future work.

Summary updated

BibTeX
@inproceedings{kuzina2026key,
  author = {Anna Kuzina and Paul N. Whatmough and Babak Ehteshami Bejnordi},
  title = {{The Key to Going Linear: Analysis-Driven Transformer Linearization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=bekG7rxPRG},
}
Figure