Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Vinted Engineering 12 min read Case study hardMaster

Dense Retrieval

Vinted added embedding-based dense retrieval to its multilingual, highly visual marketplace search using a two-tower model: a fine-tuned projection head on frozen multilingual CLIP for queries, and an item tower fusing CLIP image embeddings with categorical metadata, trained contrastively on 100M+ pairs. Everything runs inside Vespa with separate query and feed containers, HNSW indexes split per market bloc, tuned exact-vs-approximate thresholds, and a 350/150 ms approximate-then-exact retry that eliminated most timeouts. Because Vespa's targetHits is a per-node target rather than a limit, filters could increase result counts. A global-phase ranking trick using reciprocal rank fusion, a constant boolean field to detect interpretation matches, and rank-score-drop-limit caps how many nearest-neighbor-only matches are added. Switching the query containers to GraalVM with ZGC cut tail latencies by double-digit percentages.

Related posts

  • Image Similarity with Hugging Face Datasets and Transformers

    Hugging Face mediumAdept

    An image similarity system can be built by embedding images with a fine-tuned Vision Transformer (CLS token from the last hidden state) and ranking candidates by cosine similarity against a query embedding. The walkthrough uses 🤗 Transformers' AutoModel and 🤗 Datasets' batched map() to embed a 100-image subset of the Beans dataset, then retrieves top-k matches from the test split. For scale, brute-force search over 768-d embeddings becomes costly in memory and compute, so dimensionality reduction via random projection and locality-sensitive hashing, or a FAISS index through Datasets' add_faiss_index(), is recommended.

  • Efficient Visual Representation Learning And Evaluation

    Etsy Code as Craft hardMaster

    Etsy compares EfficientNetB0 and the EfficientFormer-l3 hybrid vision transformer as backbones for image embeddings that power visual search and visually similar recommendations, fine-tuned with a four-task multitask setup on two 16GB P100 GPUs. Embeddings are evaluated after each epoch with brute-force nearest-neighbor Recall@K callbacks on intra-item, review-photo and ad-click datasets, plus an experimental set where Stable Diffusion turns text search queries into image queries. EfficientNetB0 (~5M params, 1.7ms on iPhone 12) offers the best latency, while EfficientFormer-l3 (~30M params, 2.7ms) gives up to +17% Recall@5 and +0.65% CTR in A/B tests. The Stable Diffusion pipeline was sped up with token merging and fp16 to about 500 images per hour on one T4.

  • Evolving Pinterest’s Embedding Retrieval Platform

    Pinterest Engineering hardMaster

    Pinterest is evolving Manas, its in-house distributed search platform serving billions of embeddings across 80+ clusters, along three fronts: quantization, SSD-based ANN serving, and multi-embedding retrieval. Benchmarks on 100M embeddings showed PQ shrinks indices by 74–93% with 70–80% recall, while SQ cuts 59–75% with over 90% recall. Rolling both out per use case after A/B tests yielded 20–30% serving cost savings, and SIMD-based Linear Scaling SQ trimmed per-query compute by 10–15%. For SSD serving, SPANN with PQ-compressed posting lists and full-precision centroids beat DiskANN by 3x QPS at 1/3 the latency, and saved over 40% CPU versus HNSW on a 5B-embedding index with under 5% recall loss. Manas now also supports ColBERT-style late-interaction queries scored with Sum of MaxSim.

  • How Vinted Serves Personalised Search Autocomplete

    Vinted Engineering mediumAdept

    Vinted's autocomplete service runs on Vespa and serves 4,700 queries per second at 31 ms P99 over a pool of 125 million suggestions across 50+ country-language markets. More than 20% of search sessions now start from a suggestion, up from under 8%. Candidates come from product metadata combinations and search logs, scored twice a week by a heuristic built on Most Popular Completion. Switching from Vespa's native prefix queries to index-time edge-ngrams via Lucene Linguistics cut P99 matching latency from ~220 ms to ~25 ms, at the cost of more memory. A multiplexer token filter gives accent tolerance while preserving accent intent, a cascade of exact, edit-distance-1 and edit-distance-2 fuzzy tiers handles typos and supplies match-strength signal, and a LightGBM LambdaRank model with 63 features re-ranks results per keystroke for personalisation.

  • Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval

    Hugging Face mediumAdept

    Quantizing embeddings themselves, rather than model weights, sharply cuts retrieval memory, disk and cost. Binary quantization thresholds normalized float32 values at 0 to give 32x smaller vectors searched by Hamming distance, while scalar int8 quantization uses per-dimension min/max ranges from a calibration set to give 4x savings. On MTEB retrieval, mxbai-embed-large-v1 keeps about 96% of NDCG@10 with binary embeddings plus float32-query rescoring, and 97% with int8. A combined pipeline does a binary in-memory search, then rescores the top candidates with int8 embeddings loaded from disk, serving 41M Wikipedia texts with 5.2GB of memory instead of about 200GB. Sentence Transformers code and vector database support tables are included.

The quest for software engineering knowledge.

Look:
Layout: