At a glance
| Upstream model | sentence-transformers/multi-qa-mpnet-base-dot-v1 |
|---|---|
| Browser ONNX build |
Xenova/multi-qa-mpnet-base-dot-v1
· onnx/model_quantized.onnx
|
| Task / pipeline |
sentence-similarity via pipeline("feature-extraction", …, { device: "wasm", dtype: "q8" })
with { pooling: "cls", normalize: false } (1_Pooling/config.json:
pooling_mode_cls_token: true) → 768-d un-normalized dot-product vector
|
| Architecture |
MPNetForMaskedLM (mpnet) · 12 layers · 12 heads · 768 hidden ·
3,072 FFN · 109.5M params · 30,527 WordPiece vocab (<s>=0, <pad>=1, </s>=2)
|
| Sequence limits |
512 content tokens (model_max_length: 512, max_position_embeddings: 514)
|
| Quantisation & download |
q8 · 110.09 MB ONNX (110,086,121 B) + 0.71 MB tokenizer
(710,944 B) + configs (957 B) = 110.80 MB decimal total
|
| Backend & runtime | CPU WebAssembly (wasm) via shared ../../lib/webai.js (Transformers.js 3.7.5) inside a dedicated Web Worker |
| License | Apache-2.0 |
1. Live CLS dot-product QA retrieval & norm comparison
Unlike cosine-normalized SentenceTransformers,
multi-qa-mpnet-base-dot-v1 keeps raw
[CLS] (<s>) magnitudes (‖v‖ > 1) and ranks answers by
un-normalized dot product q · d = ‖q‖ · ‖d‖ · cos(θ). Inspect both q · d
and cos(q, d) alongside answer L2 norms below.
Backend · dtype–
Latency–
Top dot (q · d)–
Top cosine–
L2 norm range (‖v‖)–
>512 tok · NaN–
| Rank | Answer passage | Dot (q · d) | Cosine | ‖d‖ norm | MPNet tok |
|---|---|---|---|---|---|
| Initialise multi-qa-mpnet-base-dot-v1 above to compute live 768-d CLS dot-product embeddings. | |||||
2. See inside: pairwise dot-product matrix, 2-D PCA & MPNet tokens
Left: N×N pairwise un-normalized dot-product matrix (diagonal = ‖d‖², highlighting norm differences).
Right: deterministic 2-D PCA projection showing the question (★) and dashed rays to its Top-3 answers.
Pairwise dot-product matrix (q · d)
2-D PCA 768-d QA space
Query MPNet WordPiece tokenization (30,527-token vocab, <s>=0, </s>=2)
Run inference to inspect <s>, WordPiece subwords (##), and </s> tokens.
Why multi-qa-mpnet-base-dot-v1 matters
- Asymmetric QA specialization (215M pairs): trained explicitly to match short questions against longer factual answers across StackExchange, MS MARCO, Natural Questions, ELI5, and PAQ.
- Un-normalized CLS dot product: preserves embedding magnitudes (
‖v‖) instead of dividing them away, encoding answer confidence/specificity alongside angular similarity. - Full 512-token MPNet context: supports twice the token capacity of 256-token MiniLM models, letting long answers survive without premature truncation.
Use-case ladder
- Basics — CLS Dot-Product vs Mean/Cosine Ablation & 512-Token Ceiling: compare all 4 pooling/normalization modes live, measure norm amplification, and audit token survival from 128 → 512 tokens.
- Practical — Local QA Knowledge-Base Matcher & Coverage Auditor: upload multiple
.txt/.csv/.jsonanswer docs, score batches of test questions off the main thread, cancel mid-batch cleanly, and export coverage gaps. - Wild — 6 Empirical QA Dot-Product Stress Probes: probe dot-norm rank flips, 512-token needle survival, Q→A asymmetry, negation blindness, uncased MPNet entity folding, and numeric precision blindness.
- Multi-model — Stage 1 MPNet QA Retrieval → Stage 2 Cross-Encoder Reranking: chain
Xenova/multi-qa-mpnet-base-dot-v1(110.80 MB) intoXenova/ms-marco-MiniLM-L-12-v2(34.20 MB) to resolve bi-encoder blind spots with Spearmanρand a bump chart.
How the API works
import { pipeline } from "@huggingface/transformers";
const extractor = await pipeline("feature-extraction", "Xenova/multi-qa-mpnet-base-dot-v1", {
device: "wasm",
dtype: "q8",
});
// Exact SentenceTransformers 1_Pooling/config.json contract: CLS pooling + normalize: false
const out = await extractor(["How many people live in London?", "Around 9 million people live in London."], {
pooling: "cls",
normalize: false,
});
// out.dims = [2, 768]; score = un-normalized dot product sum(q[i] * d[i])