Semantic Product Matching

Mundher Al-Shabi30 Jan 2024

Problem

A delivery company wants to know which of its products competitors also sell. The answer informs pricing and shows gaps in the assortment. The same matcher can find duplicates inside the company's own range. Titles for one product differ in units, spelling and missing words, so exact word matching misses pairs.

Example from the article: "Pepsi 1000ml" vs "Pepsi 1L", "Coca-Cola 250ml" vs "CocaCola 250ml", and "Marigold HL Chocolate Flavoured Milk 200 ml" vs "Marigold HL Chocolate Milk 200ml".

Solution in brief

Retrieve a short list of candidate titles with cheap lexical matching, then rescore each candidate pair with a transformer cross-encoder. Train the cross-encoder on hard negatives: non-matching pairs that a fine-tuned embedding model finds very similar.

Questions this case answers
  • How to link records of the same real-world item across two large text collections when exact word overlap fails and a heavy pairwise model is too slow to run on every pair
  • How to train a pairwise matcher to reject look-alike non-matches when random negatives are too easy
  • How to find the competitor products that match each product in our catalog when only titles are available?
  • How to find duplicate items inside our own assortment?

Tools and methods

  • Lexical matching (word overlap, BM25) — fast first-stage retrieval over an inverted index
  • SBERT bi-encoder — separate title embeddings, used to mine hard negatives
  • Cross-encoder — reads both titles together and scores the pair in the second stage
  • Hard negative sampling — training pairs that look alike but do not match
Continue reading — it's free

Google or a one-time email code. No password.