Hinata: I read the article Running the Entire 320B Model with a 96GB GPU. The term "quantization" appeared there. Quantization is the process of coarsening numbers to reduce data size. It seems to involve cutting down numbers, such as to 1.75 bits or 3 bits, to make them smaller. I don’t understand how and what is being reduced.
Saeki: Imagine the number of colors in a photo. A full-color photo has a large data size, but if you reduce the colors to 16, the file becomes smaller. However, the gradients become rougher. Quantization works the same way. There are things called AI models (pre-trained programs), which contain many numbers. These numbers are truncated from fine precision to coarse steps. For example, remembering decimal places in detail is changed to "approximately this value." This reduces the required memory. Memory is where the computer stores data. This allows large models to run even on small GPUs. The 1.75 bits and 3 bits in the article refer to the difference in the number of bits used to represent a single number. Fewer bits mean rougher and smaller data. However, if it is made too coarse, quality drops, so there is a trade-off in where to draw the line. This is the interesting part of quantization.
Hinata: So, quantization is the method of coarsening numbers to make data smaller, just like reducing the number of colors in a photo. 1.75 bits or 3 bits are the number of bits used to remember one number; fewer bits mean rougher but smaller data. What caught my attention is "1.75 bits." A bit is a unit of 0 or 1, right? How do you count 1.75 bits?
Saeki: That’s correct. A bit is a unit of 0 or 1. Therefore, 1.75 bits cannot be allocated to a single number. 1.75 bits is an average value per number. In practice, several numbers are grouped together and represented as a bit sequence. For example, four numbers can be represented using 7 bits. Then, 7 ÷ 4 equals 1.75 bits per number. The number of bits used for individual numbers is not determined. Compression is done in chunks. That’s why fractional numbers appear.
Hinata: Bits are units of 0 or 1, and 1.75 bits is the average per number. If four numbers are represented with 7 bits, it becomes 1.75 bits per number, correct? And if numbers are compressed in groups, does it become difficult to extract only the necessary numbers later?
Saeki: You’ve put it well. That concern rarely occurs in reality. Model calculations do not use numbers one by one. Instead, large chunks are usually read out and used together. Therefore, you just read out the compressed chunk and select only the necessary numbers from it. If four numbers are summarized into 7 bits, you extract those four together and use one of them. It is slightly roundabout compared to accessing individual numbers, but the burden is small when viewed from the overall calculation.
Hinata: I see. Even if numbers are compressed in groups, calculations read out by chunks. So you just need to select what you need from within them. It may be roundabout compared to individual access, but the burden is small overall. And compressing in groups takes effort to read out. Is the gain from coarsening the precision of numbers through quantization greater than the effort for reading out? For example, if the precision of numbers is coarsened to 1.75 bits. Wouldn’t it become slower due to the reading out effort?
Saeki: Your understanding is correct. Since it reads out in chunks, using the numbers inside does not require much effort. Also, this site actually measured it. Whether coarsened to 1.75 bits or kept at 4 bits, the speed hardly changed. Here, VRAM is the memory where the model is placed. GPUs perform calculations, and CPUs issue overall instructions. As written in When the Model Doesn’t Fit in VRAM and Is Shared Between GPU and CPU, Speed Is Determined by the CPU, the burden of reading out is much less significant than whether the model fits in VRAM. The meaning of reducing size is not for speed, but to fit into memory.
Hinata: To summarize, quantization is a method of coarsening numbers to make data smaller. Fractional numbers like 1.75 bits appear because of chunk-based compression. Speed hardly drops. The meaning of making it smaller is to fit into memory. I think this is what will change. It allows large models to run on ordinary personal computers. Through quantization, the range of what can be run locally expands without special hardware. Is my understanding correct?
Saeki: Yes, your understanding is correct. Quantization is a tool to enable running large models locally without special hardware. However, our actual measurements show that being able to run and running quickly are separate issues.
If you try to run a 176B model on a 24GB GPU, you only achieve 5 tokens per second after cutting down to 1.75 bits. That’s about five words. This is exactly the same speed at which a person reads text; you won’t have to wait long, but there is no room for comfort. The next phase change depends on whether affordable hardware becomes available. That hardware will possess both memory bandwidth and capacity sufficient to run large models quickly. Memory bandwidth refers to the speed of reading and writing data. Currently, we can say we are still in the preceding stage.