ChatPaper.aiChatPaper

効率的なシーケンスモデリングのためのネイティブハイブリッドアテンション

Native Hybrid Attention for Efficient Sequence Modeling

October 8, 2025
著者: Jusen Du, Jiaxi Hu, Tao Zhang, Weigao Sun, Yu Cheng
cs.AI

要旨

Transformerはシーケンスモデリングにおいて優れた性能を発揮するが、二次的な計算複雑性を抱えている。一方、線形アテンションは効率性を向上させるが、長い文脈におけるリコール精度が犠牲になることが多い。本研究では、線形アテンションと完全アテンションを統合した新しいハイブリッドアーキテクチャであるNative Hybrid Attention (NHA)を提案する。NHAは、線形RNNによって更新されるキー・バリュースロットに長期的な文脈を保持し、スライディングウィンドウからの短期的なトークンで補強する。その後、すべてのキーとバリューに対して単一のソフトマックスアテンション操作を適用し、追加の融合パラメータを必要とせずに、トークンごとおよびヘッドごとの文脈依存の重み付けを可能にする。層間の動作は、スライディングウィンドウサイズという単一のハイパーパラメータによって制御され、純粋な線形アテンションと完全アテンションの間を滑らかに調整しながら、すべての層を構造的に統一する。実験結果は、NHAがリコール集約型および常識推論タスクにおいて、Transformerや他のハイブリッドベースラインを凌駕することを示している。さらに、事前学習済みの大規模言語モデル(LLM)をNHAと構造的にハイブリッド化することで、競争力のある精度を維持しつつ、大幅な効率向上を実現できる。コードはhttps://github.com/JusenD/NHAで公開されている。
English
Transformers excel at sequence modeling but face quadratic complexity, while linear attention offers improved efficiency but often compromises recall accuracy over long contexts. In this work, we introduce Native Hybrid Attention (NHA), a novel hybrid architecture of linear and full attention that integrates both intra \& inter-layer hybridization into a unified layer design. NHA maintains long-term context in key-value slots updated by a linear RNN, and augments them with short-term tokens from a sliding window. A single softmax attention operation is then applied over all keys and values, enabling per-token and per-head context-dependent weighting without requiring additional fusion parameters. The inter-layer behavior is controlled through a single hyperparameter, the sliding window size, which allows smooth adjustment between purely linear and full attention while keeping all layers structurally uniform. Experimental results show that NHA surpasses Transformers and other hybrid baselines on recall-intensive and commonsense reasoning tasks. Furthermore, pretrained LLMs can be structurally hybridized with NHA, achieving competitive accuracy while delivering significant efficiency gains. Code is available at https://github.com/JusenD/NHA.
PDF162October 9, 2025