arXiv:2506.04985cs.LG2025-06被引 13

提出轻量函数保持变换,让大模型量化后仍保高性能。

FPTQuant: Function-Preserving Transforms for LLM Quantization

  • 设计三种可合并的变换,优化注意力中间激活分布。
  • 实现静态INT4量化,速度比全精度快3.9倍。
  • 无需额外算子,适合部署在资源受限设备上。

大型语言模型(LLMs)推理时需要大量计算与能耗。虽然量化权重和激活值能提升效率,但直接量化会因大数值异常值导致性能显著下降。本文提出FPTQuant,引入三种新颖、轻量且表达能力强的函数保持变换(FPTs):(1) 可合并的预RoPE查询/键变换,(2) 可合并的值变换,(3) 低成本动态逐令牌缩放变换。基于标准Transformer操作中的等变性与独立性,这些FPTs在保持模型功能的同时,使中间激活分布更利于量化。FPTQuant无需定制内核,推理开销几乎为零。FPTs通过局部训练减少异常值,并端到端训练使量化与全精度模型输出一致。该方法支持静态INT4量化,速度相较FP最高提升3.9倍。实验证明,其在准确率-速度权衡上表现优异,精度接近或超越多数现有方法,仅略低于一种慢29%的方法。

原文摘要 · Abstract (English)

Large language models (LLMs) require substantial compute, and thus energy, at inference time. While quantizing weights and activations is effective at improving efficiency, naive quantization of LLMs can significantly degrade performance due to large magnitude outliers. This paper describes FPTQuant, which introduces three novel, lightweight, and expressive function-preserving transforms (FPTs) to facilitate quantization of transformers: (1) a mergeable pre-RoPE transform for queries and keys, (2) a mergeable transform for values, and (3) a cheap, dynamic per-token scaling transform. By leveraging the equivariances and independencies inherent to canonical transformer operation, we designed these FPTs to maintain the model's function while shaping the intermediate activation distributions to be more quantization friendly. FPTQuant requires no custom kernels and adds virtually no overhead during inference. The FPTs are trained both locally to reduce outliers, and end-to-end such that the outputs of the quantized and full-precision models match. FPTQuant enables static INT4 quantization with minimal overhead and shows SOTA speed-up of up to 3.9X over FP. Empirically, FPTQuant has an excellent accuracy-speed trade-off -- it is performing on par or exceeding most prior work and only shows slightly lower accuracy compared to a method that is up to 29% slower.

量化大模型Transformer

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