QLoRA adapts large language models without updating every pretrained parameter. It combines LoRA’s low-rank updates with quantized base-model weights, reducing memory demands while preserving the precision benefits of fine-tuning. section 8.3 section 8.3.4
QLoRA’s implementation combines several memory-saving mechanisms:
- Stores weights with 4-bit NormalFloat (NF4), designed for weights following a normal distribution. section 8.3.4
- Applies double quantization to the constants used by the first quantization step, reducing additional memory overhead. section 8.3.4
- Uses bfloat16 for computation while retaining NF4 for weight storage. section 8.3.4
- Uses paged optimizers to manage memory movement between CPU and GPU during gradient-checkpointing spikes. section 8.3.4
Loading a quantized Falcon model
A bitsandbytes configuration enables 4-bit loading, double quantization, NF4 storage, and bfloat16 computation before loading tiiuae/falcon-7b with the quantization configuration. The workflow also measures initial, final, and peak GPU memory. section 8.3.4


