ReAttention: Training-Free Infinite Context with Finite Attention Scope

要約

大規模な言語モデル(LLM)の長いコンテキスト機能は大きなブレークスルーをもたらしましたが、長さの外挿での最大サポートされているコンテキストの長さは、実用的なアプリケーションを制限する重要なボトルネックのままです。
LLMSにおけるコンテキスト長の制約は、自己触媒メカニズムから生じます。これは、限られた事前に訓練された位置情報と注意の範囲を介して、無限に長いコンテキスト内でセマンティック関係を効果的かつ効率的にキャプチャすることはできません。
この作業では、十分なメモリリソースの下で有限の注意範囲を持つ無限のコンテキストをサポートする自己関節メカニズムに基づいてLLMを可能にするトレーニングなしのアプローチであるリアットを提案します。
Reattentionは、通常のポジションを意識した自己触たちの前に、長さの外挿の問題からLLMを解放する前に、ポジションにとらわれない$ $ k $の注意を払っています。
Longbench、L-Eval、およびInfinitebenchでの再術のパフォーマンスを検証し、従来の方法と同等であることを示しています。
さらに、LLAMA3.1-8BやMistral-V0.3-7Bを含む主流のLLMSにも再現が適用され、少なくとも1Mのコンテキスト長さをサポートできるようになり、llama3.2-3b-chatのコンテキスト長さを拡大することができます。
また、トリトンによる再現の効率を改善し、追加のオーバーヘッドなしで効率的な外挿を達成します。
このコードは、https://github.com/openmoss/reattentionで入手できます。

要約(オリジナル)

The long-context capability of the Large Language Models (LLM) has made significant breakthroughs, but the maximum supported context length in length extrapolation remains a critical bottleneck limiting their practical applications. The constraint of context length in LLMs arises from the self-attention mechanism, which cannot effectively and efficiently capture the semantic relationships within infinitely long contexts via the limited pre-trained positional information and attention scope. In this work, we propose ReAttention, a training-free approach enabling LLM based on the self-attention mechanism to support an infinite context with a finite attention scope under sufficient memory resources. ReAttention performs the position-agnostic top-$k$ attention before the ordinary position-aware self-attention, freeing LLMs from the length extrapolation issue. We validate the performance of ReAttention on the LongBench, L-Eval, and InfiniteBench and demonstrate that it is on par with traditional methods. Furthermore, we also apply ReAttention on mainstream LLMs, including LLaMA3.1-8B and Mistral-v0.3-7B, enabling them to support context lengths of at least 1M and even expanding the context length of LLaMA3.2-3B-chat by 128$\times$ to 4M without any further training in Needle-In-A-Haystack tests. We also improve the efficiency of ReAttention with Triton and achieve an efficient extrapolation without additional overhead. The code is available at https://github.com/OpenMOSS/ReAttention.

arxiv情報

著者 Xiaoran Liu,Ruixiao Li,Qipeng Guo,Zhigeng Liu,Yuerong Song,Kai Lv,Hang Yan,Linlin Li,Qun Liu,Xipeng Qiu
発行日 2025-03-19 12:15:10+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.CL パーマリンク