arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.11203cs.LG
收藏

Error Diffusion:用于神经网络的基于块缩放数字格式的后训练量化

Error Diffusion: Post Training Quantization with Block-Scaled Number Formats for Neural Networks

AMD(超威半导体公司)

Alireza Khodamoradi, Kristof Denolf, Eric Dellinger

AI总结:

本文提出一种无需超参数且不依赖反向传播的后训练量化方法error diffusion(ED),通过将神经网络视为复合函数扩散各层量化误差,并配合基于PyTorch的TensorCast库支持块缩放数字格式,有效提升了视觉模型和LLMs的量化效果与部署。

摘要:

量化能降低模型的硬件成本,如数据移动、存储以及乘法和加法等运算。但它也会因降低输出质量而影响模型行为。因此,需要一些在量化模型参数时能保持模型行为的方法。更特殊的数值编码方式,如块缩放数字格式,在利用固定比特预算编码模型参数方面已展现出优势。本文提出了error diffusion(ED),这是一种无需超参数的后训练量化方法,支持块缩放数据格式。该方法不依赖反向传播或Hessian信息。我们阐述了如何通过将神经模型视为复合函数并扩散每一层的量化误差来改进量化过程。此外,我们介绍了TensorCast,这是一个基于PyTorch的开源库,用于模拟包括块缩放在内的多种数字格式,以辅助神经模型量化研究。我们通过对包括视觉模型和大语言模型(LLMs)在内的多种架构进行严格测试,证明了算法的有效性,并持续给出有竞争力的结果。实验证实,块缩放数据格式为后训练量化提供了稳健的选择,可有效用于增强先进神经网络的实际部署。

英文摘要:

Quantization reduces the model's hardware costs, such as data movement, storage, and operations like multiply and addition. It also affects the model's behavior by degrading the output quality. Therefore, there is a need for methods that preserve the model's behavior when quantizing model parameters. More exotic numerical encodings, such as block-scaled number formats, have shown advantages for utilizing a fixed bit budget to encode model parameters. This paper presents error diffusion (ED), a hyperparameter-free method for post-training quantization with support for block-scaled data formats. Our approach does not rely on backpropagation or Hessian information. We describe how to improve the quantization process by viewing the neural model as a composite function and diffusing the quantization error in every layer. In addition, we introduce TensorCast, an open-source library based on PyTorch to emulate a variety of number formats, including the block-scaled ones, to aid the research in neural model quantization. We demonstrate the efficacy of our algorithm through rigorous testing on various architectures, including vision and large language models (LLMs), where it consistently delivers competitive results. Our experiments confirm that block-scaled data formats provide a robust choice for post-training quantization and could be used effectively to enhance the practical deployment of advanced neural networks.

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

↑