Current bottleneck for AI hardware is memory bandwidth. Serving large models and maintaining its KV-cache use hundreds of GB of memory. Quantization is a technique that is used during model inference. Instead of using FP16, it uses INT8 or even more smaller bits. By doing so, we can use less memory(for storing model weights) and boost the compute time(for example, CUDA Tensor Core FLOPS is x2 bigger in INT8 compared to FP16 data type).
This post introduces fundamental quantization method.
Quantization in AI is about compacting the data using lesser bits. For example, most popular quantization method nowadays is converting FP16 into INT8. By doing so, we are just using half of bits during calculation.
However, we should be careful using quantization because quantization inevitably loses precision of the data. As we quantize FP16 into INT8, and dequantize INT8 into FP16, information will be lost.
Now let’s look at how quantization is used in multiplication. I am going to look at vector multiplication, but you can easily apply it to matrix multiplication.