How does INT8 weight quantization work in practice?
mediumAnswer
- For each weight tensor W (fp16, shape [out, in]), compute a per-channel | / 127 and quantized weight as int8.
- At inference, compute @ → dequantize output with scale.
- Modern kernels (bitsandbytes, torch quant, TensorRT) fuse quantize + matmul + dequantize into a single INT8 tensor core op.
- Memory: 2× less; latency: 1.5-2× faster on GPUs with INT8 tensor cores.
- Accuracy loss: usually < 0.5% on quality benchmarks.
Check yourself — multiple choice
- Global scale only
- Per-channel scaling: as int8; fused kernels → 2× memory savings + 1.5-2× speedup + <0.5% quality loss
- Only for training
- Requires no scale
INT8 quant: per-channel scale + fused kernels → 2× memory, 1.5-2× speedup.
#quantization#inference
Practise LLMs & GenAI
214 interview questions in this topic.