ChatPaper.aiChatPaper

エネルギー効率の良い言語モデルに必要なのは加算のみ

Addition is All You Need for Energy-efficient Language Models

October 1, 2024
著者: Hongyin Luo, Wei Sun
cs.AI

要旨

大規模なニューラルネットワークは、浮動小数点テンソルの乗算に多くの計算リソースを費やします。本研究では、浮動小数点の乗算器を高い精度で1つの整数加算器で近似できることを見出しました。私たちは、整数加算演算で浮動小数点数の乗算を近似する線形計算量の乗算(L-Mul)アルゴリズムを提案します。この新しいアルゴリズムは、8ビット浮動小数点乗算よりも計算リソースを著しく削減しますが、より高い精度を実現します。8ビット浮動小数点乗算と比較して、提案手法は高い精度を達成しますが、ビットレベルの計算リソースを著しく削減します。浮動小数点数の乗算は整数加算操作と比較して著しく高いエネルギーを必要とするため、テンソル処理ハードウェアでL-Mul演算を適用することで、要素ごとの浮動小数点テンソル乗算のエネルギーコストを95%削減し、ドット積のエネルギーコストを80%削減できる可能性があります。L-Mulの理論的な誤差期待値を計算し、自然言語理解、構造的推論、数学、常識的な質問応答を含む幅広いテキスト、ビジュアル、およびシンボリックタスクでアルゴリズムを評価しました。数値解析実験は、L-Mulの4ビットの仮数を使用する場合に、float8_e4m3の乗算と同等の精度を達成し、3ビットの仮数を使用するL-Mulがfloat8_e5m2を上回ることを示しています。一般的なベンチマークでの評価結果は、アテンションメカニズムに直接L-Mulを適用するとほぼ損失がないことを示しています。さらに、トランスフォーマーモデル内のすべての浮動小数点乗算を3ビットの仮数を使用するL-Mulに置き換えると、ファインチューニングと推論の両方で蓄積精度としてfloat8_e4m3を使用する場合と同等の精度が得られます。
English
Large neural networks spend most computation on floating point tensor multiplications. In this work, we find that a floating point multiplier can be approximated by one integer adder with high precision. We propose the linear-complexity multiplication L-Mul algorithm that approximates floating point number multiplication with integer addition operations. The new algorithm costs significantly less computation resource than 8-bit floating point multiplication but achieves higher precision. Compared to 8-bit floating point multiplications, the proposed method achieves higher precision but consumes significantly less bit-level computation. Since multiplying floating point numbers requires substantially higher energy compared to integer addition operations, applying the L-Mul operation in tensor processing hardware can potentially reduce 95% energy cost by element-wise floating point tensor multiplications and 80% energy cost of dot products. We calculated the theoretical error expectation of L-Mul, and evaluated the algorithm on a wide range of textual, visual, and symbolic tasks, including natural language understanding, structural reasoning, mathematics, and commonsense question answering. Our numerical analysis experiments agree with the theoretical error estimation, which indicates that L-Mul with 4-bit mantissa achieves comparable precision as float8_e4m3 multiplications, and L-Mul with 3-bit mantissa outperforms float8_e5m2. Evaluation results on popular benchmarks show that directly applying L-Mul to the attention mechanism is almost lossless. We further show that replacing all floating point multiplications with 3-bit mantissa L-Mul in a transformer model achieves equivalent precision as using float8_e4m3 as accumulation precision in both fine-tuning and inference.

Summary

AI-Generated Summary

PDF15117November 16, 2024