liveBook · Manning

Quantization

As explained in Natural Language Processing in Action, Second Edition

Quantization is the transformation of numerical values into lower-precision discrete representations, often to reduce memory use and accelerate computation.

Quantization transforms floating-point vector values into lower-precision discrete integers. Scaling and rounding can reduce memory use and let indexes compare integers faster than floating-point ranges. section 10.3.6

A NumPy experiment

Scale a float vector, cast it to an integer type, average integer values, and scale back. The example demonstrates how carefully chosen scaling can preserve values, while more aggressive quantization can introduce distortion or overflow-like artifacts.

For high-dimensional semantic search, product quantization splits a vector into smaller subvectors and quantizes each with clustering. IVFPQ in Faiss and HNSW plus product quantization support web-scale approximate nearest-neighbor indexing. section 10.3.6

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Defines scaling, rounding, integer storage, and product quantization, but stops short of detailed clustering or index implementation.
Examples
Demonstrates NumPy vectors, integer scaling, precision levels, and approximate-nearest-neighbor results on the New York Times dataset.
What it assumes
Assumes familiarity with vectors, floating-point values, indexing, and nearest-neighbor search.
What you can do after
Apply it via NumPy-style scaling and integer conversion, and recognize product-quantization patterns in semantic-search indexes.
How it connects
Connects vector search with product quantization, clustering algorithms, approximate nearest-neighbor search, Faiss, IVFPQ, and HNSW.

Also explained in

Compare how 13 books explain quantization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.