feature-extraction Β· multi-task embeddings Β· text Β· WASM q8 Β· 23.27 MB

MongoDB mdbr-leaf-mt β€” 23 MB Multi-Task Semantic Embedder

Distilled via MongoDB Research's LEAF framework, MongoDB/mdbr-leaf-mt ranks #1 on MTEB v2 (English) among models ≀30M parameters (63.97 average across classification, clustering, STS, and retrieval) β€” executing locally in a Web Worker in ~21 ms with 384-d Matryoshka vectors.

At a glance

Model (Upstream & ONNX) MongoDB/mdbr-leaf-mt
Task / pipeline feature-extraction (pooling: "mean", normalize: true)
Architecture BertModel (MiniLM-L6-v2 LEAF multi-task) Β· 23M params Β· 6 layers Β· 12 heads Β· 384-d ONNX output (MRL 64d–384d) Β· 512 max tokens Β· 30,522 WordPiece vocab (SentenceTransformers adds an optional 2_Dense 384β†’1024 alignment layer to mxbai-embed-large-v1)
Multi-task prompting Symmetric (no prefix) for STS, paraphrase, and clustering; optional "Represent this sentence for searching relevant passages: " query prefix for retrieval
Quantization & size q8 ONNX (onnx/model_quantized.onnx 0.22 MB + onnx/model_quantized.onnx_data 23.05 MB = 23.27 MB)
Backend CPU WebAssembly (wasm) via shared lib/webai.js (@huggingface/transformers@3.7.5 β€” no WebGPU required)
License Apache-2.0

Run it β€” Multi-Task Similarity & Vector Workbench

Switch between Semantic Similarity, Paraphrase Matching, FAQ Clustering, and Cross-Domain Retrieval β€” or upload, drag-drop, or paste your own .txt, .md, .csv, or .json sentences.

Tip: drag and drop a file onto this zone or paste text anywhere outside an input field.

Ranked similarity to anchor

    Pairwise cosine similarity matrix

    Run inference above to inspect pairwise similarities across comparison texts.

    See inside β€” 384-d vector sparkline & 16-bin distribution

    The browser ONNX export outputs a 384-dimensional unit-norm vector from the distilled MiniLM-L6-v2 backbone (without the optional 2_Dense 384β†’1024 SentenceTransformers projection). Dashed vertical guides mark 64d, 128d, and 256d Matryoshka truncation boundaries.

    Why it matters

    Multi-task general-purpose #1 under 30M params: Unlike retrieval-only mdbr-leaf-ir, mdbr-leaf-mt is distilled for broad multi-task embeddings β€” semantic textual similarity, clustering, paraphrase detection, and zero-shot classification β€” while staying 23.27 MB in CPU WASM.

    Use-case ladder

    Show the code

    Show the code: Web Worker feature-extraction forward pass (worker.js)
    Show the code: 384-d vector diagnostics & 16-bin histogram (mt-core.mjs)

    References