[論文レビュー] Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time
Contextual sparsityの導入により、入力依存的な注目ヘッドとMLPニューロンの小さなサブセットを予測することで推論を高速化し、再訓練やインコンテキスト学習の品質低下なしにウォールクロック時間のスピードアップを実現します。
Large language models (LLMs) with hundreds of billions of parameters have sparked a new wave of exciting AI applications. However, they are computationally expensive at inference time. Sparsity is a natural approach to reduce this cost, but existing methods either require costly retraining, have to forgo LLM's in-context learning ability, or do not yield wall-clock time speedup on modern hardware. We hypothesize that contextual sparsity, which are small, input-dependent sets of attention heads and MLP parameters that yield approximately the same output as the dense model for a given input, can address these issues. We show that contextual sparsity exists, that it can be accurately predicted, and that we can exploit it to speed up LLM inference in wall-clock time without compromising LLM's quality or in-context learning ability. Based on these insights, we propose DejaVu, a system that uses a low-cost algorithm to predict contextual sparsity on the fly given inputs to each layer, along with an asynchronous and hardware-aware implementation that speeds up LLM inference. We validate that DejaVu can reduce the inference latency of OPT-175B by over 2X compared to the state-of-the-art FasterTransformer, and over 6X compared to the widely used Hugging Face implementation, without compromising model quality. The code is available at https://github.com/FMInference/DejaVu.
研究の動機と目的
- 文脈依存の疎性が事前学習済みのLLMsに存在し、推論時のスピードアップに活用できることを動機づけ、実証する。
- その場で層ごとに文脈依存の疎subsetを低コストの予測器で識別する。
- エンドツーエンドの待ち時間を削減するための非同期、ハードウェア意識の実装を提案する。
- 複数のベンチマークにわたりOPT-175Bで速度アップと精度保持を検証する。
提案手法
- 文脈依存性の下でスパース化されたMLPとMHAブロックを定義する。
- 文脈依存性の疎性は入力ごとに約85%の構造的スパース性に到達し、入力ごとに最大7xのパラメータ削減を可能にする。
- 入力に基づいて重要なニューロン/ヘッドを識別する2段階のスパース予測器(MLP用とアテンション用)を開発する。
- MLPのスパース性を近傍探索問題(MaxIP)として定式化し、関連ニューロンを選択する高速なニューラル予測器を実装する。
- 同様にアテンションヘッドのスパース性を近傍探索として定式化し、入力ごとに使用するヘッドを予測する。
- 予測オーバーヘッドを隠蔽しエンドツーエンドの遅延利得を維持する非同期の先読み予測器を導入する。
- GPUでのスピードアップを実現するためのハードウェア意識のカーネル融合とメモリ共走戦略を提供する。
実験結果
リサーチクエスチョン
- RQ1文脈依存性の疎性は実用的な入力に対して事前学習済みのLLMsに存在するか。
- RQ2 retrainingせずに現場で文脈依存性の疎性を正確に予測できるか。
- RQ3現代のハードウェア上で、モデル品質とインコンテキスト学習を保持しつつエンドツーエンドのレイテンシを意味のあるほど削減できるか。
- RQ4文脈依存性の疎性からのスピードアップを実現する効果的なハードウェア意識の実装は何か。
- RQ5提案されたアプローチは層間の残差接続と遅く変化する埋め込みとどう相互作用するか。
主な発見
- 文脈依存性は事前学習済みのLLMsに存在し、ある入力に対して最大約85%のパラメータが文脈的に非活性である。
- 入力と層の文脈に基づく予測器は、MLPとアテンションブロックのスパースサブセットを正確に識別できる。
- エンドツーエンドのレイテンシは、FasterTransformerと比較して2倍以上、Hugging Faceと比較して6倍以上の低減をOPT-175Bで達成し、品質低下はなし。
- 本手法はインコンテキスト学習能力を保持し、評価タスクでゼロショット/少数ショットの性能を維持する。
- 非同期の先読み予測器とハードウェア意識の実装は、実際のウォールクロックスピードアップを達成する鍵である。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。