Skip to main content
QUICK REVIEW

[论文解读] SqueezeLLM: Dense-and-Sparse Quantization

Sehoon Kim, Coleman Hooper|arXiv (Cornell University)|Jun 13, 2023
Topic Modeling被引用 23
一句话总结

SqueezeLLM 引入基于敏感性的非均匀量化以及 Dense-and-Sparse 分解,以在尽量低的位宽(最低可至 3-bit)的后训练量化下对大型语言模型(LLMs)实现最小性能损失和显著的加速,同时解决单批生成推理中的内存带宽瓶颈。

ABSTRACT

Generative Large Language Models (LLMs) have demonstrated remarkable results for a wide range of tasks. However, deploying these models for inference has been a significant challenge due to their unprecedented resource requirements. This has forced existing deployment frameworks to use multi-GPU inference pipelines, which are often complex and costly, or to use smaller and less performant models. In this work, we demonstrate that the main bottleneck for generative inference with LLMs is memory bandwidth, rather than compute, specifically for single batch inference. While quantization has emerged as a promising solution by representing weights with reduced precision, previous efforts have often resulted in notable performance degradation. To address this, we introduce SqueezeLLM, a post-training quantization framework that not only enables lossless compression to ultra-low precisions of up to 3-bit, but also achieves higher quantization performance under the same memory constraint. Our framework incorporates two novel ideas: (i) sensitivity-based non-uniform quantization, which searches for the optimal bit precision assignment based on second-order information; and (ii) the Dense-and-Sparse decomposition that stores outliers and sensitive weight values in an efficient sparse format. When applied to the LLaMA models, our 3-bit quantization significantly reduces the perplexity gap from the FP16 baseline by up to 2.1x as compared to the state-of-the-art methods with the same memory requirement. Furthermore, when deployed on an A6000 GPU, our quantized models achieve up to 2.3x speedup compared to the baseline. Our code is available at https://github.com/SqueezeAILab/SqueezeLLM.

研究动机与目标

  • 识别内存带宽作为单批 LLM 推理的主要瓶颈,并量化其对量化策略的影响。
  • 开发一种后训练量化框架,在几乎不损失生成质量的前提下实现极低位宽。
  • 提出一种基于敏感性的非均匀量化方法,在敏感权重值周围分配量化箱。
  • 引入 Dense-and-Sparse 分解,分别存储离群值和敏感权重,以实现高效的稀疏表示。
  • 在多个基于 LLaMA 的模型和基准测试中,展示困惑度、模型大小和延迟方面的性能提升。

提出的方法

  • 基于敏感性的非均匀量化,使用受二阶(Fisher 信息)引导的加权 k-means 目标,在接近敏感权重的地方放置量化质心。
  • 通过对角 Fisher 信息矩阵近似 Hessian,以在量化目标中对权重扰动进行加权。
  • Dense-and-Sparse 分解 W = D + S,将密集权重与离群值分离,将 S 以稀疏格式存储,并对 D 进行范围受限的量化。
  • 在 C4、WikiText2、MMLU、以及 Vicuna 基准测试上,对 LLaMA、LLaMA-2、OPT、Vicuna 模型进行评估;并与 RTN、GPTQ、AWQ、SpQR 进行比较。
  • 面向 GPU 的 Dense-and-Sparse 内核,使用基于查找表的 3/4-bit 量化和 FP16 算术;使用 CSR 的稀疏乘法以利用离群值。

实验结果

研究问题

  • RQ1在不损害生成任务端到端性能的前提下,LLM 权重可以量化到多低的比特宽度(例如 3-bit)?
  • RQ2将量化质心放置在通过 Fisher 信息强烈影响最终损失的权重值附近,是否能相较于均匀或天真的非均匀方法提高端到端量化性能?
  • RQ3Dense-and-Sparse 分解是否能有效隔离离群值和高度敏感的权重,从而实现更小的模型和更快的推理?
  • RQ4在实际硬件(如 A6000)上,与现有 PTQ 方法相比,SqueezeLLM 的实际延迟和内存带宽收益有哪些?
  • RQ5所提出的方法是否能推广到指令跟随和领域知识基准(如 MMLU、Vicuna)以及更大规模的模型族?

主要发现

  • 3-bit SqueezeLLM 将相对于 FP16 基线的困惑度差距缩小最多 2.1x,与最先进方法相比,在 LLaMA-7B 上达到同等内存预算的性能。
  • Dense-and-Sparse 分解将约 0.45% 的权重移除为稀疏/离群值,带来额外的困惑度改善(例如,在 C4 上 LLaMA-7B 的从 7.75 降至 7.58)。
  • 在 A6000 GPU 上,SqueezeLLM 对于生成的 token 最高实现 2.4x 的延迟加速,内存使用相比分组 GPTQ/AWQ 设置具有竞争力或更好。
  • 在零-shot MMLU 的指令跟随模型(Vicuna)中,3-bit SqueezeLLM 优于 AWQ,并在 4-bit 量化下保持 FP16 的准确性;5-shot 结果与改进的鲁棒性一致。
  • 在 LLaMA 及更大模型(13B、30B、65B)中,SqueezeLLM 在相同模型规模和位宽下的困惑度始终优于 GPTQ 和 AWQ。
  • 仅密集(0% 稀疏度)的 SqueezeLLM 在 4-bit 时已接近 FP16 的性能,在 3-bit 时显示出显著提升,凸显权重量化对内存受限推理的收益。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。