Match each vector-compression scheme to its core mechanism.
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
PQ splits the vector and looks up per-subspace codebook entries. OPQ rotates first, then runs PQ. SQ bucket-rounds each dim to 8 or 4 bits. BQ keeps only the sign bit per dim and uses popcount(XOR) as distance.
Imagine you have a thousand-number recipe card and you need to fit a million of them in a single shoebox. **PQ** chops the card into chunks and replaces each chunk with a tiny sticker from a sticker book the library invented. **OPQ** is the same trick, but first the cards are shuffled into a friendlier order so the stickers fit even better. **SQ** keeps the same layout but rounds every number to the nearest of 256 (or 16) shades of gray. **BQ** is the most brutal: it only records whether each number was positive or negative, packing the whole card into a bracelet of beads where each bead is just one bit. You lose detail, but comparing two bracelets is almost free.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: PQ codebook mechanism + OPQ rotation fix + SQ uniform bucketing + BQ sign bit and popcount + how each composes with IVF or HNSW + 2026 vendor defaults.
| Scheme | Bytes/vec (1024-dim) | Training needed | Distance kernel | Recall hit |
|---|---|---|---|---|
| PQ (pq_m=16) | 16 | Yes (codebook per subspace) | Sum of 16 table lookups | Moderate |
| OPQ (pq_m=16) | 16 | Yes (rotation + codebook) | Rotate, then PQ lookup | Lower than PQ at same size |
| SQ-int8 | 1024 | No | int8 SIMD dot product | Tiny |
| BQ | 128 | No (assumes zero-centered) | popcount(XOR) | Largest of the four |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating SQ and PQ as the same family. SQ buckets each dimension independently; PQ groups dimensions into sub-spaces with a learned codebook per sub-space. Different objects, different recall behavior.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.