FDEInterviews logo
NeurIPS 2023

QLoRA: Efficient Finetuning of Quantized LLMs

LoRA on top of a 4-bit base model: QLoRA fit a 65B fine-tune onto one 48 GB GPU with no measured loss, and showed that 9,000 good examples beat 450,000 mediocre ones.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2023
AUTHORS
Dettmers, Pagnoni, Holtzman, Zettlemoyer
FROM
University of Washington
PUBLISHED
May 2023 · NeurIPS 2023
CITED BY
6,011Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 20% of this breakdown.

01

The paper in one minute

LoRA (paper 35) trains small adapter matrices instead of the whole model, but the frozen base model still has to sit in GPU memory at 16-bit precision. For LLaMA 65B that alone is 130 GB, and full fine-tuning needed more than 780 GB. Quantizing models to 4 bits was known to work for inference, but it broke down when training through the quantized weights.

QLoRA, from Tim Dettmers and colleagues at the University of Washington, makes training through a 4-bit model work. It stores the frozen weights in 4 bits and computes in 16-bit: each weight block is converted back to 16-bit when used, and gradients flow through it into LoRA adapters that are trained in 16-bit. Three pieces make it fit and stay accurate. 4-bit NormalFloat (NF4) is a data type whose 16 levels are placed at quantiles of a normal distribution, which is how trained weights are distributed, so each level is used about equally. Double quantization compresses the per-block scaling constants themselves, saving about 0.37 bits per parameter, roughly 3 GB on a 65B model. Paged optimizers move optimizer state to CPU memory when a long sequence causes a memory spike, instead of crashing. And LoRA is applied to every linear layer, not just two attention matrices, which the authors found necessary to match full fine-tuning.

The result: a 65B model fine-tunes in under 48 GB, one large GPU, with no measured loss against 16-bit LoRA or 16-bit full fine-tuning on the benchmarks tested. Using it, the authors trained over 1,000 models. Their Guanaco 65B, tuned on about 9,000 conversations from OASST1 for 24 hours on one GPU, reached 99.3% of ChatGPT's score on the Vicuna benchmark as judged by GPT-4. The same model tuned on FLAN v2's 450,000 examples scored 48.4%.

THE IDEA, VISUALLY
SPEND THE 16 LEVELS WHERE THE WEIGHTS ARE NF4 Int4 weight distribution (normal) Blockwise quantization error on normal weights (our run): NF4 1.00× · FP4 1.32× · Int4 1.37× MEMORY TO FINETUNE A 65B MODEL 16-bit full fine-tuning: more than 780 GB QLoRA: under 48 GB, one GPU 4-bit NF4 base · LoRA on every linear layer · paged optimizers DATA MATTERS MORE THAN SIZE Vicuna benchmark, % of ChatGPT's score (GPT-4 judge), Table 6 Guanaco 65B (OASST1, 9k) 99.3% Guanaco 33B 97.8% Vicuna 13B (16-bit) 94.9% Guanaco 7B, 5 GB 87.0% Alpaca 65B 70.7% FLAN v2 65B (450k) 48.4% Same 65B base, 4-bit, different finetuning data. Each score carries a ±4–5 point 95% interval.
QLoRA's two lessons in one picture: a 4-bit data type shaped to how weights are distributed, which made single-GPU fine-tuning of 65B models possible, and a data result, where 9,000 curated conversations beat 450,000 task examples.
Research notes: the problem, approach and results
780 GB → 48 GB

GPU memory to fine-tune a 65B model, 16-bit vs QLoRA

99.3%

of ChatGPT's score on the Vicuna benchmark for Guanaco 65B (±4.4)

9k > 450k

OASST1 examples beat FLAN v2 examples for chatbot quality at the same model size

THE PROBLEM

LoRA shrank what you train, but the frozen base model still had to sit in 16-bit memory. Fine-tuning LLaMA 65B the normal way needed over 780 GB of GPU memory.

THE IDEA

Store the frozen base model in a new 4-bit format (NormalFloat), quantize the quantization constants too, page optimizer state to CPU when memory spikes, and train LoRA adapters on every layer in 16-bit.

THE RESULT

65B fine-tuning in under 48 GB with no measured loss against 16-bit methods. Guanaco 65B, tuned for 24 hours on one GPU, reached 99.3% of ChatGPT on the Vicuna benchmark.

02

Why it matters to an FDE

QLoRA is why "can we fine-tune an open model on our data?" became a one-GPU question. Most customer fine-tuning of open models since 2023 uses it or its descendants.

Hardware stops being the blocker. A 7B to 13B model fine-tunes on a single workstation GPU; 33B on a 24 GB consumer card in under 12 hours; 65B on one 48 GB GPU. That changes the conversation from procurement to data and evaluation.

Data quality decides the outcome. The paper's most useful lesson for customers: 9,000 curated conversations beat 450,000 examples of the wrong kind. What matters is how well the training data matches the task you want, not its size. Spend the project's time on the examples.

Benchmarks disagree about what "better" means. FLAN v2 produced the best MMLU scores and the worst chatbot scores. Pick the evaluation that matches the customer's use, and do not let a general benchmark choose the dataset.

It is a training technique, not a serving format. You can merge the adapter into a 16-bit model, or serve the 4-bit base with the adapter. Serving choices, including faster quantization methods for inference, are a separate decision.

LLM judges need care. GPT-4 scored whichever answer came first higher. If you use a model to compare a fine-tune against a baseline, score both orders.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 49 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦5 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The three techniques, the evaluation findings, and the misreadings to avoid

    Free account
  2. 04How it works

    NF4 construction, double quantization, paged optimizers and the forward and backward pass

    Premium
  3. 05The numbers that matter

    Data types, memory, chatbot results and the evaluation agreement numbers

    Premium
  4. 06Try it yourself

    Build NF4 from scratch, check it against the paper, and measure its error and memory savings

    Premium
  5. 07Where it breaks

    What the paper did not establish, and how to read its chatbot results

    Premium
  6. 08Using it on a deployment

    Planning a QLoRA fine-tune for a customer, from data to serving

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →