reranker (text-classification) · text · WASM · ~470 MB · Apache-2.0
The multilingual sibling of the classic English MS MARCO MiniLM reranker. Where that one is an English BERT trained on the English MS MARCO passage-ranking data, mmarco-mMiniLMv2-L12-H384-v1 is a 12-layer XLM-RoBERTa MiniLMv2 (distilled from XLM-R Large) trained on mMARCO — MS MARCO machine-translated into 13 more languages. Instead of turning a query and a passage into separate vectors and comparing them, it reads both together and outputs one relevance score, so it ranks a Spanish, Japanese or Russian passage against an English query as easily as an English one — and it's Apache-2.0, so you can actually ship it. Give it a query and candidates and watch it re-sort them; then look inside at the raw logit per pair. Nothing leaves your device.
| Model | cross-encoder/mmarco-mMiniLMv2-L12-H384-v1 (official ONNX) |
|---|---|
| Task / pipeline | text-classification used as a cross-encoder reranker (num_labels = 1) |
| Input | a (query, passage) pair encoded together → one relevance logit |
| Architecture | XLM-RoBERTa MiniLMv2 cross-encoder (12-layer, hidden 384), distilled from XLM-R Large, fine-tuned for ranking on mMARCO |
| Languages | 14 — en, ar, zh, nl, fr, de, hi, id, it, ja, pt, ru, es, vi (mMARCO = MS MARCO translated). Cross-lingual: an English query ranks passages in any of them |
| vs. English MS MARCO MiniLM | the built English reranker is a BERT trained on English MS MARCO only; this is XLM-R trained on multilingual mMARCO — same idea, 14× the language reach |
| Quantization | fp32 (full precision, onnx/model.onnx) — the repo's int8 files use hardware-specific names transformers.js can't auto-resolve, so fp32 is the portable path |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~470 MB, cached after first load |
| License | Apache-2.0 — commercially usable (a real advantage over the CC-BY-NC jina-reranker-v2) |
| Web APIs | WebAssembly, Web Workers — all Baseline widely available |
Type a query and one candidate passage per line. The model scores each passage against the query and re-sorts them by relevance logit (higher = more relevant). The default set mixes English, Spanish, Japanese and German so you can see cross-language ranking.
The one number the model emits per pair is a relevance logit — unbounded, higher is more relevant (we also show its sigmoid as a 0–100% probability). First, the before/after view: the candidates in their original (retrieval) order on the left, and the cross-encoder's reordering on the right — arrows mark what moved. Then a second contrast ranks the same passages by naive shared-word overlap; where the columns disagree, the cross-encoder is using meaning, and it does so across languages — a word-overlap score can't match an English query to a Japanese or Spanish answer at all, but a multilingual cross-encoder can.
Rerankers are the precision stage of modern search. A fast retriever (a keyword index or embeddings) casts a wide net and returns, say, the top 50 candidates; a cross-encoder then reads each candidate against the query and reorders them with far higher accuracy. mMARCO mMiniLMv2 brings that precision to 14 languages from one 118M-parameter model, and — unlike the CC-BY-NC jina-reranker-v2 — under a permissive Apache-2.0 licence, so it can go into a commercial product. At ~470 MB it runs in a tab, so the precise, expensive step happens on-device with nothing sent anywhere.
Rank a handful of passages against a query by cross-encoder relevance.
Cross-lingual FAQ / support search: an English question over a multilingual answer bank.
Ask one question in 6 languages and watch the ranking stay stable — see the model's language-agnostic relevance.
Multilingual E5 embeddings retrieve, mMARCO mMiniLMv2 reorders — the classic retrieve-then-rerank.
Contrast with the built rerankers: the English MS MARCO MiniLM (same recipe, English only), the jina-reranker-v2 (multilingual + code, CC-BY-NC) and BGE-reranker-v2-m3 (multilingual, larger) — this one is the Apache-2.0, MS-MARCO-lineage multilingual option.
A cross-encoder scores query–passage pairs; we read the raw logit off the model directly:
import { AutoTokenizer, AutoModelForSequenceClassification } from "@huggingface/transformers";
const model_id = "cross-encoder/mmarco-mMiniLMv2-L12-H384-v1";
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
// config.json already carries model_type:"xlm-roberta", so a plain load routes correctly:
const model = await AutoModelForSequenceClassification.from_pretrained(model_id, { dtype: "fp32" });
// Encode the query with each passage AS A PAIR — [CLS] query [SEP] passage [SEP]:
const inputs = tokenizer(passages.map(() => query), { text_pair: passages, padding: true, truncation: true });
const { logits } = await model(inputs); // one relevance logit per pair — higher = more relevant
// sort the passages by logits.data — that's your reranking (works even when query and passage are in
// different languages, because the model was trained on mMARCO across 14 languages)
All inference runs in a Web Worker so ranking never janks the page. The pipeline helper would squash
the logit through a sigmoid, so this page reads model() directly to keep the raw logit.