ShiftAddLLM: 乗算不要な再パラメータ化による事前学習済みLLMの高速化
ShiftAddLLM: Accelerating Pretrained LLMs via Post-Training Multiplication-Less Reparameterization
June 10, 2024
著者: Haoran You, Yipin Guo, Yichao Fu, Wei Zhou, Huihong Shi, Xiaofan Zhang, Souvik Kundu, Amir Yazdanbakhsh, Yingyan Lin
cs.AI
要旨
大規模言語モデル(LLM)は言語タスクにおいて印象的な性能を示すが、その膨大なパラメータ数と密な乗算への依存により、リソース制約のあるデバイスに展開する際に高いメモリ要求とレイテンシのボトルネックという課題に直面している。シフト・アンド・アッド再パラメータ化は、LLMのアテンション層および多層パーセプトロン(MLP)層において、コストの高い乗算をハードウェアに適したプリミティブに置き換えることで、有望な解決策を提供する。しかし、現在の再パラメータ化技術では、精度を回復するためにゼロからのトレーニングまたは全パラメータのファインチューニングが必要であり、LLMにとってリソース集約的である。この問題に対処するため、我々は事前学習済みLLMをポストトレーニングのシフト・アンド・アッド再パラメータ化によって加速し、乗算を排除した効率的なモデル、ShiftAddLLMを提案する。具体的には、各重み行列をバイナリ行列とグループごとのスケーリング係数に量子化する。関連する乗算は、(1) 活性化とスケーリング係数間のシフト、および(2) バイナリ行列に基づくクエリと加算に再パラメータ化される。精度の低下を抑えるため、重みと出力活性化の再パラメータ化誤差を最小化する多目的最適化手法を提示する。さらに、層ごとの再パラメータ化に対する感度の違いに基づいて、メモリ使用量とレイテンシをさらに削減する自動ビット割り当て戦略を開発する。5つのLLMファミリーと8つのタスクでの実験により、ShiftAddLLMの有効性が一貫して検証され、3ビットおよび2ビットにおいて最も競争力のある量子化LLMと同等または低いレイテンシで、それぞれ平均5.6ポイントおよび22.7ポイントのパープレキシティ改善を達成し、元のLLMと比較して80%以上のメモリとエネルギー削減を実現した。コードとモデルはhttps://github.com/GATECH-EIC/ShiftAddLLMで公開されている。
English
Large language models (LLMs) have shown impressive performance on language
tasks but face challenges when deployed on resource-constrained devices due to
their extensive parameters and reliance on dense multiplications, resulting in
high memory demands and latency bottlenecks. Shift-and-add reparameterization
offers a promising solution by replacing costly multiplications with
hardware-friendly primitives in both the attention and multi-layer perceptron
(MLP) layers of an LLM. However, current reparameterization techniques require
training from scratch or full parameter fine-tuning to restore accuracy, which
is resource-intensive for LLMs. To address this, we propose accelerating
pretrained LLMs through post-training shift-and-add reparameterization,
creating efficient multiplication-free models, dubbed ShiftAddLLM.
Specifically, we quantize each weight matrix into binary matrices paired with
group-wise scaling factors. The associated multiplications are reparameterized
into (1) shifts between activations and scaling factors and (2) queries and
adds according to the binary matrices. To reduce accuracy loss, we present a
multi-objective optimization method to minimize both weight and output
activation reparameterization errors. Additionally, based on varying
sensitivity across layers to reparameterization, we develop an automated bit
allocation strategy to further reduce memory usage and latency. Experiments on
five LLM families and eight tasks consistently validate the effectiveness of
ShiftAddLLM, achieving average perplexity improvements of 5.6 and 22.7 points
at comparable or lower latency compared to the most competitive quantized LLMs
at 3 and 2 bits, respectively, and more than 80% memory and energy reductions
over the original LLMs. Codes and models are available at
https://github.com/GATECH-EIC/ShiftAddLLM.Summary
AI-Generated Summary