针对大模型量化中各层敏感度差异,提出自适应分层量化方法
SliderQuant: Accurate Post-Training Quantization for LLMs
- 按层设计差异化量化策略,引入滑动窗口自适应调整
- 在低比特下显著降低量化误差,超越现有主流方法
- 适合对精度要求高的大模型部署场景
本文从被忽视的角度研究大语言模型的后训练量化(PTQ):给定预训练高精度模型,现有顺序量化框架对各层一视同仁,但在低比特设置下可能并非最优。我们实证分析不同层对量化的影响,发现:(1) 浅层和深层通常比中间层更敏感;(2) 其中最为敏感的是首层或末层,其量化误差显著高于其他层。这表明应针对不同层进行多层级量化设计。为此,我们提出新的PTQ框架SliderQuant,基于少量可学习参数实现简单自适应滑动量化。其核心为层间滑动量化,采用三种新型滑动窗口设计以应对浅、中、深各层不同的敏感性;另一核心为层内滑动量化,通过增量策略逐窗量化。实验显示,该方法在多种大模型(包括Llama/Llama2/Llama3/Qwen2.5、DeepSeek-R1及大型MoE模型)上,在语言生成、零样本常识推理、数学与代码任务等挑战性任务中,均优于现有方法,涵盖仅权重量化与权重-激活联合量化场景。
原文摘要 · Abstract (English)
In this paper, we address post-training quantization (PTQ) for large language models (LLMs) from an overlooked perspective: given a pre-trained high-precision LLM, the predominant sequential quantization framework treats different layers equally, but this may be not optimal in challenging bit-width settings. We empirically study the quantization impact of different layers on model accuracy, and observe that: (1) shallow/deep layers are usually more sensitive to quantization than intermediate layers; (2) among shallow/deep layers, the most sensitive one is the first/last layer, which exhibits significantly larger quantization error than others. These empirical observations imply that the quantization design for different layers of LLMs is required on multiple levels instead of a single level shared to all layers. Motivated by this, we propose a new PTQ framework termed Sliding-layer Quantization (SliderQuant) that relies on a simple adaptive sliding quantization concept facilitated by few learnable parameters. The base component of SliderQuant is called inter-layer sliding quantization, which incorporates three types of novel sliding window designs tailored for addressing the varying quantization sensitivity of shallow, intermediate and deep layers. The other component is called intra-layer sliding quantization that leverages an incremental strategy to quantize each window. As a result, SliderQuant has a strong ability to reduce quantization errors across layers. Extensive experiments on basic language generation, zero-shot commonsense reasoning and challenging math and code tasks with various LLMs, including Llama/Llama2/Llama3/Qwen2.5 model families, DeepSeek-R1 distilled models and large MoE models, show that our method outperforms existing PTQ methods (including the latest PTQ methods using rotation transformations) for both weight-only quantization and weight-activation quantization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。