Summary (Overview)
- Hybrid Linear Attention (HLA) is a novel query-dependent chunk-level attention mechanism for Gated DeltaNet (GDN) that enables selective access to sparse, distant information in long-context linear attention models.
- HLA represents each completed chunk as an exact affine state transition and computes content-dependent routing gates from compact, self-attentively pooled representatives, interpolating each historical transition with the identity map.
- The method improves over native GDN and fixed chunk mixing (MHLA) across Qwen3.5 models (0.8B–9B), with gains up to 5.57 percentage points on LongBench-V2 and 3.97 points on RULER.
- In a controlled from-scratch 1.3B setting trained on 100B tokens with 4K context, HLA improves RULER performance from 4K to 32K, with gains increasing from 0.83 points at 4K to 4.22 points at 32K, demonstrating generalization beyond training context.
- HLA introduces effective-support regularization to encourage concentrated routing for sparse inference, with only modest latency overhead (9.8–14.9% prefill, 13.9–18.8% decode).
Introduction and Theoretical Foundation
Background and Motivation
Softmax attention remains the standard for long-context modeling due to its content-dependent retrieval capabilities, but its KV cache grows linearly with context length, making long-context inference memory-intensive. Linear attention offers an alternative by compressing history into fixed-size recurrent states, but this compression limits expressivity—particularly the ability to represent sharp, highly selective attention patterns when relevant evidence is sparse.
The paper identifies two key limitations of existing recurrent linear attention:
-
Progressive attenuation of early information: In GLA, historical state writes are repeatedly modulated by subsequent recurrent gates, causing early source positions to have substantially lower cumulative retention. In GDN, early information must propagate through long chains of affine transitions, leading to progressive attenuation or overwriting.
-
Input-independent chunk mixing: MHLA applies fixed learned weights to combine chunk states, which cannot adapt to input- and query-dependent relevance variations.
Theoretical Foundation
The paper builds on Gated DeltaNet (GDN), which uses data-dependent decay and delta-rule updates for selective state modification. The recurrence is expressed as:
where
Since affine maps are closed under composition, token-level updates within a chunk can be summarized exactly by a chunk-level pair :
Methodology
Chunk-Wise Affine Transitions
The sequence is partitioned into contiguous chunks of at most tokens. Each chunk is summarized as an exact affine state transition , where represents the chunk's additive contribution and determines how it transforms earlier memory.
Pooled Chunk Representations
Each completed chunk is divided into non-overlapping pooling windows of tokens. For window of chunk , representative keys are computed via self-attention within the window:
Chunk-Level Attention Weights
Query–representative similarities are aggregated using log-mean-exp:
The chunk-level attention weight is computed via sigmoid:
The current chunk has weight , and future chunks are masked with . At inference, weights below threshold are set to zero.
Query-Conditioned Historical States
For query token , historical chunks are applied chronologically with query-dependent interpolation:
The final query-conditioned state is:
Setting all visible attention weights to one recovers the original GDN recurrence.
Training Objective
For pretrained adaptation, the backbone is frozen and only routing/pooling modules are optimized:
where is next-token cross-entropy. The effective support is measured as:
with normalized weights as in Eq. (11). The regularizers are:
Empirical Validation / Results
From-Scratch 1.3B Results on RULER
Table 1 shows HLA and GDN trained from scratch with 100B tokens and 4K context, evaluated from 4K to 32K:
| Context | Method | Avg. | S1 | MK1 | MV | MQ | VT | CWE | FWE | SQuAD | Hotpot |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 4K | GDN | 24.63 | 99.00 | 26.60 | 15.80 | 15.60 | 2.56 | 24.06 | 5.20 | 11.00 | 8.40 |
| 4K | HLA | 25.46 | 100.00 | 30.40 | 25.20 | 20.40 | 2.08 | 18.24 | 0.07 | 14.40 | 20.00 |
| 8K | GDN | 15.02 | 56.60 | 20.40 | 8.50 | 7.65 | 13.76 | 17.28 | 5.33 | 6.60 | 8.80 |
| 8K | HLA | 17.69 | 100.00 | 21.00 | 17.90 | 16.55 | 1.28 | 2.72 | 0.13 | 7.80 | 15.00 |
| 16K | GDN | 7.98 | 23.80 | 9.60 | 3.90 | 1.90 | 22.64 | 6.08 | 9.80 | 5.20 | 9.00 |
| 16K | HLA | 11.05 | 97.00 | 4.60 | 6.00 | 4.50 | 1.80 | 2.94 | 0.20 | 7.00 | 11.00 |
| 32K | GDN | 3.65 | 11.20 | 5.60 | 0.50 | 0.15 | 3.40 | 1.54 | 5.67 | 5.40 | 9.20 |
| 32K | HLA | 7.87 | 67.40 | 2.40 | 1.90 | 2.00 | 4.92 | 4.04 | 0.27 | 4.80 | 10.80 |
HLA improves GDN by 0.83, 2.67, 3.07, and 4.22 points at 4K, 8K, 16K, and 32K respectively, with the gap widening beyond training context.
Qwen3.5 Long-Context Evaluation
Table 2 (RULER) shows HLA achieves the highest average score at every model scale:
| Scale | Method | Avg. |
|---|---|---|
| 0.8B | Native GDN | 79.141 |
| 0.8B | MHLA | 80.182 |
| 0.8B | HLA | 83.115 |
| 2B | Native GDN | 92.092 |
| 2B | MHLA | 92.192 |
| 2B | HLA | 93.342 |
| 4B | Native GDN | 87.871 |
| 4B | MHLA | 88.050 |
| 4B | HLA | 89.272 |
| 9B | Native GDN | 90.115 |
| 9B | MHLA | 90.200 |
| 9B | HLA | 91.128 |
Table 3 (LongBench-V2) shows consistent improvements:
| Scale | Method | Overall | Easy | Hard | Short | Medium | Long |
|---|---|---|---|---|---|---|---|
| 0.8B | Native GDN | 22.86 | 23.96 | 22.19 | 25.56 | 19.07 | 25.93 |
| 0.8B | HLA | 28.43 | 27.60 | 28.94 | 25.00 | 27.44 | 36.11 |
| 2B | Native GDN | 27.83 | 31.25 | 25.72 | 26.67 | 29.77 | 25.93 |
| 2B | HLA | 29.82 | 30.73 | 29.26 | 26.67 | 33.02 | 28.70 |
| 4B | Native GDN | 29.62 | 31.77 | 28.30 | 33.89 | 28.84 | 24.07 |
| 4B | HLA | 31.01 | 35.94 | 27.97 | 28.33 | 34.42 | 28.70 |
| 9B | Native GDN | 33.00 | 34.38 | 32.15 | 33.89 | 33.49 | 30.56 |
| 9B | HLA | 34.19 | 34.89 | 33.76 | 31.67 | 35.81 | 35.19 |
Ablation Studies
- Chunk size: Best at (29.62% on LongBench-V2), with performance dropping at 512 and 1024 due to trade-off between retrieval granularity and contextual completeness.
- Pooling window: Best at (29.62%), with smaller windows retaining excessive redundancy and larger windows discarding fine-grained information.
- Memory scaling: Affine-state memory decreases approximately inversely with chunk size—at , historical-state storage is reduced 2× compared to matched KV cache while achieving the highest accuracy.
Inference Efficiency
Table 4 shows latency overhead:
| Scale | Prefill Ratio | Decode Ratio |
|---|---|---|
| 0.8B | 1.140× | 1.188× |
| 2B | 1.098× | 1.171× |
| 4B | 1.149× | 1.161× |
| 9B | 1.124× | 1.139× |
The relative overhead decreases with model scale.
Theoretical and Practical Implications
Theoretical Significance
- Query-dependent composition of recurrent memory: HLA demonstrates that making the composition of historical state transitions explicitly query-dependent substantially improves long-context retrieval in linear attention models, addressing a fundamental limitation of fixed-weight approaches.
- Exact affine summarization: The use of exact chunk-wise affine transitions (rather than approximations) preserves the full effect of each chunk while enabling selective access.
- Effective-support regularization: The use of order-2 effective number to encourage concentrated routing provides a principled way to balance expressivity and inference efficiency.
Practical Implications
- Lightweight adaptation: HLA requires only training the routing and pooling modules while freezing the backbone, making it practical for adapting existing pretrained GDN-based models.
- Beyond-training-context generalization: HLA improves performance at context lengths far exceeding the training context (4K→32K), suggesting it enhances the intrinsic long-context capability of recurrent models.
- Favorable memory-accuracy trade-off: The chunk-wise representation reduces historical-state storage by 2× at the default chunk size while improving accuracy.
Conclusion
HLA presents a query-dependent chunk-level attention framework for GDN that represents completed chunks as affine state transitions and dynamically modulates their composition based on the current query. The method controls both new memory and the transformation of earlier history, achieving consistent improvements over native GDN and fixed chunk mixing across pretrained Qwen3.5 models (0.8B–9B) and in controlled from-scratch experiments. The performance gains become more pronounced at longer contexts beyond the training distribution, demonstrating the value of query-dependent composition of compact recurrent-memory summaries for long-context modeling.
Future directions include evaluating HLA in demanding interactive settings such as long-running agentic systems, where long-range memory must be continuously accumulated and selectively reused over extended trajectories (multi-turn tool use, persistent memory, and goal tracking).
Related papers
- RecurTrace: Adaptive Latent Reasoning with Loop-Time Memory
RecurTrace adds loop-time attention memory and oracle-distilled halting to frozen LLMs, improving MathQA accuracy by 2.2 points at matched compute while scaling gains with model size.
- Explorer-Zero: Improving Self-Play for Long-Horizon Tasks
Explorer-Zero jointly generates compositional tasks and verifiable subtask rewards via self-play, outperforming human-data RL on AppWorld without annotations and improving subsequent RL.
- Compaction Laundering: Provenance Destruction in Context-Compacting Coding Agents
Compaction laundering lets attackers forge user instructions that survive context summarization in flattening coding harnesses, enabling code execution with 87-100% success.