KDEformer: Accelerating Transformers via Kernel Density Estimation

要約

ドット積アテンション メカニズムは、シーケンス モデリングのための最新のディープ アーキテクチャ (例: Transformer) で重要な役割を果たしますが、このモデルの単純で正確な計算はシーケンスの長さに二次時間とメモリの複雑さを招き、長いシーケンスのトレーニングを妨げます。
モデル。
重大なボトルネックは、ソフトマックス関数の分母における分配関数の計算、およびソフトマックス行列と値の行列の乗算に起因します。
私たちの重要な観察は、前者はカーネル密度推定 (KDE) 問題の変形に還元でき、効率的な KDE ソルバーをさらに利用して、サブサンプリング ベースの高速行列積を通じて後者を高速化できるということです。
私たちが提案する KDEformer は、証明可能なスペクトルノルム境界を使用して二次時間でアテンションを近似できますが、以前のすべての結果は単にエントリごとの誤差境界を提供するだけです。
経験的に、KDEformer は、さまざまな事前トレーニング済みモデルで、精度、メモリ、実行時間の点で他のアテンション近似よりも優れていることが確認されています。
BigGAN 画像生成では、$4\time$ 以上の高速化により、正確な計算よりも優れた生成スコアを達成しました。
T2T-ViT を使用した ImageNet 分類の場合、KDEformer は $18\times$ 以上の高速化を示し、精度の低下は $0.5\%$ 未満です。

要約(オリジナル)

Dot-product attention mechanism plays a crucial role in modern deep architectures (e.g., Transformer) for sequence modeling, however, na\’ive exact computation of this model incurs quadratic time and memory complexities in sequence length, hindering the training of long-sequence models. Critical bottlenecks are due to the computation of partition functions in the denominator of softmax function as well as the multiplication of the softmax matrix with the matrix of values. Our key observation is that the former can be reduced to a variant of the kernel density estimation (KDE) problem, and an efficient KDE solver can be further utilized to accelerate the latter via subsampling-based fast matrix products. Our proposed KDEformer can approximate the attention in sub-quadratic time with provable spectral norm bounds, while all prior results merely provide entry-wise error bounds. Empirically, we verify that KDEformer outperforms other attention approximations in terms of accuracy, memory, and runtime on various pre-trained models. On BigGAN image generation, we achieve better generative scores than the exact computation with over $4\times$ speedup. For ImageNet classification with T2T-ViT, KDEformer shows over $18\times$ speedup while the accuracy drop is less than $0.5\%$.

arxiv情報

著者 Amir Zandieh,Insu Han,Majid Daliri,Amin Karbasi
発行日 2023-06-29 17:51:10+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CV, cs.DS, cs.LG パーマリンク