Vector DBs & RAG (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is Product Quantization (PQ) and Scalar Quantization (SQ8)?
senior LevelSystem Design
In Simple Words: Quantization compresses high-dimensional floating-point vectors to drastically reduce RAM usage:
- Scalar Quantization (SQ8): Maps each 32-bit float (4 bytes) to an 8-bit integer (1 byte), cutting RAM consumption by 75% with <1% loss in accuracy.
- Product Quantization (PQ): Deconstructs an N-dimensional vector into M smaller sub-vectors, clusters each sub-space, and replaces vectors with compact byte-sized centroid IDs. Can achieve 95% memory reduction (e.g. 1536 floats compressed to 64 bytes).