arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.06082cs.LGcs.CL
收藏

FrameQuant:面向 Transformer 的灵活低位量化

FrameQuant: Flexible Low-Bit Quantization for Transformers

University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Google Research(谷歌研究院)

Harshavardhan Adepu, Zhanpeng Zeng, Li Zhang, Vikas Singh

AI总结:

本文提出 FrameQuant 方案,利用调和分析中的 Fusion Frames 表示将 Transformer 模型量化到仅两位,在保持较小精度损失的同时显著提升计算、内存和延迟效率。

摘要:

Transformer 是众多视觉和自然语言处理任务中强大基础模型的骨干。但其计算和内存/存储开销很大,因此部署此类模型成本高昂,通常需要高端硬件。为缓解这一困难,训练后量化(Post-Training Quantization)旨在修改预训练模型并将其量化到八位或更低,从而显著提升计算/内存/延迟效率。此类模型已成功量化到四位,但会有一定性能损失。在这项工作中,我们提出一种简单方案,将基于 Transformer 的模型量化到仅两位(外加一些开销),同时仅造成很小的精度下降。我们方法的关键是借鉴自调和分析的一个概念,称为 Fusion Frames。我们的主要发现是:量化不应在原始权重空间中进行,而应在 Fusion Frame 表示中进行。如果将量化解释为添加噪声,那么我们对问题的这种表述允许援引大量已知的一致恢复和噪声鲁棒性保证。此外,如果需要,去噪滤波器具有已知的闭式解。我们通过各种实验实证表明,Transformer 模型的(几乎)两位量化有望带来可观的效率提升。代码可在 https://github.com/vsingh-group/FrameQuant 获取。

英文摘要:

Transformers are the backbone of powerful foundation models for many Vision and Natural Language Processing tasks. But their compute and memory/storage footprint is large, and so, serving such models is expensive often requiring high-end hardware. To mitigate this difficulty, Post-Training Quantization seeks to modify a pre-trained model and quantize it to eight bits or lower, significantly boosting compute/memory/latency efficiency. Such models have been successfully quantized to four bits with some performance loss. In this work, we outline a simple scheme to quantize Transformer-based models to just two bits (plus some overhead) with only a small drop in accuracy. Key to our formulation is a concept borrowed from Harmonic analysis called Fusion Frames. Our main finding is that the quantization must take place not in the original weight space, but instead in the Fusion Frame representations. If quantization is interpreted as the addition of noise, our casting of the problem allows invoking an extensive body of known consistent recovery and noise robustness guarantees. Further, if desired, de-noising filters are known in closed form. We show empirically, via a variety of experiments, that (almost) two-bit quantization for Transformer models promises sizable efficiency gains. The code is available at https://github.com/vsingh-group/FrameQuant

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

↑