Double quantization reduces memory use by applying a second quantization layer to the constants produced during an initial quantization step. In QLoRA, this lowers the storage overhead of quantized model weights while supporting memory-efficient fine-tuning. section 8.3.4 section 8.3
The technique fits into a quantized fine-tuning workflow as follows:
- Convert pretrained weights to a low-bit representation, such as NF4. section 8.3.4
- Quantize the constants used by that first quantization step to reduce their additional memory demand. section 8.3.4
- Use the result with LoRA in QLoRA to fine-tune large language models under tighter GPU-memory limits. section 8.3
Enabling double quantization with bitsandbytes
Set `load_in_4bit=True` and `bnb_4bit_use_double_quant=True` in `BitsAndBytesConfig`. The same configuration selects `bnb_4bit_quant_type="nf4"` and uses `torch.bfloat16` for computation while storing weights in the quantized format. section 8.3.4
