Doubling the embedding dimension from 768 to 1536 — what changes in storage, query latency, and PQ trainability?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Doubling d doubles storage and per-vector distance work (both linear in d) and makes PQ codebooks cover larger sub-vectors; fix by raising pq_m.
Think of each item in your database like a postal address written on a strip of paper, where the length of the strip is the dimension. Imagine doubling how long every strip is. Now every strip uses twice the storage in the filing cabinet, and reading a strip to compare it to another takes twice as long. For chunked-codebook shrinking (called PQ, which stores each strip's chunks as numbers from a tiny catalogue), keeping the same number of chunks while doubling the strip length means each chunk now covers twice as many characters, and a longer chunk is harder to summarize well with a small catalogue. The standard fix is to slice the longer strip into more chunks, rather than into the same number of fatter chunks.
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.
5 min: linear scaling of storage and compute with d, SIMD as a constant factor, memory bandwidth as a separate bottleneck, PQ codebook trainability, and Matryoshka truncation as the production escape hatch.
| Axis | Scaling with d | Mitigation |
|---|---|---|
| Raw storage (float32) | Linear (4 × d × N) | Use float16, int8, PQ, or BQ |
| Distance compute per pair | Linear (O(d)) | SIMD reduces constant; slope is fixed |
| Memory bandwidth per pair | Linear (d × bytes loaded) | Compress vectors to reduce bytes/pair |
| PQ codebook quality at fixed pq_m | Degrades | Scale pq_m proportionally to d |
| Curse-of-dimensionality (recall) | Asymptotic, mild at d < 4096 | Use natural-language manifold-aware embeddings |
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.
Claiming SIMD makes higher-dimension queries free. SIMD helps the constant factor; the linear in d scaling of work and storage is unaffected.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.