Quantization Scale
The quantization scale is the float value that maps the range of integer values to the range of the original floating-point data. It is computed as `(max_val - min_val) / (quant_max - quant_min)` and determines the step size between adjacent quantized levels.
What is Quantization Scale?
The quantization scale is the float value that maps the range of integer values to the range of the original floating-point data. It is computed as `(max_val - min_val) / (quant_max - quant_min)` and determines the step size between adjacent quantized levels.
The quantization scale is the float value that maps the range of integer values to the range of the original floating-point data. It is computed as `(max_val - min_val) / (quant_max - quant_min)` and determines the step size between adjacent quantized levels.
Where is it used?
In INT8 quantization (BitsAndBytes, GPTQ), each weight tensor or channel gets a scale. Smaller scales mean finer quantization resolution. In per-channel quantization, each output channel has its own scale, reducing error compared to per-tensor quantization.
How to build it
For symmetric INT8: `scale = x.abs().max() / 127`. For asymmetric: `scale = (x.max() - x.min()) / 255`. Store `scale` as a float alongside the quantized tensor. Apply: `q = torch.round(x / scale).to(torch.int8); deq = q.float() * scale`.