Per-token quantization adds up to 10% extra latency
$\textbf{Q1:}$ Inference speed and expensive operations.
$\textbf{A1:}$ In this paper, we are primarily concerned with the theoretical upper-bound of inference time in W4A8 bit widths. The real inference speed, however, largely depends on the specific hardware support (GPU, CPU, FPGA, etc.) and the amount of engineering effort put into implementations.
**Costly operations.** Below we provide an end-to-end performance comparison of per-token dynamic quantization and per-tensor quantization under the W8A8 setting. Notice that per-token dynamic quantization adds extra overhead that ranges from 5% to 10%.
|Batch size | input length | output length | FP16 | W8A8 Per-tensor | W8A8 Per-token |
| :---: | :----:| :---:| :----:| :----:| :----:|
|1 | 1024 | 128 | 1772ms | 1331 (1.33x) | 1406 (1.26x) |
|4 | 1024 | 128 | 2003ms | 1519 (1.32x) | 1589 (1.26x) |
|16 | 1024 | 128 | 3163ms | 2448 (1.29x) | 2634 (1.20x) |
|32 | 1024 | 128 | 4998ms | 4013 (1.25x) | 4492 (1.12x) |
*Table i. Latency of LLaMA2-13b tested on a A100 80G GPU*
$\textbf{Q2:}$ The degradation is shown on MMLU.
$\textbf{A2:}$ It is expected that the degradation increases as we chase narrower bit widths. Noticeably, we've updated LLM-QAT W4A8 results in Table 4 while FPTQ generally prevails over it. This attests that FPTQ is a strong PTQ method that even outperforms the QAT method. Nonetheless, the majority of our MMLU results are comparable to or better than W8A8 and W4A16, There are orthogonal ways such as weight-clipping, GPTQ, distillation, or applying better calibration data to mitigate this quantization gap, however, it is not the key focus of this paper. We maintain the current settings for a fair comparison.
$\textbf{Q3:}$ On how v0 and v1 is selected.
$\textbf{A3:}$ The values of v0 and v1 (recommended as 15 and 150) were determined empirically. We discover that per-tensor activation quantization already generates low MSE for the range (0, v0). While for (v0, v1) it calls for LAE to smooth the range first before per-tensor quantization to have an acceptable MSE. For intractable layers like FC2 that go far beyond v1, we resort to per-token quantization. According to activation distributions over a large body of LLMs in Table ii (also see Fig.5 - Fig 10 in the appendix), this selects QKV, and FC1 for LAE before per-tensor quantization, while keeping the Dense layer untouched.
| Model | QKV | Dense | FC1 | FC2 |
| :---: | :----:| :---:| :----:| :----:|
| | min/max| min/max| min/max | min/max | min/max |
|OPT-66B| 3.2871 / 94.87 | 0.0581/16.45 | 3.3223 / 94.81 | 0.1580 / 34.00 |
|BLOOM-176B| 1.7451 / 97.31 | 0.0972 / 17.07 | 3.9922 / 119.81 | 0.1636 / 71.00 |
|GLM-130B | 2.7188 / 115.12 | 0.2861 / 19.39 | 3.3125 / 124.56 | 0.5513 / 5476 |
|LLaMA-65B | 0.4927 / 22.51 | 0.0518 / 17.40 | 0.2856 / 27.07 | 0.0485 / 887.50 |
*Table ii. Activation ranges of different types of layers in various LLMs*
After the application of the proposed LAE on QKV and FC1, we have a smoothed activation range that is much easier to quantize, as shown in Table iii below.
| Model | QKV | Dense | FC1 | FC2 |
| :---: | :----:| :---:| :----:| :----:|
|OPT-66B| 0.2637 / 4.0312 | 0.0572 / 16.45 | 0.3489 / 3.2852 | 0.1570 / 34.00 |
|BLOOM-176B| 0.2446 / 4.6680 | 0.0972 / 17.07 | 0.4021 / 6.4648 | 0.1632 / 71.06 |
|GLM-130B | 0.4658 / 1.8955 | 0.2861 / 19.37 | 0.4006 / 2.0156 | 0.5513 / 5476 |
|LLaMA-65B | 0.2371 / 3.1094 | 0.0518 / 17.39 | 0.1586 / 3.6973 | 0.0485 / 887.50 |
*Table iii. Smoothed activation ranges (min/max) of different types of layers in various LLMs*
$\textbf{Minor:}$
- Table 4 bold numbers are mismarked and it is removed in the revision.
- Page 5, two strategies refer to per-channel strategy and fine-grained strategy. Modern GPUs support per-block computation for tensors which can be exploited for the fine-grained strategy.
- For the KV cache, we use per-tensor static quantization throughout all the experiments.
- In Table 6, the variations due to different calibration datasets are actually small. Our intention was to demonstrate that our method isn't limited to specific calibration sets and that our performance remains robust even on randomly selected data.