Truncate to the smallest d that meets your recall@10 floor on a labeled eval set, because storage and search compute both scale linearly with d.
Imagine you have a strict luggage weight limit and a list of clothes you'd like to bring. You don't pick what to leave out by guessing; you weigh each candidate set on the bathroom scale until you find the lightest combination that still covers what you actually need to wear. Picking a Matryoshka dimension under a storage and recall budget is the same. You weigh candidate dimensions on your own labeled eval set, see which ones still meet your recall requirement, and pick the lightest one that passes. Storage scales straight with dimension, so 'lightest' really does mean 'smallest dim'. Rules of thumb fail because every traveler has different luggage and different weather.
Detailed answer & concept explanation~6 min readEverything 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. 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.
Frame the choice as constrained optimization, walk through the four-step sweep, justify linear storage scaling, dissect why each distractor fails, and close on triggers for re-sweeping.
Real products, models, and research that use this idea.
- OpenAI text-embedding-3-large exposes the `dimensions` API parameter for exactly this trade and documents the cost-quality curve in its launch notes.
- Nomic Embed v1.5 ships truncation-quality curves down to 64 dims so users can pick d empirically; production case studies report 4x storage savings at 1-2 recall@10 points cost.
- Snowflake Arctic Embed L 2.0 production customers report optimal d values spanning 256-1024 depending on workload, reinforcing that the answer is corpus-specific.
- Voyage AI voyage-3-large supports Matryoshka-style dimension selection and has case studies showing 4-8x storage savings on enterprise document search.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you set the safety margin above the recall floor?
QIf you discover the elbow is at the full dim, what does that tell you about your workload?
QHow do Matryoshka truncation and scalar/binary quantization stack?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating the dimension choice as a model property rather than a deploy-time decision under YOUR constraints. The right d depends on your recall floor, your storage cap, and your corpus; only a sweep tells you.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.