reranker (text-classification) Β· text Β· WASM Β· ~90 MB
This is mixedbread's reranker. Like every cross-encoder it reads a query and a passage together and outputs one relevance score β but its backbone is DeBERTa-v2 with disentangled attention, a different architecture from the BERT-family and XLM-RoBERTa rerankers already in this showcase. It's English-focused and tiny (~90 MB at q8). Give it a query and some candidates, watch it re-sort them, then look inside at the raw logit per pair and how decisively the top answer wins. Nothing leaves your device.
| Model | mixedbread-ai/mxbai-rerank-xsmall-v1 (ships its own transformers.js 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 | DeBERTa-v2 xsmall (12 layers, hidden 384, disentangled attention) fine-tuned by mixedbread for passage reranking |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~90 MB, cached after first load |
| License | Apache-2.0 |
| 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 is full of near-misses β passages that share words with the query but don't actually answer it.
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 the decision margin: the logit gap between adjacent ranks. A big #1β#2 gap means the model chose confidently; a small gap means the top answers are close (feed several to your LLM). Finally a naive shared-word ranking, to show where the cross-encoder disagrees with keywords.
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. mxbai-rerank is a strong, compact English reranker with a DeBERTa-v2 backbone β a different bet from the BERT/RoBERTa rerankers, and small enough (~90 MB) to run in a tab. The precise, expensive step happens on-device with nothing sent anywhere.
Rank a handful of passages against a query by cross-encoder relevance.
Two-stage RAG: retrieve a shortlist, then rerank it for precision.
Adversarial hard negatives: distractors built to fool keyword and embedding search.
GTE embeddings retrieve, mxbai-rerank reorders β the classic retrieve-then-rerank.
Compare with the other cross-encoders: the multilingual BGE-reranker (XLM-RoBERTa), the MS MARCO MiniLM (BERT), and the Jina reranker (JinaBERT) β same idea, four different backbones.
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 = "mixedbread-ai/mxbai-rerank-xsmall-v1";
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const model = await AutoModelForSequenceClassification.from_pretrained(model_id, { dtype: "q8" });
// 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
This page loads the model through the shared loader as a text-classification pipeline,
then reuses pipe.model + pipe.tokenizer to read the raw logits (the pipeline
would squash them through a sigmoid). All inference runs in a Web Worker so ranking never janks the page.