Product re-matching with LLMs: from prompts to quantization

27 Jan 2026

Problem

A marketplace matches products across sellers to create cards quickly, monitor prices and group similar items. The image model that generates candidates gives a very high inner product to a "midi" and a "maxi" dress, to size S and size M, or to lenses that differ by one diopter. The text transformer model does not always catch these differences either. An LLM resolves them, but the catalog holds millions of products, so only pairs above a similarity threshold can go to it. Even then hundreds of thousands remain.

Example from the article: two coffee bags of the same design but different flavour labels ("Slivochnaya pomadka" and "Braziliya Ramos") look alike to the image model.

Solution in brief

Pairs with an image inner product above 0.9 go to a small open 8B text LLM, fine-tuned with LoRA on 4200 AI-labeled pairs. It reasons through per-category attribute rules and returns one of four verdicts. The matches then pass through a multimodal InternVL-8B that checks the images. GPTQ 8-bit quantization makes inference about 1.5 times faster.

Questions this case answers
  • How to verify hundreds of thousands of near-duplicate candidate pairs with an LLM on a single GPU when the first-stage similarity cannot separate items that differ in one attribute
  • How to build a training set of rule-based reasoning labels for a small LLM when expert annotators are too expensive to write the reasoning
  • How to decide whether two look-alike products are the same item when image similarity cannot tell sizes, quantities or flavours apart?
  • How to make a small open LLM apply per-category matching rules and explain its verdict?

Tools and methods

  • 8B text LLM with LoRA SFT — judges a pair by attribute rules.
  • GPTQ 8-bit, group size 32 — faster inference, higher F1 than unquantized.
  • vLLM, SGLang — inference engines compared on speed.
  • InternVL-8B, no fine-tuning — final image check of matches.
  • TRL, torchtune — training the adapters.
Continue reading — it's free

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