ChatPaper.aiChatPaper

デジャヴ:推論時の効率的なLLMのための文脈的スパース性

Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time

October 26, 2023
著者: Zichang Liu, Jue Wang, Tri Dao, Tianyi Zhou, Binhang Yuan, Zhao Song, Anshumali Shrivastava, Ce Zhang, Yuandong Tian, Christopher Re, Beidi Chen
cs.AI

要旨

数百億のパラメータを持つ大規模言語モデル(LLM)は、新たなAIアプリケーションの波を引き起こしています。しかし、推論時の計算コストが高いという課題があります。スパース性はこのコストを削減する自然なアプローチですが、既存の手法では高コストな再学習が必要であったり、LLMの文脈内学習能力を犠牲にしたり、現代のハードウェア上で実時間の高速化を実現できなかったりします。我々は、特定の入力に対して密なモデルとほぼ同じ出力を生成する、入力依存の小さなアテンションヘッドとMLPパラメータの集合である「文脈的スパース性」がこれらの課題を解決できると仮説を立てました。我々は、文脈的スパース性が存在し、それを正確に予測可能であり、LLMの品質や文脈内学習能力を損なうことなく、実時間でLLM推論を高速化するために活用できることを示します。これらの知見に基づき、各層への入力に応じて文脈的スパース性をオンザフライで予測する低コストアルゴリズムと、非同期かつハードウェアを意識した実装によりLLM推論を高速化するシステム「DejaVu」を提案します。DejaVuが、最先端のFasterTransformerと比較してOPT-175Bの推論遅延を2倍以上、広く使用されているHugging Faceの実装と比較して6倍以上削減できることを検証しました。モデルの品質を損なうことなく、これらの高速化を実現しています。コードはhttps://github.com/FMInference/DejaVuで公開されています。
English
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.
PDF141December 15, 2024