---
title: "Dense Retrieval"
description: "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."
url: "https://swe.quest/articles/dense-retrieval-26c4c0ae9e7ea3b7"
canonical: "https://vinted.engineering//2025/11/18/dense-retrieval/"
source: "Vinted Engineering"
published: "2025-11-18"
difficulty: "hard"
kind: "Case study"
reading_minutes: 12
tags: ["vector-search","search","machine-learning","performance","ecommerce"]
---

# Dense Retrieval

A post on [Vinted Engineering](https://swe.quest/sources/vinted.md), published 2025-11-18, 12 min read, Case study. Original: [https://vinted.engineering//2025/11/18/dense-retrieval/](https://vinted.engineering//2025/11/18/dense-retrieval/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [E-commerce](https://swe.quest/tags/ecommerce.md) (Domains)

## Prerequisites

- vector embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- HNSW / ANN search ([easy posts on Vector search](https://swe.quest/tags/vector-search.md?difficulty=easy))
- Vespa ranking profiles ([easy posts on Recommendations & ranking](https://swe.quest/tags/recommendation-systems.md?difficulty=easy))
- contrastive learning

## Keywords

Vespa, CLIP, HNSW, two-tower model, ONNX, reciprocal rank fusion, GraalVM, ZGC

## Related posts

- [Image Similarity with Hugging Face Datasets and Transformers](https://swe.quest/articles/image-similarity-with-hugging-face-datasets-and-transformers-cfa579cfca74f44c.md): Hugging Face · 2023-01-16 · Medium · 7 min read · Computer vision, Vector search, Search, Python
  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.
- [Efficient Visual Representation Learning And Evaluation](https://swe.quest/articles/efficient-visual-representation-learning-and-evaluation-5d9ca073957d3278.md): Etsy Code as Craft · 2024-06-07 · Hard · 10 min read · Computer vision, Recommendations & ranking, Model training, Evaluation, E-commerce
  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.
- [Evolving Pinterest’s Embedding Retrieval Platform](https://swe.quest/articles/evolving-pinterest-s-embedding-retrieval-platform-c93c0b5fa7cc0d54.md): Pinterest Engineering · 2026-09-11 · Hard · 7 min read · Vector search, Search, Cost optimization, Recommendations & ranking, Performance engineering
  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.
- [How Vinted Serves Personalised Search Autocomplete](https://swe.quest/articles/how-vinted-serves-personalised-search-autocomplete-60df7b0a636c3d2b.md): Vinted Engineering · 2026-04-22 · Medium · 22 min read · Search, Recommendations & ranking, Performance engineering, System design
  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.
- [Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval](https://swe.quest/articles/binary-and-scalar-embedding-quantization-for-significantly-faster-cheaper-01e481f2c952922f.md): Hugging Face · 2024-03-22 · Medium · 16 min read · Vector search, RAG & retrieval, Cost optimization, Python
  Quantizing embeddings themselves, rather than model weights, sharply cuts retrieval memory, disk and cost.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
