Database / Qdrant Vector DB Interview questions
What is the difference between scalar, binary, and product quantization?
All three techniques compress vectors to save memory and speed up distance computation, but they differ substantially in how aggressively they compress and what trade-off in accuracy that compression costs.
| Scalar | Binary | Product |
| float32 to int8 per dimension. | Each dimension to ~1-2 bits. | Sub-vectors mapped to codebook centroids. |
| ~4x compression. | Up to ~32x compression. | Up to ~64x compression. |
| Minimal accuracy loss. | More accuracy loss; works best on high-dimensional, centered data. | Most aggressive accuracy trade-off. |
| Good general-purpose default. | Best for extreme speed via SIMD popcount operations. | Best when minimizing memory is the top priority. |
Binary quantization's speed advantage comes specifically from enabling highly optimized CPU instructions like XOR and popcount for distance computation, which is dramatically cheaper than floating-point arithmetic; it's generally recommended for models with at least 1024 dimensions, since accuracy loss tends to be more pronounced on lower-dimensional embeddings.
Because all three methods keep the original, uncompressed vectors available alongside the quantized versions by default, a team can experiment with different quantization settings, or disable quantization entirely, without needing to re-ingest the underlying data.
More Related questions...