Native Hybrid Attention for Efficient Sequence Modeling

Jiaxi Hu · DOI

TL;DR

This paper introduces Native Hybrid Attention (NHA), a novel architecture that unifies linear and full attention mechanisms within a single layer. NHA efficiently captures long-term dependencies by combining a compressed long-term memory with a local sliding window, achieving state-of-the-art performance on recall-intensive and commonsense reasoning tasks while significantly improving efficiency.

What Problem Does This Paper Address?

Transformers have revolutionized sequence modeling, but their quadratic complexity with respect to sequence length ($O(n^2)$) makes them computationally prohibitive for long sequences. Existing solutions fall into two camps: sparse attention, which reduces computation by selectively attending to tokens, and linear attention, which achieves linear complexity ($O(n)$) by compressing the entire sequence history into a fixed-size state. However, sparse attention can miss crucial information, while linear attention often sacrifices recall accuracy. This paper addresses the need for a hybrid approach that combines the strengths of both, offering both efficiency and high recall for long sequences.

Methods

The core innovation is the Native Hybrid Attention (NHA) layer, which integrates both intra-layer and inter-layer hybridization into a single, cohesive design.

  • Intra-layer Hybridization: NHA maintains a compressed long-term memory using a linear RNN and augments it with short-term tokens from a sliding window. A single, unified softmax attention operation is then applied over this combined set of keys and values. This allows for context-dependent weighting without additional fusion parameters.
  • Inter-layer Hybridization: NHA layers are structurally uniform. Inter-layer hybridization is achieved simply by adjusting the sliding window size per layer. A window size of zero results in a pure linear RNN layer, while a window size equal to the full sequence length recovers a full attention layer. This offers flexible, layer-specific configurations without altering the model's fundamental structure.

NHA also introduces a chunkwise parallel form for efficient computation and leverages a unified softmax for context-dependent fusion, which differs from prior methods that use separate attention computations and output-level weighted fusion.

Datasets

The paper uses the following datasets:

  • Pretraining: SlimPajama dataset (a large English-language subset of RedPajama).
  • Evaluation:
    • Recall-Intensive Tasks: FDA, SWDE, SQuAD, NQ, TriviaQA, DROP.
  • Commonsense Reasoning Tasks: WikiText, LAMBADA, ARC-Easy, ARC-Challenge, HellaSwag, PiQA, WinoGrande.
  • Long-Context Benchmarks: RULER benchmark (NIAH-MK, NIAH-MQ, RULER-CWE, RULER-Hotpot).

Key Insights and Ideas

  • Unified Attention for Hybridization: The key insight is that a single softmax attention mechanism can effectively handle both long-term compressed memory and short-term local context, leading to more dynamic and context-aware weighting than separate fusion methods.
  • Structural Uniformity for Flexibility: By designing a single NHA layer that can behave as linear, full attention, or a hybrid based on a simple window size parameter, the authors enable flexible inter-layer hybridization without complex architectural alignment.
  • "Duality" for Inference-Time Adaptation: The model exhibits a "duality" where it can switch between high-speed RNN mode and high-precision Full Attention mode during inference without retraining, offering a path for dynamic deployment.
  • Gradient Coupling Benefits: The unified softmax fusion leads to natural cross-memory coupling, where gradients from one memory type influence the other, promoting better co-adaptation than traditional weighted fusion.

Key Results

  • State-of-the-Art Performance: NHA consistently outperforms standard Transformers and other hybrid baselines on recall-intensive and commonsense reasoning tasks.
  • Efficiency Gains: NHA achieves near-linear scaling in computation time for long sequences, matching the efficiency of models like GSA while offering superior accuracy.
  • LLM Hybridization: Pretrained LLMs (Llama-3-8B, Qwen2.5-7B) can be effectively hybridized with NHA, achieving competitive accuracy with significantly improved inference speed and reduced memory usage. For instance, NHA-Llama3-8B achieved the best performance with only 4 full attention layers.
  • Scalability: The approach scales to very large models (Qwen3-30B-A3B), demonstrating its practical utility.

Limitations and Future Work

  • Hyperparameter Tuning: NHA introduces hyperparameters like slot size and window size that may require careful tuning for optimal performance.
  • Operator-Level Optimization: There is room for further optimization of the underlying computational kernels.
  • Structured Layer Configurations: While NHA supports flexible window size adjustments across layers, the paper primarily considers uniform settings. More structured strategies for varying window sizes across depth could further enhance adaptability.
  • Future Work: The authors suggest exploring parameter-efficient fine-tuning (PEFT) for slot initial states and applying NHA to scenarios like chain-of-thought reasoning for selective compression of reasoning chains.

Summary updated

BibTeX
@inproceedings{hu2026native,
  author = {JIAXI HU},
  title = {{Native Hybrid Attention for Efficient Sequence Modeling}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.176},
}
Figure