Quantise the frozen part, train in full precision
LoRA already freezes the base model, so the frozen weights are read and never updated. QLoRA's observation is that a read-only weight does not need 16 bits.
The base is stored in 4 bits, dequantised to bf16 one block at a time inside the matrix multiply, and the adapters stay in full precision because they are the thing being learned.
That is what puts a 7-billion-parameter fine-tune on a consumer card, and a 65-billion one on a single 48 GB card.
NF4, the data type
Neural weights are approximately normally distributed, so a uniform 4-bit grid wastes most of its levels on values that almost never occur.
NF4 places its 16 levels at the quantiles of a normal distribution, so each level is equally likely to be used.
Each block of 64 weights carries its own scale , since a single scale across a whole tensor would be dominated by its largest outlier.
Double quantisation
Those block scales are themselves a real cost. Quantising them too, in blocks of 256, cuts the overhead to about 0.127 bits per weight.
It is a small saving in percentage terms and it is most of a gigabyte on a large model, which is often the difference between fitting and not.
Paged optimisers
Memory use spikes when a long sequence arrives, and a spike that exceeds the card kills a run that has been going for hours.
Paged optimiser states move to CPU memory when the GPU is under pressure and come back when it is not, using the same unified memory mechanism as operating system paging.
It makes the failure mode slow rather than fatal, which is the difference between a finished run and a lost one.
One fine-tune, in order
- Load the base model with 4-bit NF4 quantisation and double quantisation on.
- Attach LoRA adapters to the attention and feed-forward projections.
- Train with a paged optimiser and gradient checkpointing.
- Save only the adapter, a few tens of megabytes.
- For serving, either keep the quantised base with the adapter attached, or merge the adapter into the full precision base.
Step five has a trap. Merging bf16 adapters into a 4-bit base and saving the result loses precision twice, so the merge should be done against the original weights.
What it costs
Dequantisation happens on every forward pass, so training is roughly a third slower than unquantised LoRA on hardware that had the memory anyway.
Quality, on the published comparisons, is within noise of 16-bit LoRA, which is the result that made the method standard rather than a compromise.
The base model's own accuracy does drop slightly under 4-bit quantisation, and the adapter is trained against the quantised base, so it learns to compensate for exactly that error.