Problem
Wildberries' recommendations team encodes product text into 1024-dimensional embeddings. They were used offline for "similar products". The promotion platform then asked for online re-ranking of ad banners by search query, because banners next to the results could be unrelated to the query. Banners live for a short time and their product sets change, cold products included, so their vectors must be refreshed quickly. At the required load, 1024 dimensions cost too much.
Example from the article: for the query "paint by numbers space", the old selection showed banners for kitchen appliances, a detergent and bed linen.
Solution in brief
Fine-tune multilingual E5 contrastively on a "similar products" dataset, then compress its embeddings. Classical reducers and an autoencoder kept at most 75% of the metrics, so the team tried something else. Matryoshka Representation Learning (MRL) trains the encoder so that the first 128 or 64 dimensions are themselves usable embeddings. At dimension 128 it kept 95–96% of the metrics, an 8x reduction.
Questions this case answers
- How to shrink high-dimensional item embeddings several times over for real-time ranking while keeping almost all of the ranking quality
- How to represent items without interaction history so they can be ranked against a user query
- How to compress text embeddings enough to re-rank ad banners online without losing ranking quality?
- How to compare dimensionality-reduction methods (PCA, SVD, autoencoder, Matryoshka) for production embeddings?
Tools and methods
- Multilingual-E5-large — base text encoder (24 layers, 1024 dimensions, context 512)
- InfoNCE loss with in-batch negatives — contrastive fine-tuning on similar products
- PCA, TruncatedSVD, UMAP, autoencoder — baseline reducers
- Matryoshka Representation Learning — nested embeddings from one model
- TensorRT, Triton, Faiss-GPU — fast inference and ANN search
Google or a one-time email code. No password.
