[论文解读] A Comprehensive Evaluation of Quantization Strategies for Large Language Models
本论文提出一个结构化框架,在量化下评估指令微调的LLMs,结果显示4位量化通常能保持性能,困惑度可以作为基准结果的代理指标,而2位量化在没有专门方法时可能失败。
Increasing the number of parameters in large language models (LLMs) usually improves performance in downstream tasks but raises compute and memory costs, making deployment difficult in resource-limited settings. Quantization techniques, which reduce the bits needed for model weights or activations with minimal performance loss, have become popular due to the rise of LLMs. However, most quantization studies use pre-trained LLMs, and the impact of quantization on instruction-tuned LLMs and the relationship between perplexity and benchmark performance of quantized LLMs are not well understood. Evaluation of quantized LLMs is often limited to language modeling and a few classification tasks, leaving their performance on other benchmarks unclear. To address these gaps, we propose a structured evaluation framework consisting of three critical dimensions: (1) knowledge \& capacity, (2) alignment, and (3) efficiency, and conduct extensive experiments across ten diverse benchmarks. Our experimental results indicate that LLMs with 4-bit quantization can retain performance comparable to their non-quantized counterparts, and perplexity can serve as a proxy metric for quantized LLMs on most benchmarks. Furthermore, quantized LLMs with larger parameter scales can outperform smaller LLMs. Despite the memory savings achieved through quantization, it can also slow down the inference speed of LLMs. Consequently, substantial engineering efforts and hardware support are imperative to achieve a balanced optimization of decoding speed and memory consumption in the context of quantized LLMs.
研究动机与目标
- 激发研究动机:在多样化基准上评估量化后的指令微调LLMs,而不仅限于预训练模型。
- 提出一个三维评估框架:知识与能力、对齐与效率。
- 在一系列基准上评估多种量化策略(PTQ)和参数规模,以理解性能-内存-速度之间的权衡。
- 识别量化LLMs在实际部署中的工程和硬件需求。
提出的方法
- 采用一个具有三个维度的结构化评估框架:效率、知识与能力,以及对齐。
- 使用三种量化方法——LLM.int8()、GPTQ 和 SpQR,将 Qwen-chat 模型量化到 8、4、3 和 2 位(LLM.int8() 限制为 8 位)。
- 在横跨知识、生成和对齐任务的十个基准,以及内存和速度等效率指标上进行评估。
- 将困惑度作为量化LLM在基准上的性能代理指标进行分析。
- 研究 SpQR 的离群点隔离和双层量化作为实现2位量化性能的关键。
- 在 A100 GPU 上提供内存与速度对比,以讨论实际部署考虑因素。
实验结果
研究问题
- RQ1量化后的指令微调LLMs在知识、对齐和生成基准上的表现,与未量化的对应模型相比如何?
- RQ2哪些比特精度水平能在 7B、14B 和 72B 的 Qwen-chat 模型上保持性能,困惑度与基准性能之间的关系如何?
- RQ3像 SpQR 这样的技术是否可以在极端的2位量化下实现而不发生灾难性性能损失,驱动因素是什么?
- RQ4在实际硬件设置中,不同量化方法对内存和速度的影响是什么?
主要发现
- 4-bit 量化在大多数基准上可以保持接近未量化模型的性能。
- 在相似内存预算下,具有较大参数规模的量化模型可能优于较小的未量化模型。
- 困惑度通常随量化比特减少而增加,可作为基准性能的代理。
- GPTQ 的2位量化会降低连贯性和指令遵循,而具有离群点隔离的 SpQR 则更鲁棒。
- GPTQ 和 LLM.int8() 可实现内存节省,但在此设置中 SpQR 由于权重表示保持高精度,可能不会降低内存占用;速度提升取决于硬件支持。
- 要实现量化LLMs的实际收益,工程量和硬件支持至关重要。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。