Spot the conceptual error: 'We're using PQ instead of HNSW for our vector index because PQ is faster.'
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Click any words you think contain an error. Click again to unmark.
PQ is a compression scheme, not an index. Without IVF or HNSW on top, you still scan all N vectors per query (just with cheap distances). The correct framing is IVF-PQ vs HNSW, not PQ vs HNSW.
Saying 'we use PQ instead of HNSW' is like saying 'we use lightweight backpacks instead of a map and trail signs to find our way through the forest faster'. The backpack (PQ) makes each step lighter; the map and trail signs (HNSW or IVF) tell you which way to walk. You need both. **PQ is a compression scheme** that makes every comparison cheap; **HNSW is an index** that tells you which comparisons to even try. Mixing the two categories shows the speaker has not yet separated them in their head.
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.
3 min: spot the category error + name the two orthogonal axes (index vs encoding) + present the IVF-PQ / HNSW-PQ production patterns + offer the corrected sentence.
| Configuration | Index layer | Encoding layer | Billion-scale viable? |
|---|---|---|---|
| Pure float32 brute force | None (O(N) scan) | float32 | No (seconds per query) |
| Pure PQ scan | None (O(N) scan) | PQ | No (still O(N), even if each comparison is cheap) |
| Pure float32 HNSW | HNSW | float32 | Borderline (RAM is the bottleneck) |
| IVF-PQ | IVF | PQ | Yes (the canonical pattern) |
| HNSW-PQ | HNSW | PQ | Yes (higher recall, more memory than IVF-PQ) |
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 PQ and HNSW (or IVF) as alternatives. They are orthogonal: compression vs index structure. Production systems combine them as HNSW-PQ or IVF-PQ.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.