Product quantization compresses a high-dimensional vector by splitting it into smaller subvectors, then quantizing each subvector separately with clustering. This reduces memory use and can accelerate nearest-neighbor search while preserving important information. section 10.3.6
Why it matters in semantic search:
- Integer-based indexing can use less memory and run substantially faster than floating-point computation. section 10.3.6
- Splitting long document vectors into separately quantized subvectors improves compression while retaining subtle signal needed by semantic, plagiarism, and LLM-detector searches. section 10.3.6
- Composite designs such as IVFPQ and HNSW plus PQ combine product quantization with approximate nearest-neighbor indexing. section 10.3.6
From quantized floats to product quantization
A simple NumPy experiment scales decimal values into integers and rescales them afterward. Product quantization applies the same broad idea to multiple subvectors, using clustering rather than one crude global conversion. section 10.3.6
Listing 10.14 Quantizing numpy floats
>>> import numpy as np >>> v = np.array([1.1, 2.22, 3.333, 4.4444, 5.55555]) >>> type(v[0]) numpy.float64 >>> (v * 1_000_000).astype(np.int32) array([1100000, 2220000, 3333000, 4444400, 5555550], dtype=int32) >>> v = (v * 1_000_000).astype(np.int32) #1 >>> v = (v + v) // 2 >>> v / 1_000_000 array([1.1 , 2.22 , 3.333 , 4.4444 , 5.55555]) #2
Inspect the integer conversion and rescaling steps behind the basic quantization intuition. section 10.3.6


