One embedding. Many budgets.

Matryoshka Representation Learning puts broadly useful information near the beginning of an embedding. Shorten the prefix, normalize it, and the same vector can serve smaller indexes before you pay for every dimension.

Cut dimensions. Keep score.

The full-width ranking defines the reference neighbors. Every shorter prefix is scored from the visible teaching vectors, so overlap, storage, and compute move together.

Information order
4 / 16
Normalize prefix
Cosine score

Dimension map and recall curve

Cells beyond the cut remain stored only in the full reference. The lower chart recomputes top-four overlap at every even prefix width.

Nested order · cosine
Embedding dimension matrix and recall curve Query and candidate vectors with the active prefix highlighted, plus recall at each prefix width for nested and flat information order.
4 dimensions active. Twelve trailing coordinates are excluded from scoring.
Top-4 neighbor recall100%

Overlap with the normalized full-width top four.

Vector storage · one million7.6 MB

Raw vector payload before IDs or index structures.

Dot-product work25%

Multiply-add dimensions relative to the 16D reference.

Top result retainedYes

Whether the full-width nearest neighbor remains first.

Truncation is a training property.

Any vector can be shortened. The useful question is whether the model learned prefixes that remain meaningful under the task and metric you will deploy.

Nested objectives supervise several prefix widths.

Matryoshka training applies task losses at multiple dimensionalities. Early coordinates must support a coarse but useful representation while later coordinates add capacity.

loss = L(2D) + L(4D) + L(8D) + L(16D)

One artifact, several serving tiers.

Store or transmit only the prefix a device, reranker, or index can afford. The full embedding stays compatible with richer tiers.

Renormalize the cut.

Cosine retrieval depends on unit-length vectors. Truncating coordinates changes the norm, so normalize each prefix before cosine search.

Compression is not free accuracy.

Prefix quality varies by model, dataset, language, and task. Measure recall and downstream outcomes against a full-width reference.

Index overhead still exists.

The storage metric here isolates raw vectors. IDs, graph edges, inverted lists, metadata, alignment, and quantization scales add bytes.

1

Train several widths together.

The encoder emits one full vector. Losses applied to selected prefixes push general information toward early coordinates instead of letting usefulness land anywhere.

2

Choose a prefix at deployment.

A compact tier uses the first m coordinates; a richer tier uses more. No projection matrix or second encoder is required when the chosen dimensions were trained as valid prefixes.

3

Evaluate the actual retrieval path.

Normalize, index, query, and rerank exactly as production will. A compact prefix can save memory and arithmetic while still changing which evidence an agent receives.

Read the tradeoff from the workload.

The same prefix can be excellent for a coarse candidate pass and insufficient for the final decision. The role of the embedding matters.

Primary reading and implementation references.

The lab uses deterministic teaching vectors to expose the mechanism. These sources define the training idea, practical loss, evaluation context, and a production model that uses nested dimensions.

  • Evaluate each intended prefix on held-out production-like queries.

  • Normalize truncated vectors when the similarity metric expects it.

  • Include index structures and metadata in memory measurements.

  • Version model, width, precision, and normalization as one identity.