Problem
leboncoin is a French classifieds marketplace. Its search retrieved ads only by keyword matching (BM25 in Elasticsearch), so users missed relevant ads that used different words from the query. Queries with no lexical match returned few or no results. That hurts recall, the share of relevant ads that are retrieved. A reranker already sorted the results, but it can only reorder what retrieval brings back.
Example from the article: the query "wireless earphones" could not match an AirPods ad, and "wizard suit" could not match a Harry Potter disguise ad, although both pairs are close in meaning.
Solution in brief
Add a second retriever next to BM25. A pre-trained French encoder fine-tuned for passage retrieval turns queries and ad titles into vectors. PCA shrinks the vectors from 768 to 128 dimensions so they fit the catalogue. Elasticsearch runs both retrievers, and the merged candidates go to the existing reranker.
Questions this case answers
- How to retrieve relevant items for queries that have no lexical overlap with item text without replacing the existing keyword retriever
- How to serve dense-vector retrieval over a very large catalogue when full-size embeddings are too heavy to store and compare
- How to find relevant ads that share no words with the user's query
- How to add semantic retrieval next to BM25 inside an existing Elasticsearch stack
Tools and methods
- BM25 (Elasticsearch inverted index) — the lexical retriever, kept as is
- Search CamemBERT — the semantic retriever: CamemBERT fine-tuned on dense passage retrieval (DPR)
- PCA — projects 768-dimensional vectors to 128 dimensions
- Elasticsearch dense vectors with HNSW — stores vectors with each ad and runs approximate nearest-neighbor search
- Reranker — existing model that sorts the merged candidates
Google or a one-time email code. No password.