arXiv:2503.01820cs.LGcs.AI2025-03被引 3

按重要性选关键令牌训练,让量化大模型更精准。

RSQ: Learning from Important Tokens Leads to Better Quantized LLMs

  • 用重要性加权令牌,动态调整训练重点。
  • 在多个模型上均超越基线,长文本任务表现更优。
  • 适合需要高效压缩的大模型部署场景。

层间量化是无需昂贵重训练即可高效压缩大模型的关键技术。现有方法通常对所有输出令牌统一优化层重建损失,但本文发现,优先学习重要令牌(如注意力得分高的)可获得更好的量化效果。基于此,提出RSQ(Rotate, Scale, then Quantize):首先通过正交变换消除异常值,再根据令牌重要性进行特征缩放,最后使用GPTQ框架结合缩放后令牌的二阶统计量进行量化。通过分析多种策略,采用注意力集中度(以每个令牌的注意力得分作为重要性指标)为最优方案。实验表明,RSQ在三个模型族(LLaMA3、Mistral、Qwen2.5)和多个下游任务中持续优于基线,尤其在长上下文任务中表现突出。该方法在不同模型规模、校准数据集、位精度及量化方式下均具泛化能力。

原文摘要 · Abstract (English)

Layer-wise quantization is a key technique for efficiently compressing large models without expensive retraining. Previous methods typically quantize the weights of each layer by "uniformly" optimizing the layer reconstruction loss across all output tokens. However, in this paper, we demonstrate that better-quantized models can be obtained by prioritizing learning from important tokens (e.g. which have large attention scores). Building on this finding, we propose RSQ (Rotate, Scale, then Quantize), which (1) applies rotations (orthogonal transformation) to the model to mitigate outliers (those with exceptionally large magnitude), (2) scales the token feature based on its importance, and (3) quantizes the model using the GPTQ framework with the second-order statistics computed by scaled tokens. To compute token importance, we explore both heuristic and dynamic strategies. Based on a thorough analysis of all approaches, we adopt attention concentration, which uses attention scores of each token as its importance, as the best approach. We demonstrate that RSQ consistently outperforms baseline methods across multiple downstream tasks and three model families: LLaMA3, Mistral, and Qwen2.5. Additionally, models quantized with RSQ achieve superior performance on long-context tasks, further highlighting its effectiveness. Lastly, RSQ demonstrates generalizability across various setups, including different model sizes, calibration datasets, bit precisions, and quantization methods.

模型量化注意力机制大模型压缩LLM

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。