Fine-tune a 65B model on one 48 GB GPU without losing quality
99.3%of ChatGPT on Vicuna, in 24 hours
QLoRA: Efficient Finetuning of Quantized LLMs
Dettmers et al., University of WashingtonNeurIPS 20237 slides, 2 min
Figure 1, from the paper2/7
LoRA on a 4-bit base, with paging for spikes
Full fine-tuning keeps 32-bit optimizer state for every weight. LoRA trains small 16-bit adapters. QLoRA also stores the frozen base in 4 bits and pages optimizer state to CPU memory.
How it works3/7
Three tricks shrink memory without hurting accuracy
1
4-bit NormalFloat
A data type whose levels are quantiles of a normal distribution, information-theoretically optimal for normally distributed weights.
2
Double quantization
Quantize the quantization constants too, saving about 0.37 bits per parameter, roughly 3 GB on a 65B model.
3
Paged optimizers
Unified memory moves optimizer state to CPU RAM during memory spikes, avoiding out-of-memory crashes.
Before and after4/7
Memory was the wall, not compute
16-bit fine-tuning
Fine-tuning LLaMA 65B in 16-bit needs more than 780 GB of GPU memory, a multi-node job.
QLoRA
The same model fine-tunes in under 48 GB on a single GPU, with gradients flowing through the frozen 4-bit weights into the adapters.
Store in 4 bits, compute in 16: dequantize on the fly, layer by layer.
Results5/7
Guanaco nearly matches ChatGPT on Vicuna
MethodScore vs ChatGPT↑
GPT-4114.5%
Guanaco 65B4-bit, 41 GB99.3%
Guanaco 33B97.8%
Bard94.8%
GPT-4-judged score relative to ChatGPT on the Vicuna benchmark. The authors caution these judgments are noisy.
The catch6/7
What the paper could not settle
Parity unproven at 33B and 65B
Matching full 16-bit fine-tuning was not established at the largest scales because of resource costs.
Chatbot benchmarks are shaky
Vicuna and OpenAssistant evaluations are small, and GPT-4 judges show ordering and self-preference biases.
Data choice dominates
A 9k-example OASST1 set beat a 450k-example FLAN v2 subset for chat quality.
Takeaways7/7
Why it matters
Freezing a 4-bit base and training LoRA adapters matches 16-bit fine-tuning quality.
NF4, double quantization and paged optimizers put 65B fine-tuning on one 48 GB GPU.
Small, high-quality instruction data mattered more than size for chatbot quality.
1/7
65 upvotes on Hugging Face 7 slides, 2 min
University of WashingtonFine-tunes LoRA adapters on top of a frozen 4-bit model using NormalFloat4, double quantization and paged optimizers. A 65B model trains on one 48 GB GPU, and Guanaco reaches 99.3% of ChatGPT on the Vicuna benchmark.