What it does
Quantization maps floating-point values onto a small integer grid: divide by a scale, round, add a zero point, and clamp to the integer range. Dequantization does the reverse. Storing weights as int8 shrinks a model to roughly a quarter of its float32 size and lets integer kernels run faster, at the cost of a small rounding error. Dynamic quantization computes the activation scale on the fly for each input. In an exported graph it shows up as QuantizeLinear and DequantizeLinear pairs, or as integer operators such as MatMulInteger and ConvInteger with their scales nearby.
Formula
q = clamp(round(x / s) + z, qmin, qmax)x̂ = s · (q − z)Shapes and parameters
- Shapes
- Any shape in, the same shape out; the scale and zero point are scalars or one value per channel.
- Parameters
- None learned, but every quantized tensor carries its scale and zero point (one per tensor, or one per output channel).
- Used for
- The int8 BERT models in the catalog (Chinese fill-mask, zero-shot labels), punctuation restoration, CRNN text recognition, and most models shipped to phones.
In WeightSpace
Read-only in WeightSpace today. When an editable bias is stored as a quantized integer, WeightSpace converts your offset with the stored scale so edits are still entered in logit units.
Where it appears
- Read a phrase aloudKokoro 82M13981M params
- Segment an object by clickingSlimSAM939.7M params
- Estimate depth from a photoDepth Anything V2 Small7925M params
- Cut out a portraitMODNet696.5M params
- Translate a Chinese sentenceHelsinki-NLP OPUS-MT62111M params
- Transcribe a short English recordingWav2Vec2 Base 960h5894M params
- Find a caption that fits a photoTinyCLIP ViT-8M/165523M params
- Fill a gap in ChineseBERT Base Chinese49102M params
- Find the most relevant answerall-MiniLM-L6-v24823M params
- Classify text with your labelsXtremeDistil zero-shot2613M params
- Find an answer in a passageDistilBERT SQuAD2665M params
- Read text in an imageCRNN English148.4M params
- Restore punctuation in a transcriptEdge-Punct-Casing57.4M params