QA-LoRA: 大規模言語モデルの量子化対応低ランク適応
QA-LoRA: Quantization-Aware Low-Rank Adaptation of Large Language Models
September 26, 2023
著者: Yuhui Xu, Lingxi Xie, Xiaotao Gu, Xin Chen, Heng Chang, Hengheng Zhang, Zhensu Chen, Xiaopeng Zhang, Qi Tian
cs.AI
要旨
近年、大規模言語モデル(LLM)の急速な発展が目覚ましい。多くの言語理解タスクにおいて強力な能力を発揮する一方で、その膨大な計算負荷は、特にエッジデバイスへの展開を考える際に、LLMの応用を大きく制限している。本論文では、量子化を考慮した低ランク適応(QA-LoRA)アルゴリズムを提案する。その動機は、量子化と適応の自由度の不均衡にあり、解決策として、グループ単位の演算子を使用することで、量子化の自由度を増加させつつ、適応の自由度を減少させる。QA-LoRAは数行のコードで容易に実装可能であり、元のLoRAに以下の二つの能力を付与する:(i) ファインチューニング中に、LLMの重みを量子化(例えばINT4)して時間とメモリ使用量を削減する、(ii) ファインチューニング後、LLMと補助重みを精度を損なうことなく自然に量子化モデルに統合する。我々はQA-LoRAをLLaMAおよびLLaMA2モデルファミリーに適用し、異なるファインチューニングデータセットおよび下流タスクにおける有効性を検証した。コードはhttps://github.com/yuhuixu1993/qa-loraで公開予定である。
English
Recently years have witnessed a rapid development of large language models
(LLMs). Despite the strong ability in many language-understanding tasks, the
heavy computational burden largely restricts the application of LLMs especially
when one needs to deploy them onto edge devices. In this paper, we propose a
quantization-aware low-rank adaptation (QA-LoRA) algorithm. The motivation lies
in the imbalanced degrees of freedom of quantization and adaptation, and the
solution is to use group-wise operators which increase the degree of freedom of
quantization meanwhile decreasing that of adaptation. QA-LoRA is easily
implemented with a few lines of code, and it equips the original LoRA with
two-fold abilities: (i) during fine-tuning, the LLM's weights are quantized
(e.g., into INT4) to reduce time and memory usage; (ii) after fine-tuning, the
LLM and auxiliary weights are naturally integrated into a quantized model
without loss of accuracy. We apply QA-LoRA to the LLaMA and LLaMA2 model
families and validate its effectiveness in different fine-tuning datasets and
downstream scenarios. Code will be made available at
https://github.com/yuhuixu1993/qa-lora.