Large Language Models (LLMs) are proficient in natural language processing tasks, but their deployment is often restricted by extensive parameter sizes and computational demands. This paper focuses on post-training quantization (PTQ) in LLMs, specifically 4-bit weight and 8-bit activation (W4A8) quantization, to enhance computational efficiency -- a topic less explored compared to weight-only quantization. We present two innovative techniques: activation-quantization-aware scaling (AQAS) and sequence-length-aware calibration (SLAC) to enhance PTQ by considering the combined effects on weights and activations and aligning calibration sequence lengths to target tasks. Moreover, we introduce dINT, a hybrid data format combining integer and denormal representations, to address the underflow issue in W4A8 quantization, where small values are rounded to zero. Through rigorous evaluations of LLMs, including OPT and LLaMA, we demonstrate that our techniques significantly boost task accuracies to levels comparable with full-precision models. By developing arithmetic units compatible with dINT, we further confirm that our methods yield a 2$\times$ hardware efficiency improvement compared to 8-bit integer MAC unit.
翻译:大型语言模型(LLM)在自然语言处理任务中表现出色,但其部署常受限于庞大的参数量与计算需求。本文聚焦于LLM的训练后量化(PTQ),特别是4比特权重与8比特激活(W4A8)量化,以提升计算效率——这一方向相较于仅权重量化而言研究较少。我们提出两种创新技术:激活量化感知缩放(AQAS)与序列长度感知校准(SLAC),通过综合考虑权重与激活的联合影响并使校准序列长度与目标任务对齐,从而增强PTQ效果。此外,我们引入混合数据格式dINT(整数与非规格化表示的结合),以解决W4A8量化中的下溢问题(即微小数值被舍入为零)。通过对OPT和LLaMA等LLM的严格评估,我们证明所提技术能将任务准确率显著提升至接近全精度模型的水平。通过开发与dINT兼容的运算单元,我们进一步证实,与8比特整数MAC单元相比,本方法可实现2倍的硬件效率提升。