跳到主要内容Skip to main content

量化感知训练Quantization-Aware Training

Quantization-Aware Training

  • 硬件与部署Hardware & deployment
  • 第五段 · 跑起来Stage 5 · Running It
  • 引用核验 2026-11-19refs checked 2026-11-19
解决什么问题What problem it solves

在训练时就模拟低精度误差,让模型量化后掉点更少。Simulate low-precision error during training so the quantised model loses less accuracy.

这是什么What it is

前向用 fake-quant 模拟 INT4 或 INT8 的取整与截断,反向仍用高精度梯度更新。

与训练后量化(PTQ)的区别:PTQ 不动权重,QAT 让模型提前适应量化误差。

代价是训练成本与调参复杂度;收益是低比特下更好的精度保持。

不是所有模型都值得做 QAT:基座已开源、量化工具成熟时,先跑 PTQ 对比更划算。

The forward pass uses fake-quant to simulate INT4 or INT8 rounding and clipping, while the backward pass still updates with high-precision gradients.

Unlike post-training quantisation, which leaves weights untouched, QAT lets the model adapt to quantisation error in advance.

The cost is training compute and tuning complexity; the benefit is better accuracy at low bit-width.

Not every model is worth QAT: when a base is open and quantisation tools are mature, running PTQ first is often cheaper.

为什么需要知道Why it matters

本地部署越来越依赖 4bit;QAT 与 PTQ 的差别直接决定「量化后还能不能用」。Local deployment increasingly relies on 4-bit; the gap between QAT and PTQ decides whether a quantised model is still usable.

别名Chinese aliases

QAT

出处Sources
  • TensorFlow Model Optimization · QAT 指南TensorFlow Model Optimization · QAT guide ↗
  • PyTorch · Quantization 文档PyTorch · Quantization docs ↗
  • 学 AI · 量化方法Learn AI · Quantization methods ↗