Quantisation: making models fit
Storing weights as 8-bit integers instead of 32-bit floats makes a model about four times smaller. Quantising the activations too lets integer-only NPUs run it.
Read firstMachine learning on a microcontroller
Key points
- Converting 32-bit floating-point weights to 8-bit integers cuts model size by about 4×. Quantising the activations too (full integer quantisation) lets the whole model run in fast integer arithmetic, usually with a small loss of accuracy.1
- Post-training quantisation converts an already-trained model; quantisation-aware training simulates low precision during training and usually recovers more accuracy.1
- Many embedded NPUs, including Arm's Ethos-U, only accelerate quantised integer models, so a float model has to be quantised first. Any operation the NPU cannot run falls back to the CPU.21
Where to go next
- On-device speech-to-text for VAHA: the model, where transcription happens, and a first accuracy test a whitepaper from our lab
- Wake-word and stop-phrase detection for VAHA: dataset, validation accuracy and first field check a whitepaper from our lab
Spotted a mistake, or found this useful?
Tell usSources
- LiteRT: Post-training quantization · Google · Project docs
- Vela: compiler for Arm Ethos-U NPUs (README and supported operators) · Arm · Project docs