Technology method · wiki:deep

Matryoshka embeddings

Embeddings trained so meaning is packed coarse→fine along the vector: the default length (OpenAI 1536 / 3072, mxbai 1024) is the full doll; shorter prefixes remain searchable. OpenAI text-embedding-3-small and text-embedding-3-large expose a dimensions parameter so the API can emit 1024 (or other m) without a second model.

Matryoshka embeddings flow

Matryoshka embeddings are the product name for vectors trained with (or equivalent to) Matryoshka Representation Learning: information is ordered so the leading dimensions carry a usable representation and later dimensions refine it. That is why “how long is the embedding?” becomes a runtime cost knob, not only a training-time constant.

What practitioners actually mean by the numbers

Model Default / native length Shorten how? Can you get 1024?
OpenAI text-embedding-3-small 1536 API dimensions Yes — request dimensions=1024 (or other m)
OpenAI text-embedding-3-large 3072 API dimensions Yes — request dimensions=1024 (or e.g. 256)
OpenAI text-embedding-ada-002 1536 none (fixed) No Matryoshka dimensions
mixedbread mxbai-embed-large-v1 1024 dimensions / Sentence-Transformers truncate_dim 1024 is native; shorter e.g. 512

So: 1536 is the default for 3-small (and the fixed size for ada-002). 1024 is not “only an mxbai thing” — OpenAI 3-small and 3-large both support Matryoshka-style truncation via dimensions, which is exactly how OpenAI can emit a 1024-float vector from those models. mxbai-large’s story is the mirror image: native 1024, then truncate downward.

Exact mechanism (truncation)

See Matryoshka truncation: keep the prefix z[:m], or ask the vendor to return length m. Prefer the API parameter at create time. If you slice a full vector yourself, re-normalize (OpenAI documents this). Arbitrary m may be allowed by the API; quality is best at trained cutoffs (reported examples for OpenAI include 256 / 512 / 1024-class sizes on MTEB comparisons — treat undocumented nesting sets as unverified).

What it is not

  • Not Embedding quantization (int8/binary changes bits, not length — mxbai offers both).
  • Not PCA on a non-MRL vector (post-hoc shrink without nested training).
  • Not a vector database — stores under Vector DBs consume the chosen m.

Where it sits in this catalog

Parent method cluster under infrastructure retrieval: pair with Vector DBs and RAG. Children spell training (MRL training), operations (Adaptive / funnel retrieval), and siblings (ANN indexes, Embedding quantization). Related packs (FAISS, Qdrant, Milvus, pgvector, Weaviate) index whatever dimension you write.

See also

In this taxonomy

_catalog/taxonomy/tech-matryoshka-embeddings.md