QLoRA:量子化された大規模言語モデルの効率的なファインチューニング
QLoRA: Efficient Finetuning of Quantized LLMs
May 23, 2023
著者: Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, Luke Zettlemoyer
cs.AI
要旨
QLoRAを紹介します。これは、65Bパラメータのモデルを単一の48GB GPUでファインチューニング可能なほどメモリ使用量を削減しつつ、16ビットファインチューニングのタスク性能を完全に維持する効率的なファインチューニング手法です。QLoRAは、凍結された4ビット量子化された事前学習済み言語モデルを通じて勾配を逆伝播し、Low Rank Adapters(LoRA)に伝えます。私たちがGuanacoと名付けた最良のモデルファミリーは、Vicunaベンチマークにおいてこれまでに公開されたすべてのモデルを上回り、ChatGPTの性能レベルの99.3%に到達し、単一GPUでの24時間のファインチューニングのみを必要とします。QLoRAは、性能を犠牲にすることなくメモリを節約するためのいくつかの革新を導入しています:(a)正規分布する重みに対して情報理論的に最適な新しいデータ型である4ビットNormalFloat(NF4)、(b)量子化定数を量子化することで平均メモリフットプリントを削減するダブル量子化、および(c)メモリスパイクを管理するページドオプティマイザ。QLoRAを使用して1,000以上のモデルをファインチューニングし、8つの指示データセット、複数のモデルタイプ(LLaMA、T5)、および通常のファインチューニングでは実行が不可能なモデルスケール(例:33Bおよび65Bパラメータモデル)にわたる指示追従とチャットボット性能の詳細な分析を提供します。私たちの結果は、小さな高品質データセットでのQLoRAファインチューニングが、以前のSoTAよりも小さなモデルを使用しても最先端の結果をもたらすことを示しています。人間とGPT-4の評価に基づくチャットボット性能の詳細な分析を提供し、GPT-4評価が人間評価の安価で合理的な代替手段であることを示します。さらに、現在のチャットボットベンチマークはチャットボットの性能レベルを正確に評価するのに信頼できないことがわかりました。レモンピッキング分析により、GuanacoがChatGPTと比較して失敗する点を明らかにします。私たちは、4ビットトレーニング用のCUDAカーネルを含むすべてのモデルとコードを公開します。
English
We present QLoRA, an efficient finetuning approach that reduces memory usage
enough to finetune a 65B parameter model on a single 48GB GPU while preserving
full 16-bit finetuning task performance. QLoRA backpropagates gradients through
a frozen, 4-bit quantized pretrained language model into Low Rank
Adapters~(LoRA). Our best model family, which we name Guanaco, outperforms all
previous openly released models on the Vicuna benchmark, reaching 99.3% of the
performance level of ChatGPT while only requiring 24 hours of finetuning on a
single GPU. QLoRA introduces a number of innovations to save memory without
sacrificing performance: (a) 4-bit NormalFloat (NF4), a new data type that is
information theoretically optimal for normally distributed weights (b) double
quantization to reduce the average memory footprint by quantizing the
quantization constants, and (c) paged optimziers to manage memory spikes. We
use QLoRA to finetune more than 1,000 models, providing a detailed analysis of
instruction following and chatbot performance across 8 instruction datasets,
multiple model types (LLaMA, T5), and model scales that would be infeasible to
run with regular finetuning (e.g. 33B and 65B parameter models). Our results
show that QLoRA finetuning on a small high-quality dataset leads to
state-of-the-art results, even when using smaller models than the previous
SoTA. We provide a detailed analysis of chatbot performance based on both human
and GPT-4 evaluations showing that GPT-4 evaluations are a cheap and reasonable
alternative to human evaluation. Furthermore, we find that current chatbot
benchmarks are not trustworthy to accurately evaluate the performance levels of
chatbots. A lemon-picked analysis demonstrates where Guanaco fails compared to
ChatGPT. We release all of our models and code, including CUDA kernels for
4-bit training.