How Sparse Attention Approximates Exact Attention? Your Attention is Naturally $n^C$-Sparse

要約

まばらな注意は、標準的な注意計算を亜科下の複雑さで近似する手法です。
これは、SoftMax関数計算中に注意マトリックスの小さなエントリを選択的に無視することによって達成されます。
剪定KVキャッシュ、スパースベースの高速注意、スパーストランスなどのこの手法のバリエーションは、効率的な大規模な言語モデル(LLMS)の展開に広く利用されています。
その広範な使用にもかかわらず、従来の注意と同等の注意を払う条件の理論的理解は、とらえどころのないままです。
この作業は、標準の注意プロセスの固有のスパース性を調べることにより、$ \ textbf {このギャップを埋めることを目指しています} $。
私たちの理論的枠組みは、いくつかの真新しい重要な洞察を明らかにしています:$ \ bullet $の注意は$ n^{c} $ – スパースです。
$エントリは、まばらな注意が損失の減少に伴う正確な注意マトリックスを近似するのに十分です。
ここで、$ n $は入力長を表し、$ c \ in(0、1)$は定数です。
$ \ bullet $ stable $ o(\ log(n))$ – $ \ log(n)$または少ないエントリで注意計算に近似するスパースの注意は、エラーが最低$ oで持続するため、実行不可能な場合があります
(1)$。
$ \ bullet $ adaptive戦略($ \ alpha \ cdot n^c、\ alpha \ in \ mathbb {r} $)は、固定されたものではなく、効率的な注意方法のウィンドウサイズのために、より正確かつ効率的に実行することが保証されています。
柔軟なコンテキストの長さに関する推論のためのタスク。

要約(オリジナル)

Sparse Attention is a technique that approximates standard attention computation with sub-quadratic complexity. This is achieved by selectively ignoring smaller entries in the attention matrix during the softmax function computation. Variations of this technique, such as pruning KV cache, sparsity-based fast attention, and Sparse Transformer, have been extensively utilized for efficient Large Language Models (LLMs) deployment. Despite its widespread use, a theoretical understanding of the conditions under which sparse attention performs on par with traditional attention remains elusive. This work aims to $\textbf{bridge this gap by examining the inherent sparsity of standard attention processes}$. Our theoretical framework reveals several brand-new key insights: $\bullet$ Attention is $n^{C}$-sparse, implying that considering only the largest $\Omega(n^{C})$ entries out of all $n$ entries is sufficient for sparse attention to approximate the exact attention matrix with decreasing loss. Here, $n$ represents the input length and $C \in (0, 1)$ is a constant. $\bullet$ Stable $o(\log(n))$-sparse attention, which approximates attention computation with $\log(n)$ or fewer entries, may not be feasible since the error will persist at a minimum of $O(1)$. $\bullet$ An adaptive strategy ($\alpha \cdot n^C, \alpha \in \mathbb{R}$) for the window size of efficient attention methods rather than a fixed one is guaranteed to perform more accurately and efficiently in a task for inference on flexible context lengths.

arxiv情報

著者 Yichuan Deng,Zhao Song,Jing Xiong,Chiwun Yang
発行日 2025-02-12 14:32:46+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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