Problem
Walmart.com searches a catalog of millions of products. Candidate retrieval, the step before re-ranking, is hard because product titles are short and rarely duplicated. A keyword inverted index fails on synonyms, misspellings and long queries with a specific intent, so rare tail queries suffer most. A neural retriever helps, but it must not slow the engine or bloat the index.
Example from the article: a query such as "red shoes" has hundreds of relevant products. Editors cannot judge them all, so an unlabeled product is not necessarily irrelevant.
Solution in brief
Walmart runs a two-tower BERT retriever next to the existing inverted index and merges both candidate sets before a GBDT re-ranker. Tail queries go to the neural side. Training uses graded purchase and click labels and iteratively mined hard negatives. A 256-dimensional embedding, a cached ANN lookup and a GPU-served query encoder keep storage and latency in check.
Questions this case answers
- How to add dense retrieval next to a lexical index so that rare, specific queries get relevant candidates without hurting latency or storage cost
- How to train and measure a retrieval model when relevance labels are incomplete and many unlabeled items are in fact relevant
- How to retrieve relevant products for long-tail queries that a keyword inverted index misses?
- How to train a two-tower retrieval model when each query has many relevant products and only a few are labeled?
Tools and methods
- Inverted index — kept for rare tokens, model numbers, facets and filters
- Two-tower DistilBERT with a sampled softmax loss — query and product embeddings, cosine score
- Hard negative mining — teaches the model to separate close non-matches
- ANN index — fast nearest-product lookup
- GBDT re-ranker with cosine similarity as a feature — ranks the merged recall set
- ONNX export, served from Java on GPUs — cuts query-encoder latency
- Interleaving and human relevance ratings — online checks
Google or a one-time email code. No password.