liveBook · Manning

Quantization

As explained in Deep Learning with PyTorch, Second Edition

A model optimization technique that reduces numerical precision of parameters and operations to lower memory use and often speed up inference.

Quantization reduces a model’s memory and compute footprint by representing parameters and operations with lower-precision numbers. A typical choice replaces 32-bit floating-point values with 8-bit integers. This can make inference models smaller and more efficient. section 17.1.5

PyTorch provides quantized tensors such as torch.qint8 and torch.quint8. Quantization differs from distillation, which streamlines the model’s structure, and from reduced or mixed-precision training, which uses 16-bit floating point. section 17.1.5

How Deep Learning with PyTorch, Second Edition covers it

How deep it goes
Defines 8-bit conversion and demonstrates both PyTorch API usage and custom linear-layer implementation.
Examples
Uses serialized model-size measurement, custom int8 linear layers, and PyTorch dynamic quantization.
What it assumes
Assumes familiarity with PyTorch models, parameters, operations, and layer types such as torch.nn.Linear.
What you can do after
Apply it via PyTorch’s dynamic quantization API or a custom int8 implementation.
How it connects
Contrasts with distillation and mixed-precision training, and connects to quantized tensors and linear layers.

Also explained in

Compare how 13 books explain quantization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with PyTorch, Second Edition. The section links point to the parts of the book it draws on.