arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2611.22128cs.LG
收藏

TempQuant:为量化语言模型学习自适应温度

TempQuant: Learning Adaptive Temperatures for Quantized Language Models

AMD(超威半导体公司);Cornell University(康奈尔大学)

Mukund Athmaram, Liang Ma, Manoj Rao

AI总结:

TempQuant方法学习量化语言模型的自适应温度与top-p,以缩小其与全精度模型的下一个词元概率差距,在3位量化Qwen3-4B上使MATH准确率从34%提升至51%。

摘要:

大型语言模型越来越多地以低精度部署,但量化会降低其性能。我们通过研究量化如何扭曲模型的下一个词元概率,来探究量化与解码设置(如采样温度和top-p)之间的相互作用。在生成过程中,我们测量不同部署温度下的熵,发现量化平均会使模型“升温”,且温度对量化模型性能的影响远大于全精度模型。由于量化和温度都会塑造下一个词元分布,我们提出了TempQuant方法,该方法学习量化模型的温度和top-p,使其下一个词元概率更接近全精度模型的概率,以此探究采样设置能在多大程度上抵消量化带来的改变。我们以两种粒度学习这些设置:第一种是每个请求温度对应的单一全局设置,无需任何标签,就能找到与在标注答案上调优得到的温度几乎相同的温度。模型卡通常建议量化模型使用与全精度模型相同的采样设置,而我们发现不同的设置能大幅提升其准确率。例如,在3位量化的Qwen3-4B上,全局TempQuant将MATH数据集的准确率从Qwen量化版本推荐配置下的34%提升至51%。第二种是为每个词元单独设置温度和top-p,这一设置的动机源于我们的发现:量化下排名发生翻转的词元往往需要升温,而排名保持不变的词元则往往需要降温。当量化大幅降低准确率时,TempQuant能恢复大部分准确率;当降低幅度较小时,它仍能使量化模型的行为更接近全精度模型。

英文摘要:

Large language models are increasingly deployed at low precision, yet quantization can degrade their performance. We study how quantization interacts with decoding settings such as the sampling temperature and top-p by examining how it distorts the model's next-token probabilities. Measuring entropy during generation across deployed temperatures, we find that quantization warms the model on average, and that temperature matters much more for the performance of a quantized model than for its full-precision counterpart. Because quantization and temperature both shape the next-token distribution, we investigate how much the sampling settings can undo what quantization changes, through our method TempQuant, which learns the quantized model's temperature and top-p to bring its next-token probabilities closer to the full-precision model's. We learn these settings at two granularities. The first is a single global setting per requested temperature, which finds nearly the same temperatures that tuning on labeled answers would, without any labels. Model cards typically recommend sampling a quantized model with the same settings as its full-precision counterpart, while we find that different settings can substantially improve its accuracy. On 3-bit Qwen3-4B, for example, global TempQuant raises MATH accuracy from 34% under the configuration recommended for Qwen's quantized releases to 51%. The second sets the temperature and top-p for every token, motivated by our finding that tokens whose rankings flip under quantization tend to need warming, while tokens whose rankings are preserved tend to need cooling. When quantization degrades accuracy substantially, TempQuant recovers much of it, and when degradation is lighter, it still brings the quantized model's behavior closer to the full-precision model's.

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

↑