Back to LLMs Mind Map
中文·English
LLMsID: ptq-qat

Quantization PTQ/QAT

量化 PTQ/QAT
🎯Core Definition
Quantization maps FP16 weights WW to low-bit integers xq=round(x/s)+zx_q = \text{round}(x/s) + z with scale s=(xmaxxmin)/(2b1)s = (x_{\max}-x_{\min})/(2^b-1) and zero-point zz aligned to the b-bit range. PTQ (Post-Training Quantization) calibrates an already-trained model with a small calibration set, no retraining needed; QAT (Quantization-Aware Training) simulates quantization error during training via STE (straight-through estimator: quantized forward, approximate straight-through backward), making the model adapt to quantization.
💡Use Cases
PTQ dominates LLM inference deployment (GPTQ, AWQ, etc.) since large models cannot afford retraining — calibration takes minutes; QAT fits extreme low-bit (INT4/INT3 or lower) and accuracy-critical vertical scenarios, or joint quantization during fine-tuning.
Key Problems Solved
naive uniform quantization collapses due to activation outliers and distribution mismatch; PTQ uses calibration and error compensation to contain the loss, while QAT trains weights to match the quantizer — a speed-vs-accuracy trade-off: PTQ is fast but lower ceiling, QAT is slow but higher ceiling.
🎯5 High-Frequency Exam Points
1
Differences between PTQ and QAT, and when to use each?
2
Role of the calibration set in PTQ; how its size/distribution affect accuracy?
3
What is the straight-through estimator (STE) in QAT and why is it needed?
4
Why does PTQ dominate for LLMs, and when is QAT required?
5
How is quantization error measured, and what are common error sources?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Quantization PTQ/QAT"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardAlignment Tax & Preference DataNext CardLow-Bit INT8/INT4

🔗 More LLMs Knowledge Cards

Agent & Tool CallingScaled Dot-Product AttentionAttention Variants MHA/MQA/GQABenchmarks MMLU/GSM8K