arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2210.17323cs.LG
收藏

GPTQ:生成式预训练Transformers的精确后训练Quantization

GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers

IST Austria(奥地利科学技术研究所);ETH Zurich(苏黎世联邦理工学院);NeuralMagic(神经魔法公司)

Elias Frantar, Saleh Ashkboos, Torsten Hoefler, Dan Alistarh

摘要:

生成式预训练的Transformer模型,称为GPT或OPT,通过在复杂语言建模任务中的突破性性能,以及极高的计算和存储成本,使自己脱颖而出。具体而言,由于其庞大的尺寸,即使是大型,高精度GPT模型的推理也可能需要多个高性能GPU,这限制了此类模型的可用性。虽然通过模型压缩缓解这种压力的工作正在兴起,但现有压缩技术的适用性和性能受到GPT模型的规模和复杂性的限制。在本文中,我们解决这个挑战,并提出GPTQ,一个新的单次权重量化方法的基础上近似二阶信息,这是高精度和高效率。具体来说,GPTQ可以在大约4个GPU小时内使用1750亿个参数对GPT模型进行优化,将位宽降低到每权重3或4位,相对于未压缩的基线,精度下降可以忽略不计。相对于之前提出的单次量化方法,我们的方法将压缩增益提高了一倍多,保持了准确性,使我们首次能够在单个GPU内执行1750亿个参数模型,以进行生成推理。此外,我们还表明,我们的方法仍然可以提供合理的精度在极端的量化制度,其中权重被量化到2位,甚至三进制量化水平。我们的实验表明,这些改进可以利用FP16的端到端推理加速,当使用高端GPU(NVIDIA A100)时约为3.25倍,当使用更具成本效益的GPU(NVIDIA A6000)时约为4.5倍。该实现可在https://github.com/IST-DASLab/gptq上获得。

英文摘要:

Generative Pre-trained Transformer models, known as GPT or OPT, set themselves apart through breakthrough performance across complex language modelling tasks, but also by their extremely high computational and storage costs. Specifically, due to their massive size, even inference for large, highly-accurate GPT models may require multiple performant GPUs, which limits the usability of such models. While there is emerging work on relieving this pressure via model compression, the applicability and performance of existing compression techniques is limited by the scale and complexity of GPT models. In this paper, we address this challenge, and propose GPTQ, a new one-shot weight quantization method based on approximate second-order information, that is both highly-accurate and highly-efficient. Specifically, GPTQ can quantize GPT models with 175 billion parameters in approximately four GPU hours, reducing the bitwidth down to 3 or 4 bits per weight, with negligible accuracy degradation relative to the uncompressed baseline. Our method more than doubles the compression gains relative to previously-proposed one-shot quantization methods, preserving accuracy, allowing us for the first time to execute an 175 billion-parameter model inside a single GPU for generative inference. Moreover, we also show that our method can still provide reasonable accuracy in the extreme quantization regime, in which weights are quantized to 2-bit or even ternary quantization levels. We show experimentally that these improvements can be leveraged for end-to-end inference speedups over FP16, of around 3.25x when using high-end GPUs (NVIDIA A100) and 4.5x when using more cost-effective ones (NVIDIA A6000). The implementation is available at https://github.com/IST-DASLab/gptq.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑