Quantization stores numbers with fewer bits. QLoRA combines a 4-bit frozen backbone with LoRA adapters so you keep most of LoRA’s adaptation power while the base model takes much less memory.
Plain LoRA still needs the base weights in higher precision in memory. Quantized PEFT asks: can the frozen backbone live in 4-bit form while the small adapter still learns the task?
That is QLoRA’s core move:
Quantization converts a fat number type (for example 32-bit float) into a thinner one (for example 8-bit or 4-bit). Goals:
Uniform quantization uses evenly spaced bins and a scale constant. It is easy to understand, but not ideal when weights are roughly bell-shaped (normal-like): most values sit near zero, and evenly spaced bins waste precision in the wrong places.
Instead of quantizing a whole giant tensor with one global scale, quantize smaller blocks independently. That reduces damage from outliers (one extreme value no longer ruins the scale for everything).
NF4 means 4-bit NormalFloat. It is designed for weights that are roughly normally distributed:
Typical workflow:
Block-wise quantization needs scale constants for each block. Those constants also take space. Double quantization compresses those constants too — quantize the quantization metadata.
This matters more when blocks are small, because more blocks mean more scale metadata.
| Ingredient | What it saves | Why it helps |
|---|---|---|
| NF4 | Base weight storage | Cuts model footprint sharply |
| Double quantization | Quantization constants | Reduces metadata overhead |
| Gradient checkpointing | Activation memory | Trade a bit of compute for memory (next chapter) |
| Paged optimizer | Optimizer memory spikes | Avoids sudden out-of-memory crashes (next chapter) |
Quantization compresses frozen weights; QLoRA pairs 4-bit storage with LoRA so large models become trainable under tight memory.