跳到主要内容Skip to main content

量化、蒸馏、剪枝的区别Quantisation vs Distillation vs Pruning

微型指南 · 约 8 分钟Guide · about 8 min · 引用核验 2026-11-03(仅引用链接与日期) · refs checked 2026-11-03 (reference links and dates only)

三条路线都在「让模型变小」,但动的对象不同:量化降精度、蒸馏换学生、剪枝删结构。All three routes make a model smaller, but they touch different things: quantisation lowers precision, distillation swaps in a student, pruning removes structure.

怎么做How to

量化:把权重从 FP16 降到 4/8 bit,模型结构不变;显存下降,质量取决于档位与校准数据。

蒸馏:用大模型(教师)的输出训练小模型(学生);换的是模型,不是精度。

剪枝:删掉部分权重、通道或层;需要再训练/微调,结构真的变小。

代价不同:量化最省事但可能掉质量;蒸馏要训练数据与算力;剪枝要重训且可能破坏能力。

组合顺序:先蒸馏得到小模型,再量化部署;剪枝后通常要微调,再量化。

验收:同任务集对比质量、显存、延迟与成本;不要只比体积。

Quantisation: lower weights from FP16 to 4/8 bit while keeping the architecture; VRAM drops, quality depends on the tier and calibration data.

Distillation: train a small student on a large teacher’s outputs; you change the model, not the precision.

Pruning: remove weights, channels or layers; it needs retraining/fine-tuning and the structure really shrinks.

Costs differ: quantisation is easiest but may lose quality; distillation needs data and compute; pruning needs retraining and may damage capability.

Order: distil to a smaller model, then quantise for deployment; after pruning, fine-tune, then quantise.

Acceptance: compare quality, VRAM, latency and cost on the same task set; do not compare size alone.

例子与判断Example and interpretation

以下是教学情境,不是本站运行或实测记录。A teaching scenario, not a measured or executed site test.

把同一模型权重换成低精度格式是量化;训练另一个学生模型是蒸馏;删除部分结构是剪枝。比较交付物和训练需求,不能因为文件都变小就认为三者可以互换。Lower-precision weights are quantization; training a student is distillation; removing structure is pruning. Compare artifacts and training needs rather than treating every smaller file as the same method.

出处Sources
  • GPTQ 论文(arXiv 2210.17323)GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers ↗
  • Hinton 等 · Distilling the Knowledge(arXiv 1503.02531)Hinton et al., Distilling the Knowledge in a Neural Network ↗
  • Deep Compression(arXiv 1510.00149)Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding ↗