QLoRA: 양자화된 대형 언어 모델의 효율적 미세 조정
QLoRA: Efficient Finetuning of Quantized LLMs
May 23, 2023
저자: Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, Luke Zettlemoyer
cs.AI
초록
우리는 단일 48GB GPU에서 65B 파라미터 모델을 미세 조정할 수 있을 만큼 메모리 사용량을 줄이면서도 16비트 미세 조정 작업 성능을 완전히 보존하는 효율적인 미세 조정 접근 방식인 QLoRA를 제안합니다. QLoRA는 고정된 4비트 양자화된 사전 학습 언어 모델을 통해 그래디언트를 역전파하여 Low Rank Adapters(LoRA)로 전달합니다. 우리가 Guanaco로 명명한 최고의 모델 패밀리는 Vicuna 벤치마크에서 이전에 공개된 모든 모델을 능가하며, 단일 GPU에서 단 24시간의 미세 조정만으로 ChatGPT 성능 수준의 99.3%에 도달합니다. QLoRA는 성능을 희생하지 않으면서 메모리를 절약하기 위해 여러 혁신을 도입했습니다: (a) 정규 분포 가중치에 대해 정보 이론적으로 최적인 새로운 데이터 타입인 4비트 NormalFloat(NF4), (b) 양자화 상수를 양자화하여 평균 메모리 사용량을 줄이는 이중 양자화, 그리고 (c) 메모리 급증을 관리하기 위한 페이징 옵티마이저. 우리는 QLoRA를 사용하여 1,000개 이상의 모델을 미세 조정했으며, 8개의 명령어 데이터셋, 다양한 모델 유형(LLaMA, T5), 그리고 일반적인 미세 조정으로는 실행이 불가능한 모델 규모(예: 33B 및 65B 파라미터 모델)에 걸친 명령어 수행 및 챗봇 성능에 대한 상세한 분석을 제공합니다. 우리의 결과는 작은 고품질 데이터셋에 대한 QLoRA 미세 조정이 이전 최첨단 기술보다 더 작은 모델을 사용하더라도 최첨단 결과를 이끌어냄을 보여줍니다. 우리는 인간 평가와 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.