Skip to main content
QUICK REVIEW

[论文解读] The case for 4-bit precision: k-bit Inference Scaling Laws

Tim Dettmers, Luke Zettlemoyer|arXiv (Cornell University)|Dec 19, 2022
Topic ModelingComputer Science被引用 22
一句话总结

本文研究跨多个LLM家族的零-shot量化的位级推理扩展规律,并发现4位精度在固定总模型位数和零-shot准确率下几乎普遍最优。

ABSTRACT

Quantization methods reduce the number of bits required to represent each parameter in a model, trading accuracy for smaller memory footprints and inference latencies. However, the final model size depends on both the number of parameters of the original model and the rate of compression. For example, a 30B 8-bit model and a 60B 4-bit model have the same number of bits but may have very different zero-shot accuracies. In this work, we study this trade-off by developing inference scaling laws of zero-shot performance in Large Language Models (LLMs) to determine the bit-precision and model size that maximizes zero-shot performance. We run more than 35,000 experiments with 16-bit inputs and k-bit parameters to examine which zero-shot quantization methods improve scaling for 3 to 8-bit precision at scales of 19M to 176B parameters across the LLM families BLOOM, OPT, NeoX/Pythia, and GPT-2. We find that it is challenging to improve the bit-level scaling trade-off, with the only improvements being the use of a small block size -- splitting the parameters into small independently quantized blocks -- and the quantization data type being used (e.g., Int vs Float). Overall, our findings show that {4-bit} precision is almost universally optimal for total model bits and zero-shot accuracy.

研究动机与目标

  • 激励在量化的LLMs中研究模型大小(位)与零-shot准确率之间的权衡。
  • 系统地评估不同位精度水平如何影响跨多个LLM家族和规模的零-shot性能。
  • 在固定总模型大小下,确定优化位级扩展的量化设置(数据类型、块大小)。
  • 提供使用4位量化的实际建议,并讨论局限性和未来方向。

提出的方法

  • 在OPT、BLOOM、Pythia/NeoX、GPT-2和BLOOMZ模型上进行了超过35,000次实验,输入为16位,参数为k位(3 ≤ k ≤ 16),模型规模从19M到176B参数。
  • 使用EleutherAI LM Eval Harness评估LAMBADA、PiQA、Winogrande、HellaSwag的零-shot性能;以困惑度作为可靠度量,但为清晰起见报告零-shot准确率。
  • 研究分块(块大小)、量化数据类型(Int、Float、quantile、动态指数)以及离群点相关的代理量化,以评估它们对位级扩展的影响。
  • 比较了6–8位方法,未发现扩展性提升;聚焦于4位在较小块大小和有利数据类型下的改进。
  • 对缩放曲线拟合线性插值,而非多变量幂律,观察到不同精度上近乎平行的缩放趋势。

实验结果

研究问题

  • RQ1在固定总模型位数下,不同LLM家族和规模中,零-shot性能的最优位精度是多少?
  • RQ2当精度降至3–8位时,量化方法(数据类型、块大小、离群处理)如何影响位级扩展?
  • RQ34位模型在模型大小和家族间是否普遍实现了零-shot准确性和效率的最大化?
  • RQ4离群点相关量化或一次性量化方法是否能在4位以下的位级扩展上取得显著改进?

主要发现

  • 4位精度在几乎所有测试的模型和规模上均实现最佳的位级扩展;仅在他们的研究中,3位在BLOOM-176B上可能略有更好。
  • 缩放曲线在模型大小之间基本平行,表明位级扩展在很大程度上与规模无关。
  • 在大型模型中,OPT和Pythia的3位不稳定性出现,而GPT-2和BLOOM保持稳定。
  • 较小的块大小(例如64–128)和某些数据类型(quantile量化、浮点)在4位扩展中比其他调整更能提升缩放。
  • 6–8位量化方法的任意组合都未改善位级扩展;改进主要来自保持在4位并使用有利的块大小和数据类型。
  • 离群点相关的代理量化可以稳定3位的OPT/Pythia,但并未超过4位扩展;4位在扩展方面仍然是最优。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。