量化配置
量化配置是量化对象、数值类型、数值映射与量化粒度的具体组合。W4A16、W8A8 只描述 Weight 与 Activation 的位宽,不能完整表示数值格式、Scale 粒度和模块覆盖范围。
本文先按量化对象归纳典型方案,再用 Qwen、DeepSeek 与 MiniMax Checkpoint 展示这些方案如何组合。AWQ、GPTQ、SmoothQuant 等描述的是如何生成量化参数,属于量化算法,不作为新的配置类型。
典型方案
| 方案 | 数值类型 | Weight 粒度 | Activation 粒度 | 常见精度 |
|---|---|---|---|---|
| Group-wise INT4 | INT4 | Per-Group,常见 Group Size 为 128 | 不量化 | W4A16 |
| Channel-Wise / PTPC | INT8 或 FP8 | Per-Channel | Dynamic Per-Token | W8A8 |
| Block-Wise FP8 | FP8 E4M3 | 常见 128×128 Block | Dynamic 1×128 Block | W8A8 |
| MXFP8 | FP8 E4M3 或 E5M2 + E8M0 Scale | 32-Element Block | 32-Element Block | W8A8 |
| NVFP4 | FP4 E2M1 + E4M3 Scale | 16-Element Block | 16-Element Block | 常见 W4A4 |
表中的粒度描述典型 Linear/GEMM 路径。一个完整 Checkpoint 还可以让 Embedding、LM Head、Router、Attention 或 KV Cache 使用不同精度。
Weight-Only
Weight-Only 只量化 Weight,Activation 在推理时仍使用 BF16 或 FP16。它主要减少模型大小和 Weight 读取带宽,不要求低精度 Activation Kernel。
Group-wise INT4(W4A16)
Group-wise INT4 将 Weight 沿归约维度分组,每组共享一组 Scale,可选 Zero-Point:
其中 W4A16 表示 4-bit Weight 与 16-bit Activation;INT4 是数值类型;Group-wise 是 Scale 粒度;AWQ 或 GPTQ 则是生成该 Checkpoint 的算法。这些名称位于不同维度。
Weight-Activation
Weight-Activation 同时量化 Weight 与 Activation。Activation 通常在运行时根据当前输入动态计算 Scale,因此相同的 W8A8 或 W4A4 仍可能采用完全不同的粒度和缩放格式。
Channel-Wise(W8A8 / PTPC)
常见 Channel-Wise W8A8 对 Weight 使用 Per-Channel Scale,对 Activation 使用 Dynamic Per-Token Scale:
Weight [N, K]: 每个输出 Channel 一个 Scale
Activation [M, K]: 每个 Token 一组 Scale这一组合也称为 PTPC(Per-Token-Per-Channel):PT 指 Activation 的 Per-Token,PC 指 Weight 的 Per-Channel。因此,本节的 “Channel-Wise” 是按 Weight 粒度命名,并不表示 Activation 也按 Channel 量化。
Block-Wise FP8(W8A8)
以 DeepSeek Fine-Grained FP8 为代表的方案使用 FP8 E4M3,并让 Weight 与 Activation 采用不同形状的 Block:
Weight 每个 128×128 Block 共享 Scale,Activation 则按 Token 动态地为每 128 个 Channel 计算 Scale。这是一种 W8A8 配置,但粒度比 PTPC 更细。
MXFP8(W8A8)
MXFP8 是 OCP Microscaling 规范中的格式。每 32 个连续元素组成一个一维 Block,共享一个 E8M0 Scale:
其中 FP8 元素可以使用 E4M3 或 E5M2,E8M0 Scale 只表示 2 的幂。MXFP8 定义的是元素格式与局部缩放方式,不绑定某个模型;在 Linear 层同时量化 Weight 与 Activation 时,通常表现为 W8A8。
NVFP4(常见 W4A4)
NVFP4 是 NVIDIA 的 FP4 Scaling Recipe。每个值使用 E2M1 表示,每 16 个元素共享一个 E4M3 局部 Scale,并额外使用 Tensor 级 FP32 Scale:
当 Weight 与 Activation 都按 NVFP4 量化时,它是 W4A4;如果只量化 Weight,也可以组成 W4A16。因此,NVFP4 与 W4A4 不是同义词:前者描述数值与缩放 Recipe,后者只描述 Weight 和 Activation 的位宽。
模型实例
模型名称不是量化类型。Qwen、DeepSeek 与 MiniMax 都可以发布多种量化 Checkpoint,每个 Checkpoint 只是前述配置维度的一种具体组合。
Qwen
| Checkpoint | 典型方案 | 配置拆解 |
|---|---|---|
Qwen/Qwen3-8B-AWQ | Group-wise INT4,W4A16 | AWQ、4-bit Weight、group_size=128、Asymmetric Zero-Point |
Qwen/Qwen3-235B-A22B-GPTQ-Int4 | Group-wise INT4,W4A16 | GPTQ、4-bit Weight、group_size=128、Symmetric Mapping |
Qwen/Qwen3-8B-FP8 | Block-Wise FP8,W8A8 | E4M3、Weight 128×128、Dynamic Activation 1×128 |
nvidia/Qwen3-30B-A3B-NVFP4 | NVFP4,W4A4 | E2M1、group_size=16、部分模块保持高精度;KV Cache 单独使用 FP8 |
同一个 Qwen3 模型家族可以同时出现 AWQ、GPTQ、FP8 和 NVFP4 版本。后缀描述的是 Checkpoint 配置或生成算法,不是模型架构。
DeepSeek
| Checkpoint | 典型方案 | 配置拆解 |
|---|---|---|
deepseek-ai/DeepSeek-V3 | Block-Wise FP8,W8A8 | E4M3、Weight 128×128、Dynamic Activation 1×128 |
deepseek-ai/DeepSeek-R1 | Block-Wise FP8,W8A8 | E4M3、Weight 128×128、Dynamic Activation 1×128 |
nvidia/DeepSeek-R1-0528-NVFP4 | NVFP4,W4A4 | E2M1、group_size=16、Attention 与 LM Head 保持高精度;KV Cache 单独使用 FP8 |
“DeepSeek FP8”通常指 DeepSeek 官方的 Fine-Grained FP8 配置;“DeepSeek-R1-NVFP4”则是 NVIDIA 为 DeepSeek 模型生成的另一种 Checkpoint。模型相同不代表量化方案相同。
MiniMax-M3-MXFP8
| Checkpoint | 典型方案 | 配置拆解 |
|---|---|---|
MiniMaxAI/MiniMax-M3-MXFP8 | MXFP8,W8A8 | Dynamic Activation、Weight 1×32;Embedding、LM Head、Vision Tower、Multimodal Projector 与 MoE Gate 等模块保持高精度 |
阅读任意量化 Checkpoint 时,先用 WxAy 确认量化对象与位宽,再检查元素类型、group_size / weight_block_size、Activation Scheme 和排除模块。模型名与厂商名只说明来源,不能替代这些配置字段。
参考
- Qwen3-8B-AWQ:
config.json - Qwen3-235B-A22B-GPTQ-Int4:
config.json - Qwen3-8B-FP8:
config.json - DeepSeek-V3:FP8 Weight Documentation
- vLLM:Per-Token-Per-Channel Dynamic Quantization FP8
- OCP Microscaling Formats Specification
- NVIDIA Transformer Engine:MXFP8
- NVIDIA Transformer Engine:NVFP4
- NVIDIA Qwen3-30B-A3B-NVFP4:
hf_quant_config.json - NVIDIA DeepSeek-R1-0528-NVFP4:
hf_quant_config.json - MiniMax-M3-MXFP8:
config.json - DeepSeek-R1:
config.json - NVIDIA Qwen3-30B-A3B-NVFP4:Model Card
- NVIDIA DeepSeek-R1-0528-NVFP4:Model Card