Post-training quantization converts a pretrained model to lower-precision representations without additional training, reducing inference memory and supporting resource-constrained or rapid deployment scenarios. section 8.3.3
Quantization choices involve distinct trade-offs:
- Nonuniform quantization uses variable-sized intervals adapted to weight or layer distributions, potentially reducing quantization error. section 8.3.3
- Quantization-aware training retrains with quantized weights and activations, preserving performance at lower precision but increasing computational cost. section 8.3.3
- Post-training quantization avoids retraining and is less computationally demanding, but typically remains at 8-bit or 6-bit precision. section 8.3.3
Loading a 4-bit model
A bitsandbytes configuration loads Falcon 7B with 4-bit weights, selects FP4 quantization, uses bfloat16 computation, and records GPU memory before and after loading. section 8.3.3
Table 8.1 Comparison of data types
|
Data type
|
Bit width
|
Range
|
Memory reduction from FP32
|
|---|---|---|---|
|
float32
|
32 bits
|
≈ ± 3.4 × 10^{38}
|
–
|
|
float16
|
16 bits
|
≈ ± 6.5 × 10^{4}
|
50%
|
|
int8
|
8 bits
|
-128 to 127
|
75%
|
|
int4
|
4 bits
|
-8 to 7
|
87.5%
|
Compare float32, float16, int8, and int4 bit widths, numeric ranges, and stated memory reductions. section 8.3.3

