A composite index combines multiple indexing algorithms or stages into one retrieval pipeline. Common combinations include product quantization (PQ) before inverted-file indexing (IVF) or HNSW, reducing vector memory before search. section 10.3.6
The payoff is memory efficiency for high-dimensional vectors, especially when GPU or RAM capacity is limited. The cost is configuration sensitivity: latency, throughput, and resource use depend on how each stage is tuned, and a poor configuration can underperform simpler pipelines. section 10.3.6
IVFPQ and HNSW plus PQ
Faiss uses IVFPQ for high-dimensional vectors, while HNSW plus PQ has been adopted by frameworks such as Weaviate. These combinations target web-scale search, but simpler indexing may be preferable when the dataset fits comfortably in memory. 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 a small NumPy quantization experiment to see the representation-compression step that can precede another indexing algorithm. section 10.3.6


