Theory, Analysis, and Best Practices for Sigmoid Self-Attention

要約

注意は変圧器アーキテクチャの重要な部分です。
これは、各シーケンス要素を値の加重和に変換するシーケンス間のマッピングです。
重みは通常、キーとクエリの間のドット積のソフトマックスとして取得されます。
最近の研究では、ReLU やシグモイド アクティベーションなど、トランスフォーマーにおけるソフトマックス アテンションの代替手段が検討されています。
この研究では、シグモイド注意を再考し、詳細な理論的および実証的分析を行います。
理論的には、シグモイド アテンションを備えたトランスフォーマーは汎用関数近似器であり、ソフトマックス アテンションと比較して規則性の向上による恩恵を受けることが証明されています。
詳細な実証分析を通じて、トレーニングの初期段階での大きな初期注意規範の安定化が、以前の試みを上回るシグモイド注意を備えたモデルのトレーニングを成功させるための重要な要素であることを特定しました。
また、ハードウェア対応でメモリ効率の高いシグモイド アテンションの実装である FLASHSIGMOID も導入し、H100 GPU で FLASHATTENTION2 と比較して推論カーネルの速度が 17% 向上しました。
言語、視覚、および音声にわたる実験では、適切に正規化されたシグモイド注意が、広範囲の領域およびスケールにおけるソフトマックス注意の強力なパフォーマンスと一致することが示されていますが、これまでのシグモイド注意の試みでは完全には達成できませんでした。
私たちの研究は従来技術を統合し、変圧器のドロップインソフトマックス代替としてシグモイドアテンションのベストプラクティスを確立しました。

要約(オリジナル)

Attention is a key part of the transformer architecture. It is a sequence-to-sequence mapping that transforms each sequence element into a weighted sum of values. The weights are typically obtained as the softmax of dot products between keys and queries. Recent work has explored alternatives to softmax attention in transformers, such as ReLU and sigmoid activations. In this work, we revisit sigmoid attention and conduct an in-depth theoretical and empirical analysis. Theoretically, we prove that transformers with sigmoid attention are universal function approximators and benefit from improved regularity compared to softmax attention. Through detailed empirical analysis, we identify stabilization of large initial attention norms during the early stages of training as a crucial factor for the successful training of models with sigmoid attention, outperforming prior attempts. We also introduce FLASHSIGMOID, a hardware-aware and memory-efficient implementation of sigmoid attention yielding a 17% inference kernel speed-up over FLASHATTENTION2 on H100 GPUs. Experiments across language, vision, and speech show that properly normalized sigmoid attention matches the strong performance of softmax attention on a wide range of domains and scales, which previous attempts at sigmoid attention were unable to fully achieve. Our work unifies prior art and establishes best practices for sigmoid attention as a drop-in softmax replacement in transformers.

arxiv情報

著者 Jason Ramapuram,Federico Danieli,Eeshan Dhekane,Floris Weers,Dan Busbridge,Pierre Ablin,Tatiana Likhomanenko,Jagrit Digani,Zijin Gu,Amitis Shidani,Russ Webb
発行日 2024-09-06 17:53:26+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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