Dynamic Linear Attention

Xin Wang, Hui Shen, Boyuan Zheng, Xueshen Liu, Minkyoung Cho, Zhongwei Wan, Zesen Zhao, Zhuoqing Mao, Shen Yan, Mi Zhang

Introduction

Standard linear attention models often struggle with long sequences because they compress historical context into fixed, "content-agnostic" memory buckets. Dynamic Linear Attention (DLA) addresses this fundamental limitation by adaptively deciding when to store new information and when to merge old states based on the semantic importance of the tokens. By treating memory as a dynamic filter rather than a rigid schedule, DLA significantly boosts performance on long-context tasks while remaining highly efficient.

The Challenge of Long-Context Memory

While standard Transformers are powerful, their self-attention mechanism suffers from a massive computational bottleneck: its cost grows quadratically ($O(T^2)$) with the length of the input. This makes processing extensive documents, books, or codebases prohibitively expensive.

"Linear attention" models, such as Mamba or DeltaNet, solve this by utilizing a recurrent state that summarizes the past, reducing the computational cost to a linear scale ($O(T)$). However, squashing a massive history into a single fixed-size state inevitably creates an "information bottleneck."

Recent "multi-state" approaches, like Log-Linear Attention, attempt to mitigate this by keeping multiple summary states. Unfortunately, they rely on rigid, fixed schedules—merging tokens every $K$ steps regardless of whether those tokens represent a crucial plot twist or repetitive filler. This "content-blind" merging causes irreversible information loss and severe error accumulation over long sequences.

The Dynamic Linear Attention (DLA) Framework

To overcome the limitations of fixed-schedule memory, the authors introduce DLA, a framework that makes memory management inherently "information-aware." It operates through two primary mechanisms:

1. Information-Aware Dynamic State Merging

Instead of adhering to a fixed schedule, DLA calculates a State Information Score ($I_t$) for every incoming token. This score measures how much the new token alters the current memory representation, calculated using the Frobenius norm of the state difference.

If the change is significant (exceeding a threshold $\tau$), DLA initiates a new memory state. If the change is minor, the token is merged into the existing state. This adaptive approach preserves high-resolution representations during "semantic transitions" while aggressively compressing "stable regions."

2. Capacity-Bounded Memory Modeling

To maintain predictable inference costs, DLA utilizes a fixed-size cache of $K$ states. When the cache reaches capacity, the system does not simply discard the oldest information. Instead, it identifies the two adjacent states with the lowest information density and merges them. This strategy keeps the memory chronologically ordered while minimizing the "damage" caused by compression.

During training, DLA employs a "soft gating" mechanism to make these boundary decisions differentiable, seamlessly switching to "hard" discrete boundaries during inference.

Experimental Setup

The researchers pre-trained two models—Mamba-2-780M and Gated DeltaNet-1.3B—from scratch on 50 billion tokens from the Long-Data-Collections dataset, utilizing a 16K sequence length.

The evaluation was comprehensive, spanning 16 datasets across three distinct categories:

  • Commonsense Reasoning: LAMBADA, PIQA, HellaSwag, WinoGrande, ARC-e/c, OpenBookQA, and CommonsenseQA.
  • In-Context Retrieval: SWDE, SQuAD, FDA, TriviaQA, Drop, and NQ.
  • Long-Context Modeling: RULER (testing retrieval up to 16k tokens) and LongBench (comprehensive long-context understanding).

Key Findings and Insights

  • Semantic Awareness is Mathematically Optimal: The paper provides a theoretical proof (Theorem 3.1) demonstrating that any fixed blocking policy is mathematically sub-optimal for "non-stationary" sequences where information density fluctuates.
  • Closing the Gap with Transformers: One of the most striking insights is that augmenting a linear model like Mamba-2 with DLA allows it to outperform a full-attention Transformer of the same parameter size on several benchmarks. This effectively closes the performance gap that traditionally exists between linear and quadratic models.
  • Superior Accuracy and Long-Context Mastery: On Mamba-2, DLA achieved up to a 52% relative improvement over the previous state-of-the-art multi-state method (Log-Linear Attention). Furthermore, on the rigorous "Needle-in-a-Haystack" tasks (RULER), DLA demonstrated massive gains, including up to a 350% improvement on specific multi-needle retrieval tasks compared to log-linear variants.
  • Efficiency Gains: Despite its dynamic nature, DLA is more efficient than Log-Linear Attention. It delivers higher throughput and lower memory consumption by managing its state cache intelligently, thereby avoiding the overhead of complex hierarchical structures.

Limitations and Future Directions

While DLA presents a significant leap forward, it is not without limitations. It is not a "plug-and-play" wrapper for existing pre-trained models; it requires training from scratch (or substantial fine-tuning) to learn the information-aware gating. Additionally, while DLA manages its $K$ states optimally, it still operates with a fixed capacity. For extremely long sequences spanning millions of tokens, even intelligent merging might eventually lead to the loss of fine-grained details.

Future work will likely explore more sophisticated State Information Scores and scale DLA to much larger models (10B+ parameters) to verify if these substantial benefits hold at the frontier of LLM scale.

Summary updated

BibTeX
@inproceedings{wang2026dynamic,
  author = {Xin Wang and Hui Shen and Boyuan Zheng and Xueshen Liu and Minkyoung Cho and Zhongwei Wan and Zesen Zhao and Zhuoqing Mao and Shen Yan and Mi Zhang},
  title = {{Dynamic Linear Attention}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=RH7Ft0pVDP},
}
Figure