Not all Layers of LLMs are Necessary during Inference

要約

大規模言語モデル (LLM) の推論フェーズは非常に高価です。
LLM の理想的な推論段階では、その機能 (一般化やコンテキスト内学習能力など) を維持しながら、使用する計算リソースを少なくすることができます。
このペーパーでは、「LLM 推論中に、簡単なインスタンスのために浅い層を使用できますか?」という質問に答えようとします。
硬いものは深い層でしょうか?
この質問に答えるために、まず、タスク全体でアクティブ化されたレイヤーを統計的に分析することで、推論中にすべてのレイヤーが必要なわけではないことを示します。
次に、入力インスタンスに基づいて推論終了瞬間を適応的に決定する、AdaInfer という名前の単純なアルゴリズムを提案します。
さらに重要なことは、AdaInfer は LLM パラメータを変更せず、タスク間での汎用性を維持することです。
有名な LLM (Llama2 シリーズや OPT) での実験では、AdaInfer が同等のパフォーマンスを維持しながら、計算リソースを平均 14.8% 節約し、感情タスクでは最大 50% を節約することが示されています。
さらに、この方法は他のモデル高速化技術と直交しており、推論効率をさらに高める可能性があります。

要約(オリジナル)

The inference phase of Large Language Models (LLMs) is very expensive. An ideal inference stage of LLMs could utilize fewer computational resources while still maintaining its capabilities (e.g., generalization and in-context learning ability). In this paper, we try to answer the question, ‘During LLM inference, can we use shallow layers for easy instances; and deep layers for hard ones?’ To answer this question, we first indicate that Not all Layers are Necessary during Inference by statistically analyzing the activated layers across tasks. Then, we propose a simple algorithm named AdaInfer to determine the inference termination moment based on the input instance adaptively. More importantly, AdaInfer does not alter LLM parameters and maintains generalizability across tasks. Experiments on well-known LLMs (i.e., Llama2 series and OPT) show that AdaInfer saves an average of 14.8% of computational resources, even up to 50% on sentiment tasks, while maintaining comparable performance. Additionally, this method is orthogonal to other model acceleration techniques, potentially boosting inference efficiency further.

arxiv情報

著者 Siqi Fan,Xin Jiang,Xiang Li,Xuying Meng,Peng Han,Shuo Shang,Aixin Sun,Yequan Wang,Zhongyuan Wang
発行日 2024-04-15 03:57:44+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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