Instructions to use balticml/multilingual-minilm-shop-search with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use balticml/multilingual-minilm-shop-search with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'balticml/multilingual-minilm-shop-search');
multilingual-minilm-shop-search
Turns a shopper's query and a product name into vectors whose dot product says how well they
match, in English, Polish, German, French and Spanish. paraphrase-multilingual-MiniLM-L12-v2
fine-tuned on one shop's catalogue (3,529 products of a UK gift wholesaler), exported as ONNX
with mean pooling and normalisation inside the graph: the output sentence_embedding is a unit
vector of 384 values. Weight-only int8, 46.7 MB, and a tokenizer pruned to 63,536 pieces of the
Latin, Greek and Cyrillic scripts (2.5 MB). No prefixes: queries and names go in as they are.
It runs the search on balticml.eu/demos/semantic-search and the "Ask about Baltic ML" box there (a right passage among the three shown for 25 of 32 held-out questions). Code, data and benchmark: github.com/balticml/semantic-search.
Results
80 hand-judged everyday queries ("gift for someone who loves baking", "piggy bank"), each in five languages; hit@10 is the share of queries with at least one relevant product in the first ten.
| en | pl | de | fr | es | |
|---|---|---|---|---|---|
| this model, int8 export as the browser runs it | 97.5 | 90.0 | 83.8 | 88.8 | 86.2 |
| paraphrase-multilingual-MiniLM-L12-v2 as published (PyTorch) | 88.8 | 76.2 | 72.5 | 76.2 | 71.2 |
| keyword search (BM25 on product names) | 81.2 | 7.5 | 3.8 | 21.2 | 10.0 |
The test queries and their judgements come from the person who wrote the prompt for the training queries, so these are upper bounds. Precision, the other candidates and per-kind tables are in the repo's README.
Training data
No search logs. A local LLM (gpt-oss-20b) wrote seven queries for every product of the catalogue, from its name: the product in other words, what it is for, an occasion it suits, and one each in Polish, German, French and Spanish (24,280 kept; a query that copied the name was dropped). It also wrote 699 questions about the 88 passages of balticml.eu, which the model learns with the shop (four times over), so the same model answers questions about the site. Contrastive training with in-batch negatives; the run and the epoch (4 of 12) were chosen on the queries of a tenth of the names and passages, held out. Catalogue: UCI Online Retail II, CC BY 4.0.
Limits
Tuned to one catalogue of short English product names; for another shop it is a starting point, not a finished model. Five languages measured. Vocabulary outside the Latin, Greek and Cyrillic scripts was removed and falls back to unknown tokens.
- Downloads last month
- 83