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

了解并克服高效Transformer Quantization的挑战

Understanding and Overcoming the Challenges of Efficient Transformer Quantization

Qualcomm AI Research(高通人工智能研究(Qualcomm AI Research));Qualcomm Technologies, Inc.(高通公司(Qualcomm Technologies, Inc.))

Yelysei Bondarenko, Markus Nagel, Tijmen Blankevoort

摘要:

基于transformer的架构已经成为广泛的自然语言处理任务的事实标准模型。然而,它们的内存占用和高延迟对于在资源有限的设备上的高效部署和推理是禁止的。在这项工作中,我们探讨Transformers的量化。我们表明,Transformers具有独特的量化挑战-即,高动态激活范围,难以用低位定点格式表示。我们确定,这些激活在剩余连接中包含结构化的离群值,这些离群值鼓励特定的注意模式,例如注意特殊的分隔符标记。为了应对这些挑战,我们提出了三种基于训练后量化和量化感知训练的解决方案,每种解决方案都对准确性、模型大小和易用性做出了不同的妥协。特别是,我们引入了一种新的量化方案-每嵌入组量化。我们使用BERT在GLUE基准测试上证明了我们的方法的有效性,为训练后量化建立了最先进的结果。最后,我们表明,Transformer权重和嵌入可以量化到超低位宽,从而以最小的精度损失节省大量内存。我们的源代码可以在~ \url{https://github.com/qualcomm-ai-research/transformer-quantization}上找到。

英文摘要:

Transformer-based architectures have become the de-facto standard models for a wide range of Natural Language Processing tasks. However, their memory footprint and high latency are prohibitive for efficient deployment and inference on resource-limited devices. In this work, we explore quantization for transformers. We show that transformers have unique quantization challenges -- namely, high dynamic activation ranges that are difficult to represent with a low bit fixed-point format. We establish that these activations contain structured outliers in the residual connections that encourage specific attention patterns, such as attending to the special separator token. To combat these challenges, we present three solutions based on post-training quantization and quantization-aware training, each with a different set of compromises for accuracy, model size, and ease of use. In particular, we introduce a novel quantization scheme -- per-embedding-group quantization. We demonstrate the effectiveness of our methods on the GLUE benchmark using BERT, establishing state-of-the-art results for post-training quantization. Finally, we show that transformer weights and embeddings can be quantized to ultra-low bit-widths, leading to significant memory savings with a minimum accuracy loss. Our source code is available at~\url{https://github.com/qualcomm-ai-research/transformer-quantization}.

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

↑